From 84ad6dafa8d6abed00ffd7e96170e2f4334f2d8c Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 1 Jun 2026 08:35:26 +0000 Subject: [PATCH] Regenerate client from commit 0c82d0f of spec repo --- .generator/schemas/v2/openapi.yaml | 4356 +++++++++++ api/datadog/configuration.go | 37 + api/datadogV2/api_incidents.go | 6499 +++++++++++++---- api/datadogV2/doc.go | 37 + ..._ai_postmortem_data_attributes_response.go | 312 + ...el_incident_ai_postmortem_data_response.go | 180 + .../model_incident_ai_postmortem_response.go | 110 + ...el_incident_ai_postmortem_response_type.go | 64 + ...t_configuration_data_attributes_request.go | 207 + ..._configuration_data_attributes_response.go | 314 + ...del_incident_configuration_data_request.go | 149 + ...el_incident_configuration_data_response.go | 218 + ...iguration_patch_data_attributes_request.go | 207 + ...cident_configuration_patch_data_request.go | 183 + ...el_incident_configuration_patch_request.go | 110 + ...el_incident_configuration_relationships.go | 149 + .../model_incident_configuration_request.go | 110 + .../model_incident_configuration_response.go | 145 + .../model_incident_configuration_type.go | 64 + ...te_on_call_page_data_attributes_request.go | 289 + ...cident_create_on_call_page_data_request.go | 146 + ...el_incident_create_on_call_page_request.go | 110 + ...e_from_incident_data_attributes_request.go | 324 + ..._create_page_from_incident_data_request.go | 146 + ...ident_create_page_from_incident_request.go | 110 + ...incident_create_page_from_incident_type.go | 64 + ...t_configuration_data_attributes_request.go | 197 + ..._configuration_data_attributes_response.go | 270 + ..._google_chat_configuration_data_request.go | 181 + ...google_chat_configuration_data_response.go | 218 + ...iguration_patch_data_attributes_request.go | 207 + ...e_chat_configuration_patch_data_request.go | 183 + ...google_chat_configuration_patch_request.go | 110 + ...google_chat_configuration_relationships.go | 187 + ...hat_configuration_relationships_request.go | 110 + ...ident_google_chat_configuration_request.go | 110 + ...dent_google_chat_configuration_response.go | 145 + ...incident_google_chat_configuration_type.go | 64 + ...t_configuration_data_attributes_request.go | 133 + ..._configuration_data_attributes_response.go | 209 + ..._google_meet_configuration_data_request.go | 181 + ...google_meet_configuration_data_response.go | 218 + ...iguration_patch_data_attributes_request.go | 137 + ...e_meet_configuration_patch_data_request.go | 183 + ...google_meet_configuration_patch_request.go | 110 + ...google_meet_configuration_relationships.go | 187 + ...eet_configuration_relationships_request.go | 110 + ...ident_google_meet_configuration_request.go | 110 + ...dent_google_meet_configuration_response.go | 145 + ...incident_google_meet_configuration_type.go | 64 + .../model_incident_impact_field_choice.go | 168 + ...nt_impact_field_data_attributes_request.go | 256 + ...t_impact_field_data_attributes_response.go | 256 + ...odel_incident_impact_field_data_request.go | 181 + ...del_incident_impact_field_data_response.go | 218 + ...del_incident_impact_field_relationships.go | 187 + ...dent_impact_field_relationships_request.go | 110 + .../model_incident_impact_field_request.go | 110 + .../model_incident_impact_field_response.go | 145 + .../model_incident_impact_field_type.go | 64 + .../model_incident_impact_field_value_type.go | 76 + .../model_incident_impact_fields_response.go | 136 + ...nt_on_call_page_data_attributes_request.go | 181 + ...odel_incident_on_call_page_data_request.go | 181 + ...odel_incident_on_call_page_link_request.go | 110 + .../model_incident_on_call_page_target.go | 133 + .../model_incident_on_call_page_type.go | 64 + ...t_org_settings_data_attributes_response.go | 174 + ...del_incident_org_settings_data_response.go | 218 + ...del_incident_org_settings_list_response.go | 101 + ...del_incident_org_settings_relationships.go | 111 + .../model_incident_org_settings_response.go | 110 + .../model_incident_org_settings_type.go | 64 + .../model_incident_page_role_reference.go | 145 + .../model_incident_page_role_type.go | 66 + api/datadogV2/model_incident_page_target.go | 143 + .../model_incident_page_target_type.go | 68 + .../model_incident_page_uuid_data_response.go | 145 + .../model_incident_page_uuid_response.go | 110 + .../model_incident_page_uuid_type.go | 64 + ...dent_responder_data_attributes_response.go | 348 + .../model_incident_responder_data_request.go | 146 + .../model_incident_responder_data_response.go | 218 + .../model_incident_responder_relationships.go | 233 + ...ncident_responder_relationships_request.go | 110 + .../model_incident_responder_request.go | 110 + .../model_incident_responder_response.go | 145 + ...onder_role_assignment_relationship_data.go | 135 + ...responder_role_assignments_relationship.go | 102 + .../model_incident_responder_type.go | 64 + ...el_incident_responder_user_relationship.go | 110 + ...cident_responder_user_relationship_data.go | 135 + .../model_incident_responders_response.go | 136 + .../model_incident_rule_condition.go | 133 + ...l_incident_rule_data_attributes_request.go | 435 ++ ..._incident_rule_data_attributes_response.go | 692 ++ .../model_incident_rule_data_request.go | 146 + .../model_incident_rule_data_response.go | 180 + .../model_incident_rule_execution_type.go | 66 + ...dent_rule_patch_data_attributes_request.go | 255 + .../model_incident_rule_patch_data_request.go | 183 + .../model_incident_rule_patch_request.go | 110 + .../model_incident_rule_query_condition.go | 159 + api/datadogV2/model_incident_rule_request.go | 110 + api/datadogV2/model_incident_rule_response.go | 110 + .../model_incident_rule_response_type.go | 64 + .../model_incident_rule_task_id_type.go | 86 + .../model_incident_rule_trigger_type.go | 68 + api/datadogV2/model_incident_rule_type.go | 64 + .../model_incident_rules_response.go | 101 + ...vice_now_record_data_attributes_request.go | 200 + ...ncident_service_now_record_data_request.go | 146 + ...incident_service_now_record_prompt_type.go | 64 + ...del_incident_service_now_record_request.go | 110 + ...estamp_override_data_attributes_request.go | 148 + ...stamp_override_data_attributes_response.go | 298 + ...ncident_timestamp_override_data_request.go | 146 + ...cident_timestamp_override_data_response.go | 218 + ..._override_patch_data_attributes_request.go | 153 + ...t_timestamp_override_patch_data_request.go | 183 + ...cident_timestamp_override_patch_request.go | 110 + ...cident_timestamp_override_relationships.go | 149 + ...del_incident_timestamp_override_request.go | 110 + ...el_incident_timestamp_override_response.go | 145 + .../model_incident_timestamp_override_type.go | 64 + ...l_incident_timestamp_overrides_response.go | 136 + .../model_incident_timestamp_type.go | 70 + ...er_defined_role_data_attributes_request.go | 188 + ...r_defined_role_data_attributes_response.go | 261 + ...incident_user_defined_role_data_request.go | 181 + ...ncident_user_defined_role_data_response.go | 218 + ...defined_role_incident_type_relationship.go | 110 + ...ed_role_incident_type_relationship_data.go | 135 + ...ncident_user_defined_role_included_item.go | 105 + ...ined_role_patch_data_attributes_request.go | 192 + ...nt_user_defined_role_patch_data_request.go | 183 + ...ncident_user_defined_role_patch_request.go | 110 + ...model_incident_user_defined_role_policy.go | 101 + ...user_defined_role_relationships_request.go | 110 + ...ser_defined_role_relationships_response.go | 187 + ...odel_incident_user_defined_role_request.go | 110 + ...del_incident_user_defined_role_response.go | 145 + .../model_incident_user_defined_role_type.go | 64 + ...el_incident_user_defined_roles_response.go | 136 + examples/v2/incidents/PatchIncidentImpact.go | 45 + examples/v2/incidents/UpdateIncidentImpact.go | 45 + tests/scenarios/features/v2/incidents.feature | 60 + tests/scenarios/features/v2/undo.json | 12 + 148 files changed, 31159 insertions(+), 1447 deletions(-) create mode 100644 api/datadogV2/model_incident_ai_postmortem_data_attributes_response.go create mode 100644 api/datadogV2/model_incident_ai_postmortem_data_response.go create mode 100644 api/datadogV2/model_incident_ai_postmortem_response.go create mode 100644 api/datadogV2/model_incident_ai_postmortem_response_type.go create mode 100644 api/datadogV2/model_incident_configuration_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_configuration_data_attributes_response.go create mode 100644 api/datadogV2/model_incident_configuration_data_request.go create mode 100644 api/datadogV2/model_incident_configuration_data_response.go create mode 100644 api/datadogV2/model_incident_configuration_patch_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_configuration_patch_data_request.go create mode 100644 api/datadogV2/model_incident_configuration_patch_request.go create mode 100644 api/datadogV2/model_incident_configuration_relationships.go create mode 100644 api/datadogV2/model_incident_configuration_request.go create mode 100644 api/datadogV2/model_incident_configuration_response.go create mode 100644 api/datadogV2/model_incident_configuration_type.go create mode 100644 api/datadogV2/model_incident_create_on_call_page_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_create_on_call_page_data_request.go create mode 100644 api/datadogV2/model_incident_create_on_call_page_request.go create mode 100644 api/datadogV2/model_incident_create_page_from_incident_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_create_page_from_incident_data_request.go create mode 100644 api/datadogV2/model_incident_create_page_from_incident_request.go create mode 100644 api/datadogV2/model_incident_create_page_from_incident_type.go create mode 100644 api/datadogV2/model_incident_google_chat_configuration_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_google_chat_configuration_data_attributes_response.go create mode 100644 api/datadogV2/model_incident_google_chat_configuration_data_request.go create mode 100644 api/datadogV2/model_incident_google_chat_configuration_data_response.go create mode 100644 api/datadogV2/model_incident_google_chat_configuration_patch_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_google_chat_configuration_patch_data_request.go create mode 100644 api/datadogV2/model_incident_google_chat_configuration_patch_request.go create mode 100644 api/datadogV2/model_incident_google_chat_configuration_relationships.go create mode 100644 api/datadogV2/model_incident_google_chat_configuration_relationships_request.go create mode 100644 api/datadogV2/model_incident_google_chat_configuration_request.go create mode 100644 api/datadogV2/model_incident_google_chat_configuration_response.go create mode 100644 api/datadogV2/model_incident_google_chat_configuration_type.go create mode 100644 api/datadogV2/model_incident_google_meet_configuration_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_google_meet_configuration_data_attributes_response.go create mode 100644 api/datadogV2/model_incident_google_meet_configuration_data_request.go create mode 100644 api/datadogV2/model_incident_google_meet_configuration_data_response.go create mode 100644 api/datadogV2/model_incident_google_meet_configuration_patch_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_google_meet_configuration_patch_data_request.go create mode 100644 api/datadogV2/model_incident_google_meet_configuration_patch_request.go create mode 100644 api/datadogV2/model_incident_google_meet_configuration_relationships.go create mode 100644 api/datadogV2/model_incident_google_meet_configuration_relationships_request.go create mode 100644 api/datadogV2/model_incident_google_meet_configuration_request.go create mode 100644 api/datadogV2/model_incident_google_meet_configuration_response.go create mode 100644 api/datadogV2/model_incident_google_meet_configuration_type.go create mode 100644 api/datadogV2/model_incident_impact_field_choice.go create mode 100644 api/datadogV2/model_incident_impact_field_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_impact_field_data_attributes_response.go create mode 100644 api/datadogV2/model_incident_impact_field_data_request.go create mode 100644 api/datadogV2/model_incident_impact_field_data_response.go create mode 100644 api/datadogV2/model_incident_impact_field_relationships.go create mode 100644 api/datadogV2/model_incident_impact_field_relationships_request.go create mode 100644 api/datadogV2/model_incident_impact_field_request.go create mode 100644 api/datadogV2/model_incident_impact_field_response.go create mode 100644 api/datadogV2/model_incident_impact_field_type.go create mode 100644 api/datadogV2/model_incident_impact_field_value_type.go create mode 100644 api/datadogV2/model_incident_impact_fields_response.go create mode 100644 api/datadogV2/model_incident_on_call_page_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_on_call_page_data_request.go create mode 100644 api/datadogV2/model_incident_on_call_page_link_request.go create mode 100644 api/datadogV2/model_incident_on_call_page_target.go create mode 100644 api/datadogV2/model_incident_on_call_page_type.go create mode 100644 api/datadogV2/model_incident_org_settings_data_attributes_response.go create mode 100644 api/datadogV2/model_incident_org_settings_data_response.go create mode 100644 api/datadogV2/model_incident_org_settings_list_response.go create mode 100644 api/datadogV2/model_incident_org_settings_relationships.go create mode 100644 api/datadogV2/model_incident_org_settings_response.go create mode 100644 api/datadogV2/model_incident_org_settings_type.go create mode 100644 api/datadogV2/model_incident_page_role_reference.go create mode 100644 api/datadogV2/model_incident_page_role_type.go create mode 100644 api/datadogV2/model_incident_page_target.go create mode 100644 api/datadogV2/model_incident_page_target_type.go create mode 100644 api/datadogV2/model_incident_page_uuid_data_response.go create mode 100644 api/datadogV2/model_incident_page_uuid_response.go create mode 100644 api/datadogV2/model_incident_page_uuid_type.go create mode 100644 api/datadogV2/model_incident_responder_data_attributes_response.go create mode 100644 api/datadogV2/model_incident_responder_data_request.go create mode 100644 api/datadogV2/model_incident_responder_data_response.go create mode 100644 api/datadogV2/model_incident_responder_relationships.go create mode 100644 api/datadogV2/model_incident_responder_relationships_request.go create mode 100644 api/datadogV2/model_incident_responder_request.go create mode 100644 api/datadogV2/model_incident_responder_response.go create mode 100644 api/datadogV2/model_incident_responder_role_assignment_relationship_data.go create mode 100644 api/datadogV2/model_incident_responder_role_assignments_relationship.go create mode 100644 api/datadogV2/model_incident_responder_type.go create mode 100644 api/datadogV2/model_incident_responder_user_relationship.go create mode 100644 api/datadogV2/model_incident_responder_user_relationship_data.go create mode 100644 api/datadogV2/model_incident_responders_response.go create mode 100644 api/datadogV2/model_incident_rule_condition.go create mode 100644 api/datadogV2/model_incident_rule_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_rule_data_attributes_response.go create mode 100644 api/datadogV2/model_incident_rule_data_request.go create mode 100644 api/datadogV2/model_incident_rule_data_response.go create mode 100644 api/datadogV2/model_incident_rule_execution_type.go create mode 100644 api/datadogV2/model_incident_rule_patch_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_rule_patch_data_request.go create mode 100644 api/datadogV2/model_incident_rule_patch_request.go create mode 100644 api/datadogV2/model_incident_rule_query_condition.go create mode 100644 api/datadogV2/model_incident_rule_request.go create mode 100644 api/datadogV2/model_incident_rule_response.go create mode 100644 api/datadogV2/model_incident_rule_response_type.go create mode 100644 api/datadogV2/model_incident_rule_task_id_type.go create mode 100644 api/datadogV2/model_incident_rule_trigger_type.go create mode 100644 api/datadogV2/model_incident_rule_type.go create mode 100644 api/datadogV2/model_incident_rules_response.go create mode 100644 api/datadogV2/model_incident_service_now_record_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_service_now_record_data_request.go create mode 100644 api/datadogV2/model_incident_service_now_record_prompt_type.go create mode 100644 api/datadogV2/model_incident_service_now_record_request.go create mode 100644 api/datadogV2/model_incident_timestamp_override_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_timestamp_override_data_attributes_response.go create mode 100644 api/datadogV2/model_incident_timestamp_override_data_request.go create mode 100644 api/datadogV2/model_incident_timestamp_override_data_response.go create mode 100644 api/datadogV2/model_incident_timestamp_override_patch_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_timestamp_override_patch_data_request.go create mode 100644 api/datadogV2/model_incident_timestamp_override_patch_request.go create mode 100644 api/datadogV2/model_incident_timestamp_override_relationships.go create mode 100644 api/datadogV2/model_incident_timestamp_override_request.go create mode 100644 api/datadogV2/model_incident_timestamp_override_response.go create mode 100644 api/datadogV2/model_incident_timestamp_override_type.go create mode 100644 api/datadogV2/model_incident_timestamp_overrides_response.go create mode 100644 api/datadogV2/model_incident_timestamp_type.go create mode 100644 api/datadogV2/model_incident_user_defined_role_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_user_defined_role_data_attributes_response.go create mode 100644 api/datadogV2/model_incident_user_defined_role_data_request.go create mode 100644 api/datadogV2/model_incident_user_defined_role_data_response.go create mode 100644 api/datadogV2/model_incident_user_defined_role_incident_type_relationship.go create mode 100644 api/datadogV2/model_incident_user_defined_role_incident_type_relationship_data.go create mode 100644 api/datadogV2/model_incident_user_defined_role_included_item.go create mode 100644 api/datadogV2/model_incident_user_defined_role_patch_data_attributes_request.go create mode 100644 api/datadogV2/model_incident_user_defined_role_patch_data_request.go create mode 100644 api/datadogV2/model_incident_user_defined_role_patch_request.go create mode 100644 api/datadogV2/model_incident_user_defined_role_policy.go create mode 100644 api/datadogV2/model_incident_user_defined_role_relationships_request.go create mode 100644 api/datadogV2/model_incident_user_defined_role_relationships_response.go create mode 100644 api/datadogV2/model_incident_user_defined_role_request.go create mode 100644 api/datadogV2/model_incident_user_defined_role_response.go create mode 100644 api/datadogV2/model_incident_user_defined_role_type.go create mode 100644 api/datadogV2/model_incident_user_defined_roles_response.go create mode 100644 examples/v2/incidents/PatchIncidentImpact.go create mode 100644 examples/v2/incidents/UpdateIncidentImpact.go diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index b2e0e022c91..fba8f21df2d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -675,6 +675,22 @@ components: required: true schema: type: string + IncidentGoogleChatConfigurationIDPathParameter: + description: The UUID of the Google Chat configuration. + in: path + name: id + required: true + schema: + format: uuid + type: string + IncidentGoogleMeetConfigurationIDPathParameter: + description: The UUID of the Google Meet configuration. + in: path + name: id + required: true + schema: + format: uuid + type: string IncidentIDPathParameter: description: The UUID of the incident. in: path @@ -682,6 +698,14 @@ components: required: true schema: type: string + IncidentImpactFieldIDPathParameter: + description: The UUID of the impact field. + in: path + name: field_id + required: true + schema: + format: uuid + type: string IncidentImpactIDPathParameter: description: The UUID of the incident impact. in: path @@ -774,6 +798,30 @@ components: schema: example: "created_by_user,incident_type" type: string + IncidentOrgSettingsTypeIDPathParameter: + description: The UUID of the incident type. + in: path + name: incident_type_id + required: true + schema: + format: uuid + type: string + IncidentResponderIDPathParameter: + description: The UUID of the incident responder. + in: path + name: responder_id + required: true + schema: + format: uuid + type: string + IncidentRuleIDPathParameter: + description: The UUID of the incident rule. + in: path + name: rule_id + required: true + schema: + format: uuid + type: string IncidentSearchIncludeQueryParameter: description: Specifies which types of related objects should be included in the response. in: query @@ -822,6 +870,14 @@ components: schema: example: "ExampleServiceName" type: string + IncidentTimestampOverrideIDPathParameter: + description: The UUID of the timestamp override. + in: path + name: id + required: true + schema: + format: uuid + type: string IncidentTodoIDPathParameter: description: The UUID of the incident todo. in: path @@ -851,6 +907,15 @@ components: schema: example: "00000000-0000-0000-0000-000000000000" type: string + IncidentUserDefinedRoleIDPathParameter: + description: The UUID of the incident user-defined role. + in: path + name: role_id + required: true + schema: + example: "00000000-0000-0000-0000-000000000002" + format: uuid + type: string Include: description: Include relationship data. explode: true @@ -38599,6 +38664,71 @@ components: type: string x-mimetype: application/xml type: object + IncidentAIPostmortemDataAttributesResponse: + description: Attributes of an AI-generated incident postmortem. + properties: + action_items: + description: Action items to prevent recurrence. + example: "1. Improve failover testing. 2. Add more monitoring alerts." + type: string + customer_impact: + description: The impact of the incident on customers. + example: "5% of users experienced timeouts for 30 minutes." + type: string + executive_summary: + description: An executive summary of the incident. + example: "A database failover caused a 30-minute service outage affecting 5% of users." + type: string + key_insights: + description: Key insights from the incident. + example: "The auto-failover mechanism was slower than expected under high load." + type: string + key_timeline: + description: Key timeline events during the incident. + example: "10:00 - Alert fired. 10:05 - On-call engineer paged. 10:30 - Issue resolved." + type: string + lessons_learned: + description: Lessons learned from the incident. + example: "We need to test the failover process under realistic load conditions." + type: string + system_overview: + description: An overview of the affected systems. + example: "The primary database cluster experienced a failover event." + type: string + type: object + IncidentAIPostmortemDataResponse: + description: AI postmortem data in a response. + properties: + attributes: + $ref: "#/components/schemas/IncidentAIPostmortemDataAttributesResponse" + id: + description: The incident identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + type: + $ref: "#/components/schemas/IncidentAIPostmortemResponseType" + required: + - id + - type + - attributes + type: object + IncidentAIPostmortemResponse: + description: Response with an AI-generated incident postmortem. + properties: + data: + $ref: "#/components/schemas/IncidentAIPostmortemDataResponse" + required: + - data + type: object + IncidentAIPostmortemResponseType: + description: AI postmortem response resource type. + enum: + - get_incident_ai_postmortem_response + example: get_incident_ai_postmortem_response + type: string + x-enum-varnames: + - GET_INCIDENT_AI_POSTMORTEM_RESPONSE IncidentAttachmentType: default: incident_attachments description: The incident attachment resource type. @@ -38608,6 +38738,175 @@ components: type: string x-enum-varnames: - INCIDENT_ATTACHMENTS + IncidentConfigurationDataAttributesRequest: + description: Attributes for creating an incident configuration. + properties: + execute_integrations: + description: Whether to execute integrations for this incident. + example: true + type: boolean + execute_notification_rules: + description: Whether to execute notification rules for this incident. + example: true + type: boolean + include_in_analytics: + description: Whether to include this incident in analytics. + example: true + type: boolean + include_in_search: + description: Whether to include this incident in search results. + example: true + type: boolean + type: object + IncidentConfigurationDataAttributesResponse: + description: Attributes of an incident configuration in a response. + properties: + created_at: + description: Timestamp when the configuration was created. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + execute_integrations: + description: Whether integrations are executed for this incident. + example: true + type: boolean + execute_notification_rules: + description: Whether notification rules are executed for this incident. + example: true + type: boolean + incident_id: + description: The incident identifier. + example: 00000000-0000-0000-0000-000000000000 + type: string + include_in_analytics: + description: Whether this incident is included in analytics. + example: true + type: boolean + include_in_search: + description: Whether this incident is included in search results. + example: true + type: boolean + modified_at: + description: Timestamp when the configuration was last modified. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + required: + - incident_id + - created_at + - modified_at + type: object + IncidentConfigurationDataRequest: + description: Incident configuration data in a create request. + properties: + attributes: + $ref: "#/components/schemas/IncidentConfigurationDataAttributesRequest" + type: + $ref: "#/components/schemas/IncidentConfigurationType" + required: + - type + type: object + IncidentConfigurationDataResponse: + description: Incident configuration data in a response. + properties: + attributes: + $ref: "#/components/schemas/IncidentConfigurationDataAttributesResponse" + id: + description: The incident configuration identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + relationships: + $ref: "#/components/schemas/IncidentConfigurationRelationships" + type: + $ref: "#/components/schemas/IncidentConfigurationType" + required: + - id + - type + - attributes + type: object + IncidentConfigurationPatchDataAttributesRequest: + description: Attributes for patching an incident configuration. All fields are optional. + properties: + execute_integrations: + description: Whether to execute integrations for this incident. + example: true + type: boolean + execute_notification_rules: + description: Whether to execute notification rules for this incident. + example: true + type: boolean + include_in_analytics: + description: Whether to include this incident in analytics. + example: true + type: boolean + include_in_search: + description: Whether to include this incident in search results. + example: true + type: boolean + type: object + IncidentConfigurationPatchDataRequest: + description: Incident configuration data in a patch request. + properties: + attributes: + $ref: "#/components/schemas/IncidentConfigurationPatchDataAttributesRequest" + id: + description: The incident configuration identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + type: + $ref: "#/components/schemas/IncidentConfigurationType" + required: + - id + - type + type: object + IncidentConfigurationPatchRequest: + description: Request payload for patching an incident configuration. + properties: + data: + $ref: "#/components/schemas/IncidentConfigurationPatchDataRequest" + required: + - data + type: object + IncidentConfigurationRelationships: + description: Relationships for an incident configuration. + properties: + created_by_user: + $ref: "#/components/schemas/RelationshipToUser" + last_modified_by_user: + $ref: "#/components/schemas/RelationshipToUser" + type: object + IncidentConfigurationRequest: + description: Request payload for creating an incident configuration. + properties: + data: + $ref: "#/components/schemas/IncidentConfigurationDataRequest" + required: + - data + type: object + IncidentConfigurationResponse: + description: Response with an incident configuration. + properties: + data: + $ref: "#/components/schemas/IncidentConfigurationDataResponse" + included: + description: Included related resources. + items: + $ref: "#/components/schemas/IncidentUserData" + readOnly: true + type: array + required: + - data + type: object + IncidentConfigurationType: + description: Incident configuration resource type. + enum: + - incidents_configurations + example: incidents_configurations + type: string + x-enum-varnames: + - INCIDENTS_CONFIGURATIONS IncidentCreateAttributes: description: The incident's attributes for a create request. properties: @@ -38665,6 +38964,117 @@ components: - type - attributes type: object + IncidentCreateOnCallPageDataAttributesRequest: + description: Attributes for creating an on-call page from an incident. + properties: + description: + description: The description of the page. + example: A critical incident affecting production systems. + type: string + role: + $ref: "#/components/schemas/IncidentPageRoleReference" + services: + description: List of affected services. + example: + - web-store + items: + type: string + type: array + tags: + description: List of tags for the page. + example: + - env:prod + items: + type: string + type: array + target: + $ref: "#/components/schemas/IncidentPageTarget" + title: + description: The title of the page. + example: Production outage - SEV-1 + type: string + type: object + IncidentCreateOnCallPageDataRequest: + description: On-call page data in a create request. + properties: + attributes: + $ref: "#/components/schemas/IncidentCreateOnCallPageDataAttributesRequest" + type: + $ref: "#/components/schemas/IncidentCreatePageFromIncidentType" + required: + - type + - attributes + type: object + IncidentCreateOnCallPageRequest: + description: Request payload for creating an on-call page from an incident. + properties: + data: + $ref: "#/components/schemas/IncidentCreateOnCallPageDataRequest" + required: + - data + type: object + IncidentCreatePageFromIncidentDataAttributesRequest: + description: Attributes for creating a page from an incident. + properties: + description: + description: The description of the page. + example: A critical incident affecting production systems. + type: string + incident_public_id: + description: The public ID of the incident. + example: "12345" + type: string + role: + $ref: "#/components/schemas/IncidentPageRoleReference" + services: + description: List of affected services. + example: + - web-store + - checkout + items: + type: string + type: array + tags: + description: List of tags for the page. + example: + - env:prod + items: + type: string + type: array + target: + $ref: "#/components/schemas/IncidentPageTarget" + title: + description: The title of the page. + example: Production outage - SEV-1 + type: string + type: object + IncidentCreatePageFromIncidentDataRequest: + description: Page data in a create request. + properties: + attributes: + $ref: "#/components/schemas/IncidentCreatePageFromIncidentDataAttributesRequest" + type: + $ref: "#/components/schemas/IncidentCreatePageFromIncidentType" + required: + - type + - attributes + type: object + IncidentCreatePageFromIncidentRequest: + description: Request payload for creating a page from an incident. + properties: + data: + $ref: "#/components/schemas/IncidentCreatePageFromIncidentDataRequest" + required: + - data + type: object + IncidentCreatePageFromIncidentType: + description: Resource type for a page creation request. + enum: + - page + example: page + type: string + x-enum-varnames: + - PAGE IncidentCreateRelationships: description: The relationships the incident will have with other resources once created. properties: @@ -38738,6 +39148,351 @@ components: - TEXTARRAY - METRICTAG - AUTOCOMPLETE + IncidentGoogleChatConfigurationDataAttributesRequest: + description: Attributes for creating a Google Chat configuration. + properties: + domain_id: + description: The Google Chat domain ID. + example: my-domain + type: string + space_name_template: + description: The template for the Google Chat space name. + example: "{{incident.title}}" + type: string + space_target_audience_id: + description: The target audience ID for the Google Chat space. + example: "123456789" + type: string + space_time_zone: + description: The time zone for the Google Chat space. + example: America/New_York + type: string + required: + - domain_id + - space_name_template + - space_time_zone + - space_target_audience_id + type: object + IncidentGoogleChatConfigurationDataAttributesResponse: + description: Attributes of a Google Chat configuration. + properties: + created_at: + description: Timestamp when the configuration was created. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + domain_id: + description: The Google Chat domain ID. + example: my-domain + type: string + modified_at: + description: Timestamp when the configuration was last modified. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + space_name_template: + description: The template for the Google Chat space name. + example: "{{incident.title}}" + type: string + space_target_audience_id: + description: The target audience ID for the Google Chat space. + example: "123456789" + type: string + space_time_zone: + description: The time zone for the Google Chat space. + example: America/New_York + type: string + required: + - domain_id + - space_name_template + - space_time_zone + - space_target_audience_id + - created_at + - modified_at + type: object + IncidentGoogleChatConfigurationDataRequest: + description: Google Chat configuration data in a create request. + properties: + attributes: + $ref: "#/components/schemas/IncidentGoogleChatConfigurationDataAttributesRequest" + relationships: + $ref: "#/components/schemas/IncidentGoogleChatConfigurationRelationshipsRequest" + type: + $ref: "#/components/schemas/IncidentGoogleChatConfigurationType" + required: + - type + - attributes + - relationships + type: object + IncidentGoogleChatConfigurationDataResponse: + description: Google Chat configuration data in a response. + properties: + attributes: + $ref: "#/components/schemas/IncidentGoogleChatConfigurationDataAttributesResponse" + id: + description: The configuration identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + relationships: + $ref: "#/components/schemas/IncidentGoogleChatConfigurationRelationships" + type: + $ref: "#/components/schemas/IncidentGoogleChatConfigurationType" + required: + - id + - type + - attributes + type: object + IncidentGoogleChatConfigurationPatchDataAttributesRequest: + description: Attributes for patching a Google Chat configuration. All fields are optional. + properties: + domain_id: + description: The Google Chat domain ID. + example: my-domain + type: string + space_name_template: + description: The template for the Google Chat space name. + example: "{{incident.title}}" + type: string + space_target_audience_id: + description: The target audience ID for the Google Chat space. + example: "123456789" + type: string + space_time_zone: + description: The time zone for the Google Chat space. + example: America/New_York + type: string + type: object + IncidentGoogleChatConfigurationPatchDataRequest: + description: Google Chat configuration data in a patch request. + properties: + attributes: + $ref: "#/components/schemas/IncidentGoogleChatConfigurationPatchDataAttributesRequest" + id: + description: The configuration identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + type: + $ref: "#/components/schemas/IncidentGoogleChatConfigurationType" + required: + - id + - type + type: object + IncidentGoogleChatConfigurationPatchRequest: + description: Request payload for patching a Google Chat configuration. + properties: + data: + $ref: "#/components/schemas/IncidentGoogleChatConfigurationPatchDataRequest" + required: + - data + type: object + IncidentGoogleChatConfigurationRelationships: + description: Relationships for a Google Chat configuration. + properties: + created_by_user: + $ref: "#/components/schemas/RelationshipToUser" + incident_type: + $ref: "#/components/schemas/RelationshipToIncidentType" + last_modified_by_user: + $ref: "#/components/schemas/RelationshipToUser" + type: object + IncidentGoogleChatConfigurationRelationshipsRequest: + description: Relationships for a Google Chat configuration create request. + properties: + incident_type: + $ref: "#/components/schemas/RelationshipToIncidentType" + required: + - incident_type + type: object + IncidentGoogleChatConfigurationRequest: + description: Request payload for creating a Google Chat configuration. + properties: + data: + $ref: "#/components/schemas/IncidentGoogleChatConfigurationDataRequest" + required: + - data + type: object + IncidentGoogleChatConfigurationResponse: + description: Response with a Google Chat configuration. + properties: + data: + $ref: "#/components/schemas/IncidentGoogleChatConfigurationDataResponse" + included: + description: Included related resources. + items: + $ref: "#/components/schemas/IncidentUserData" + readOnly: true + type: array + required: + - data + type: object + IncidentGoogleChatConfigurationType: + description: Google Chat configuration resource type. + enum: + - google_chat_configurations + example: google_chat_configurations + type: string + x-enum-varnames: + - GOOGLE_CHAT_CONFIGURATIONS + IncidentGoogleMeetConfigurationDataAttributesRequest: + description: Attributes for creating a Google Meet configuration. + properties: + allow_manual_meeting_creation: + description: Whether to allow manual meeting creation. + example: true + type: boolean + auto_summarize: + description: Whether to auto-summarize meetings. + example: false + type: boolean + required: + - allow_manual_meeting_creation + - auto_summarize + type: object + IncidentGoogleMeetConfigurationDataAttributesResponse: + description: Attributes of a Google Meet configuration. + properties: + allow_manual_meeting_creation: + description: Whether manual meeting creation is allowed. + example: true + type: boolean + auto_summarize: + description: Whether meetings are auto-summarized. + example: false + type: boolean + created_at: + description: Timestamp when the configuration was created. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + modified_at: + description: Timestamp when the configuration was last modified. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + required: + - allow_manual_meeting_creation + - auto_summarize + - modified_at + type: object + IncidentGoogleMeetConfigurationDataRequest: + description: Google Meet configuration data in a create request. + properties: + attributes: + $ref: "#/components/schemas/IncidentGoogleMeetConfigurationDataAttributesRequest" + relationships: + $ref: "#/components/schemas/IncidentGoogleMeetConfigurationRelationshipsRequest" + type: + $ref: "#/components/schemas/IncidentGoogleMeetConfigurationType" + required: + - type + - attributes + - relationships + type: object + IncidentGoogleMeetConfigurationDataResponse: + description: Google Meet configuration data in a response. + properties: + attributes: + $ref: "#/components/schemas/IncidentGoogleMeetConfigurationDataAttributesResponse" + id: + description: The configuration identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + relationships: + $ref: "#/components/schemas/IncidentGoogleMeetConfigurationRelationships" + type: + $ref: "#/components/schemas/IncidentGoogleMeetConfigurationType" + required: + - id + - type + - attributes + type: object + IncidentGoogleMeetConfigurationPatchDataAttributesRequest: + description: Attributes for patching a Google Meet configuration. All fields are optional. + properties: + allow_manual_meeting_creation: + description: Whether to allow manual meeting creation. + example: true + type: boolean + auto_summarize: + description: Whether to auto-summarize meetings. + example: false + type: boolean + type: object + IncidentGoogleMeetConfigurationPatchDataRequest: + description: Google Meet configuration data in a patch request. + properties: + attributes: + $ref: "#/components/schemas/IncidentGoogleMeetConfigurationPatchDataAttributesRequest" + id: + description: The configuration identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + type: + $ref: "#/components/schemas/IncidentGoogleMeetConfigurationType" + required: + - id + - type + type: object + IncidentGoogleMeetConfigurationPatchRequest: + description: Request payload for patching a Google Meet configuration. + properties: + data: + $ref: "#/components/schemas/IncidentGoogleMeetConfigurationPatchDataRequest" + required: + - data + type: object + IncidentGoogleMeetConfigurationRelationships: + description: Relationships for a Google Meet configuration. + properties: + created_by_user: + $ref: "#/components/schemas/RelationshipToUser" + incident_type: + $ref: "#/components/schemas/RelationshipToIncidentType" + last_modified_by_user: + $ref: "#/components/schemas/RelationshipToUser" + type: object + IncidentGoogleMeetConfigurationRelationshipsRequest: + description: Relationships for a Google Meet configuration create request. + properties: + incident_type: + $ref: "#/components/schemas/RelationshipToIncidentType" + required: + - incident_type + type: object + IncidentGoogleMeetConfigurationRequest: + description: Request payload for creating a Google Meet configuration. + properties: + data: + $ref: "#/components/schemas/IncidentGoogleMeetConfigurationDataRequest" + required: + - data + type: object + IncidentGoogleMeetConfigurationResponse: + description: Response with a Google Meet configuration. + properties: + data: + $ref: "#/components/schemas/IncidentGoogleMeetConfigurationDataResponse" + included: + description: Included related resources. + items: + $ref: "#/components/schemas/IncidentUserData" + readOnly: true + type: array + required: + - data + type: object + IncidentGoogleMeetConfigurationType: + description: Google Meet configuration resource type. + enum: + - google_meet_configurations + example: google_meet_configurations + type: string + x-enum-varnames: + - GOOGLE_MEET_CONFIGURATIONS IncidentHandleAttributesFields: description: Dynamic fields associated with the handle example: @@ -39015,12 +39770,205 @@ components: required: - data type: object + IncidentImpactFieldChoice: + description: A choice option for a dropdown or multiselect impact field. + properties: + description: + description: The description of the choice. + example: Affects all customers + type: string + display_name: + description: The display name of the choice. + example: Critical + type: string + value: + description: The value of the choice. + example: critical + type: string + required: + - value + - display_name + type: object + IncidentImpactFieldDataAttributesRequest: + description: Attributes for creating an impact field. + properties: + display_name: + description: The display name of the impact field. + example: Customer Impact Scope + type: string + field_choices: + description: The choices for dropdown or multiselect fields. + items: + $ref: "#/components/schemas/IncidentImpactFieldChoice" + type: array + field_type: + $ref: "#/components/schemas/IncidentImpactFieldValueType" + name: + description: The normalized name of the impact field (used as identifier). + example: customer_impact_scope + type: string + tag_key: + description: The tag key associated with the field (for metrictag type). + example: env + nullable: true + type: string + required: + - name + - display_name + - field_type + type: object + IncidentImpactFieldDataAttributesResponse: + description: Attributes of an impact field in a response. + properties: + display_name: + description: The display name of the impact field. + example: Customer Impact Scope + type: string + field_choices: + description: The choices for dropdown or multiselect fields. + items: + $ref: "#/components/schemas/IncidentImpactFieldChoice" + type: array + field_type: + $ref: "#/components/schemas/IncidentImpactFieldValueType" + name: + description: The normalized name of the impact field. + example: customer_impact_scope + type: string + tag_key: + description: The tag key associated with the field. + example: env + nullable: true + type: string + required: + - name + - display_name + - field_type + type: object + IncidentImpactFieldDataRequest: + description: Impact field data in a create request. + properties: + attributes: + $ref: "#/components/schemas/IncidentImpactFieldDataAttributesRequest" + relationships: + $ref: "#/components/schemas/IncidentImpactFieldRelationshipsRequest" + type: + $ref: "#/components/schemas/IncidentImpactFieldType" + required: + - type + - attributes + - relationships + type: object + IncidentImpactFieldDataResponse: + description: Impact field data in a response. + properties: + attributes: + $ref: "#/components/schemas/IncidentImpactFieldDataAttributesResponse" + id: + description: The impact field identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + relationships: + $ref: "#/components/schemas/IncidentImpactFieldRelationships" + type: + $ref: "#/components/schemas/IncidentImpactFieldType" + required: + - id + - type + - attributes + type: object + IncidentImpactFieldRelationships: + description: Relationships for an impact field. + properties: + created_by_user: + $ref: "#/components/schemas/RelationshipToUser" + incident_type: + $ref: "#/components/schemas/RelationshipToIncidentType" + last_modified_by_user: + $ref: "#/components/schemas/RelationshipToUser" + type: object + IncidentImpactFieldRelationshipsRequest: + description: Relationships for an impact field create request. + properties: + incident_type: + $ref: "#/components/schemas/RelationshipToIncidentType" + required: + - incident_type + type: object + IncidentImpactFieldRequest: + description: Request payload for creating an impact field. + properties: + data: + $ref: "#/components/schemas/IncidentImpactFieldDataRequest" + required: + - data + type: object + IncidentImpactFieldResponse: + description: Response with a single impact field. + properties: + data: + $ref: "#/components/schemas/IncidentImpactFieldDataResponse" + included: + description: Included related resources. + items: + $ref: "#/components/schemas/IncidentUserData" + readOnly: true + type: array + required: + - data + type: object + IncidentImpactFieldType: + description: Impact field resource type. + enum: + - impact_fields + example: impact_fields + type: string + x-enum-varnames: + - IMPACT_FIELDS + IncidentImpactFieldValueType: + description: The type of an impact field. + enum: + - dropdown + - text + - textarray + - metrictag + - number + - datetime + - multiselect + example: dropdown + type: string + x-enum-varnames: + - DROPDOWN + - TEXT + - TEXTARRAY + - METRICTAG + - NUMBER + - DATETIME + - MULTISELECT IncidentImpactFieldsObject: additionalProperties: {} description: An object mapping impact field names to field values. example: {"customers_impacted": "all", "products_impacted": ["shopping", "marketing"]} nullable: true type: object + IncidentImpactFieldsResponse: + description: Response with a list of impact fields. + properties: + data: + description: List of impact fields. + items: + $ref: "#/components/schemas/IncidentImpactFieldDataResponse" + type: array + included: + description: Included related resources. + items: + $ref: "#/components/schemas/IncidentUserData" + readOnly: true + type: array + required: + - data + type: object IncidentImpactRelatedObject: description: A reference to a resource related to an incident impact. enum: @@ -40074,6 +41022,226 @@ components: - id - type type: object + IncidentOnCallPageDataAttributesRequest: + description: Attributes for linking a page to an incident. + properties: + key: + description: The key of the on-call page. + example: PAGE-12345 + type: string + page_target: + $ref: "#/components/schemas/IncidentOnCallPageTarget" + team_id: + description: The team ID associated with the page (deprecated, use page_target instead). + example: team-abc-123 + type: string + type: object + IncidentOnCallPageDataRequest: + description: On-call page data in a link request. + properties: + attributes: + $ref: "#/components/schemas/IncidentOnCallPageDataAttributesRequest" + id: + description: The ID of the on-call page to link. + example: PAGE-12345 + type: string + type: + $ref: "#/components/schemas/IncidentOnCallPageType" + required: + - id + - type + type: object + IncidentOnCallPageLinkRequest: + description: Request payload for linking an on-call page to an incident. + properties: + data: + $ref: "#/components/schemas/IncidentOnCallPageDataRequest" + required: + - data + type: object + IncidentOnCallPageTarget: + description: The target of an on-call page. + properties: + identifier: + description: The identifier of the page target. + example: my-oncall-team + type: string + type: + description: The type of the page target. + example: team_handle + type: string + required: + - type + - identifier + type: object + IncidentOnCallPageType: + description: On-call page resource type. + enum: + - page + example: page + type: string + x-enum-varnames: + - PAGE + IncidentOrgSettingsDataAttributesResponse: + description: Attributes of an incident org settings resource in a response. + properties: + created: + description: Timestamp when the settings were created. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + modified: + description: Timestamp when the settings were last modified. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + settings: + $ref: "#/components/schemas/IncidentOrgSettingsMeta" + required: + - created + - modified + - settings + type: object + IncidentOrgSettingsDataResponse: + description: Incident org settings data in a response. + properties: + attributes: + $ref: "#/components/schemas/IncidentOrgSettingsDataAttributesResponse" + id: + description: The org settings identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + relationships: + $ref: "#/components/schemas/IncidentOrgSettingsRelationships" + type: + $ref: "#/components/schemas/IncidentOrgSettingsType" + required: + - id + - type + - attributes + type: object + IncidentOrgSettingsListResponse: + description: Response with a list of incident org settings resources. + properties: + data: + description: List of incident org settings resources. + items: + $ref: "#/components/schemas/IncidentOrgSettingsDataResponse" + type: array + required: + - data + type: object + IncidentOrgSettingsMeta: + additionalProperties: {} + description: The settings configuration for an incident org settings resource. + example: + allow_anonymous_incident_declaration: false + allow_guest_incident_declaration: false + pagerduty_paging: true + private_incidents_by_default: false + type: object + IncidentOrgSettingsRelationships: + description: Relationships for an incident org settings resource. + properties: + incident_type: + $ref: "#/components/schemas/RelationshipToIncidentType" + type: object + IncidentOrgSettingsResponse: + description: Response with a single incident org settings resource. + properties: + data: + $ref: "#/components/schemas/IncidentOrgSettingsDataResponse" + required: + - data + type: object + IncidentOrgSettingsType: + description: Incident org settings resource type. + enum: + - incident_org_settings + example: incident_org_settings + type: string + x-enum-varnames: + - INCIDENT_ORG_SETTINGS + IncidentPageRoleReference: + description: A reference to an incident role for a page. + properties: + id: + description: The role identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + type: + $ref: "#/components/schemas/IncidentPageRoleType" + required: + - type + - id + type: object + IncidentPageRoleType: + description: The type of incident role for a page. + enum: + - incident_user_defined_roles + - incident_reserved_roles + example: incident_user_defined_roles + type: string + x-enum-varnames: + - INCIDENT_USER_DEFINED_ROLES + - INCIDENT_RESERVED_ROLES + IncidentPageTarget: + description: The target recipient for a page. + properties: + identifier: + description: The identifier of the target (handle, UUID, or user UUID). + example: my-team-handle + type: string + type: + $ref: "#/components/schemas/IncidentPageTargetType" + required: + - type + - identifier + type: object + IncidentPageTargetType: + description: The type of target for a page request. + enum: + - team_handle + - team_uuid + - user_uuid + example: team_uuid + type: string + x-enum-varnames: + - TEAM_HANDLE + - TEAM_UUID + - USER_UUID + IncidentPageUUIDDataResponse: + description: Page UUID data in a response. + properties: + id: + description: The UUID of the created page. + example: 00000000-0000-0000-0000-000000000001 + format: uuid + type: string + type: + $ref: "#/components/schemas/IncidentPageUUIDType" + required: + - id + - type + type: object + IncidentPageUUIDResponse: + description: Response with a page UUID. + properties: + data: + $ref: "#/components/schemas/IncidentPageUUIDDataResponse" + required: + - data + type: object + IncidentPageUUIDType: + description: Resource type for a page UUID response. + enum: + - page_uuid + example: page_uuid + type: string + x-enum-varnames: + - PAGE_UUID IncidentPostmortemType: default: incident_postmortems description: Incident postmortem resource type. @@ -40113,6 +41281,195 @@ components: type: string x-enum-varnames: - INCIDENTS + IncidentResponderDataAttributesResponse: + description: Attributes of an incident responder in a response. + properties: + created: + description: Timestamp when the responder was created. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + external_id: + description: The external ID of the responder. + example: + nullable: true + type: string + external_source: + description: The external source of the responder. + example: + nullable: true + type: string + is_billable: + description: Whether this responder counts toward billing. + example: true + type: boolean + last_active: + description: Timestamp when the responder was last active. + example: "2024-01-01T00:00:00.000Z" + format: date-time + nullable: true + type: string + meta: + additionalProperties: {} + description: Additional metadata for the responder. + nullable: true + type: object + modified: + description: Timestamp when the responder was last modified. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + required: + - created + - modified + - is_billable + type: object + IncidentResponderDataRequest: + description: Incident responder data in a create request. + properties: + relationships: + $ref: "#/components/schemas/IncidentResponderRelationshipsRequest" + type: + $ref: "#/components/schemas/IncidentResponderType" + required: + - type + - relationships + type: object + IncidentResponderDataResponse: + description: Incident responder data in a response. + properties: + attributes: + $ref: "#/components/schemas/IncidentResponderDataAttributesResponse" + id: + description: The responder identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + relationships: + $ref: "#/components/schemas/IncidentResponderRelationships" + type: + $ref: "#/components/schemas/IncidentResponderType" + required: + - id + - type + - attributes + type: object + IncidentResponderRelationships: + description: Relationships for an incident responder. + properties: + created_by: + $ref: "#/components/schemas/RelationshipToUser" + last_modified_by: + $ref: "#/components/schemas/RelationshipToUser" + role_assignments: + $ref: "#/components/schemas/IncidentResponderRoleAssignmentsRelationship" + user: + $ref: "#/components/schemas/NullableRelationshipToUser" + type: object + IncidentResponderRelationshipsRequest: + description: Relationships for creating an incident responder. + properties: + user: + $ref: "#/components/schemas/IncidentResponderUserRelationship" + required: + - user + type: object + IncidentResponderRequest: + description: Request payload for creating an incident responder. + properties: + data: + $ref: "#/components/schemas/IncidentResponderDataRequest" + required: + - data + type: object + IncidentResponderResponse: + description: Response with a single incident responder. + properties: + data: + $ref: "#/components/schemas/IncidentResponderDataResponse" + included: + description: Included related resources. + items: + $ref: "#/components/schemas/IncidentUserData" + readOnly: true + type: array + required: + - data + type: object + IncidentResponderRoleAssignmentRelationshipData: + description: A single role assignment relationship data object. + properties: + id: + description: The role assignment identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + type: + description: The role assignment resource type. + example: incident_role_assignments + type: string + required: + - id + - type + type: object + IncidentResponderRoleAssignmentsRelationship: + description: Relationship to role assignments for a responder. + properties: + data: + description: List of role assignment relationship data. + items: + $ref: "#/components/schemas/IncidentResponderRoleAssignmentRelationshipData" + type: array + type: object + IncidentResponderType: + description: Incident responder resource type. + enum: + - incident_responders + example: incident_responders + type: string + x-enum-varnames: + - INCIDENT_RESPONDERS + IncidentResponderUserRelationship: + description: Relationship to a user for a responder create request. + properties: + data: + $ref: "#/components/schemas/IncidentResponderUserRelationshipData" + required: + - data + type: object + IncidentResponderUserRelationshipData: + description: A user relationship data object for creating a responder. + properties: + id: + description: The user identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + type: + description: The user resource type. + example: users + type: string + required: + - id + - type + type: object + IncidentRespondersResponse: + description: Response with a list of incident responders. + properties: + data: + description: List of incident responders. + items: + $ref: "#/components/schemas/IncidentResponderDataResponse" + type: array + included: + description: Included related resources. + items: + $ref: "#/components/schemas/IncidentUserData" + readOnly: true + type: array + required: + - data + type: object IncidentRespondersType: description: The incident responders type. enum: @@ -40348,6 +41705,332 @@ components: user_defined_fields: $ref: "#/components/schemas/RelationshipToIncidentUserDefinedFields" type: object + IncidentRuleCondition: + description: A condition for an incident rule. + properties: + field: + description: The field to match on. + example: severity + type: string + values: + description: The values to match. + example: + - SEV-1 + - SEV-2 + items: + type: string + type: array + required: + - field + - values + type: object + IncidentRuleDataAttributesRequest: + description: Attributes for creating an incident rule. + properties: + condition: + $ref: "#/components/schemas/IncidentRuleQueryCondition" + condition_table_type: + description: "The condition table type. 1 = raw query." + example: 1 + type: integer + conditions: + description: List of field-based conditions. + items: + $ref: "#/components/schemas/IncidentRuleCondition" + type: array + enabled: + description: Whether the rule is enabled. + example: true + type: boolean + execution_type: + $ref: "#/components/schemas/IncidentRuleExecutionType" + incident_type_uuid: + description: The UUID of the incident type this rule applies to. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + nullable: true + type: string + match_any_condition: + description: Whether any condition (OR logic) should match instead of all (AND logic). + example: false + type: boolean + task_id: + $ref: "#/components/schemas/IncidentRuleTaskIDType" + task_payload: + description: The JSON-encoded payload for the task. + example: "{}" + type: string + trigger: + $ref: "#/components/schemas/IncidentRuleTriggerType" + required: + - execution_type + - condition_table_type + - condition + - task_id + - task_payload + - enabled + type: object + IncidentRuleDataAttributesResponse: + description: Attributes of an incident rule in a response. + properties: + condition: + $ref: "#/components/schemas/IncidentRuleQueryCondition" + condition_table_type: + description: The condition table type. + example: 1 + type: integer + conditions: + description: List of field-based conditions. + items: + $ref: "#/components/schemas/IncidentRuleCondition" + type: array + created: + description: Timestamp when the rule was created. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + created_by_uuid: + description: UUID of the user who created the rule. + example: 00000000-0000-0000-0000-000000000001 + format: uuid + type: string + deleted: + description: Timestamp when the rule was deleted. + example: + format: date-time + nullable: true + type: string + enabled: + description: Whether the rule is enabled. + example: true + type: boolean + execution_type: + description: The execution type of the rule. + example: 1 + type: integer + incident_settings_association_uuid: + description: The incident settings association UUID. + example: + format: uuid + nullable: true + type: string + match_any_condition: + description: Whether any condition should match. + example: false + type: boolean + modified: + description: Timestamp when the rule was last modified. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + modified_by_uuid: + description: UUID of the user who last modified the rule. + example: 00000000-0000-0000-0000-000000000001 + format: uuid + type: string + org_id: + description: The organization ID. + example: 123456 + format: int64 + type: integer + task_id: + description: The task ID. + example: notify-incident-handles-job + nullable: true + type: string + task_payload: + description: The JSON-encoded task payload. + example: "{}" + nullable: true + type: string + trigger: + description: The trigger event for the rule. + example: incident_created_trigger + type: string + type: object + IncidentRuleDataRequest: + description: Incident rule data in a create request. + properties: + attributes: + $ref: "#/components/schemas/IncidentRuleDataAttributesRequest" + type: + $ref: "#/components/schemas/IncidentRuleType" + required: + - type + - attributes + type: object + IncidentRuleDataResponse: + description: Incident rule data in a response. + properties: + attributes: + $ref: "#/components/schemas/IncidentRuleDataAttributesResponse" + id: + description: The rule identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + type: + $ref: "#/components/schemas/IncidentRuleResponseType" + required: + - id + - type + - attributes + type: object + IncidentRuleExecutionType: + description: The execution type of an incident rule. + enum: + - 1 + - 2 + example: 1 + format: int64 + type: integer + x-enum-varnames: + - SINGLE_EXECUTION + - MULTI_EXECUTION + IncidentRulePatchDataAttributesRequest: + description: Attributes for patching an incident rule. All fields are optional. + properties: + condition: + $ref: "#/components/schemas/IncidentRuleQueryCondition" + conditions: + description: List of field-based conditions. + items: + $ref: "#/components/schemas/IncidentRuleCondition" + type: array + enabled: + description: Whether the rule is enabled. + example: true + type: boolean + task_payload: + description: The JSON-encoded payload for the task. + example: "{}" + type: string + trigger: + $ref: "#/components/schemas/IncidentRuleTriggerType" + type: object + IncidentRulePatchDataRequest: + description: Incident rule data in a patch request. + properties: + attributes: + $ref: "#/components/schemas/IncidentRulePatchDataAttributesRequest" + id: + description: The rule identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + type: + $ref: "#/components/schemas/IncidentRuleType" + required: + - id + - type + type: object + IncidentRulePatchRequest: + description: Request payload for patching an incident rule. + properties: + data: + $ref: "#/components/schemas/IncidentRulePatchDataRequest" + required: + - data + type: object + IncidentRuleQueryCondition: + description: A query-based condition for an incident rule. + properties: + normalized_query: + description: The normalized query string. + example: "severity:SEV-1" + nullable: true + type: string + raw_query: + description: The raw query string. + example: "severity:SEV-1" + nullable: true + type: string + type: object + IncidentRuleRequest: + description: Request payload for creating an incident rule. + properties: + data: + $ref: "#/components/schemas/IncidentRuleDataRequest" + required: + - data + type: object + IncidentRuleResponse: + description: Response with a single incident rule. + properties: + data: + $ref: "#/components/schemas/IncidentRuleDataResponse" + required: + - data + type: object + IncidentRuleResponseType: + description: Incident rule response resource type. + enum: + - incidents_rules + example: incidents_rules + type: string + x-enum-varnames: + - INCIDENTS_RULES + IncidentRuleTaskIDType: + description: The task ID for an incident rule. + enum: + - jira-create-issue-job + - notify-incident-handles-job + - servicenow-create-incident-job + - slack-create-channel-job + - zoom-create-meeting-job + - google-meet-create-meeting-job + - workflow-automation-job + - ms-teams-create-meeting-job + - google-chat-create-space-job + - zoom-suppress-summarization-job + - ms-teams-suppress-summarization-job + - google-meet-suppress-summarization-job + example: notify-incident-handles-job + type: string + x-enum-varnames: + - JIRA_CREATE_ISSUE_JOB + - NOTIFY_INCIDENT_HANDLES_JOB + - SERVICENOW_CREATE_INCIDENT_JOB + - SLACK_CREATE_CHANNEL_JOB + - ZOOM_CREATE_MEETING_JOB + - GOOGLE_MEET_CREATE_MEETING_JOB + - WORKFLOW_AUTOMATION_JOB + - MS_TEAMS_CREATE_MEETING_JOB + - GOOGLE_CHAT_CREATE_SPACE_JOB + - ZOOM_SUPPRESS_SUMMARIZATION_JOB + - MS_TEAMS_SUPPRESS_SUMMARIZATION_JOB + - GOOGLE_MEET_SUPPRESS_SUMMARIZATION_JOB + IncidentRuleTriggerType: + description: The trigger event for an incident rule. + enum: + - incident_saved_trigger + - incident_created_trigger + - incident_modified_trigger + example: incident_created_trigger + type: string + x-enum-varnames: + - INCIDENT_SAVED_TRIGGER + - INCIDENT_CREATED_TRIGGER + - INCIDENT_MODIFIED_TRIGGER + IncidentRuleType: + description: Incident rule resource type. + enum: + - incident_rules + example: incident_rules + type: string + x-enum-varnames: + - INCIDENT_RULES + IncidentRulesResponse: + description: Response with a list of incident rules. + properties: + data: + description: List of incident rules. + items: + $ref: "#/components/schemas/IncidentRuleDataResponse" + type: array + required: + - data + type: object IncidentSearchResponse: description: Response with incidents and facets. properties: @@ -40604,6 +42287,57 @@ components: description: An object related to an incident service which is present in the included payload. oneOf: - $ref: "#/components/schemas/User" + IncidentServiceNowRecordDataAttributesRequest: + description: Attributes for creating a ServiceNow record for an incident. + properties: + assignment_group: + description: The ServiceNow assignment group. + example: IT Support + type: string + configuration_item_mapping: + description: The ServiceNow configuration item mapping. + example: my-service + type: string + instance_name: + description: The ServiceNow instance name. + example: my-instance + type: string + record_id: + description: An existing ServiceNow record ID (Sys ID) to link instead of creating a new record. + example: abc123def456 + type: string + required: + - instance_name + - assignment_group + - configuration_item_mapping + type: object + IncidentServiceNowRecordDataRequest: + description: ServiceNow record data in a create request. + properties: + attributes: + $ref: "#/components/schemas/IncidentServiceNowRecordDataAttributesRequest" + type: + $ref: "#/components/schemas/IncidentServiceNowRecordPromptType" + required: + - type + - attributes + type: object + IncidentServiceNowRecordPromptType: + description: ServiceNow record prompt resource type. + enum: + - incident_servicenow_record_prompt + example: incident_servicenow_record_prompt + type: string + x-enum-varnames: + - INCIDENT_SERVICENOW_RECORD_PROMPT + IncidentServiceNowRecordRequest: + description: Request payload for creating a ServiceNow record for an incident. + properties: + data: + $ref: "#/components/schemas/IncidentServiceNowRecordDataRequest" + required: + - data + type: object IncidentServiceRelationships: description: The incident service's relationships. properties: @@ -40783,6 +42517,191 @@ components: nullable: false type: string type: object + IncidentTimestampOverrideDataAttributesRequest: + description: Attributes for creating a timestamp override. + properties: + timestamp_type: + $ref: "#/components/schemas/IncidentTimestampType" + timestamp_value: + description: The overridden timestamp value. + example: "2024-01-01T10:00:00.000Z" + format: date-time + type: string + required: + - timestamp_type + - timestamp_value + type: object + IncidentTimestampOverrideDataAttributesResponse: + description: Attributes of a timestamp override in a response. + properties: + created_at: + description: Timestamp when the override was created. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + deleted_at: + description: Timestamp when the override was deleted. + example: + format: date-time + nullable: true + type: string + incident_id: + description: The incident identifier. + example: 00000000-0000-0000-0000-000000000000 + type: string + modified_at: + description: Timestamp when the override was last modified. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + timestamp_type: + $ref: "#/components/schemas/IncidentTimestampType" + timestamp_value: + description: The overridden timestamp value. + example: "2024-01-01T10:00:00.000Z" + format: date-time + type: string + required: + - incident_id + - timestamp_type + - timestamp_value + - created_at + - modified_at + type: object + IncidentTimestampOverrideDataRequest: + description: Timestamp override data in a create request. + properties: + attributes: + $ref: "#/components/schemas/IncidentTimestampOverrideDataAttributesRequest" + type: + $ref: "#/components/schemas/IncidentTimestampOverrideType" + required: + - type + - attributes + type: object + IncidentTimestampOverrideDataResponse: + description: Timestamp override data in a response. + properties: + attributes: + $ref: "#/components/schemas/IncidentTimestampOverrideDataAttributesResponse" + id: + description: The timestamp override identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + relationships: + $ref: "#/components/schemas/IncidentTimestampOverrideRelationships" + type: + $ref: "#/components/schemas/IncidentTimestampOverrideType" + required: + - id + - type + - attributes + type: object + IncidentTimestampOverridePatchDataAttributesRequest: + description: Attributes for patching a timestamp override. All fields are optional. + properties: + timestamp_type: + $ref: "#/components/schemas/IncidentTimestampType" + timestamp_value: + description: The overridden timestamp value. + example: "2024-01-01T10:00:00.000Z" + format: date-time + type: string + type: object + IncidentTimestampOverridePatchDataRequest: + description: Timestamp override data in a patch request. + properties: + attributes: + $ref: "#/components/schemas/IncidentTimestampOverridePatchDataAttributesRequest" + id: + description: The timestamp override identifier. + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + type: + $ref: "#/components/schemas/IncidentTimestampOverrideType" + required: + - id + - type + type: object + IncidentTimestampOverridePatchRequest: + description: Request payload for patching a timestamp override. + properties: + data: + $ref: "#/components/schemas/IncidentTimestampOverridePatchDataRequest" + required: + - data + type: object + IncidentTimestampOverrideRelationships: + description: Relationships for a timestamp override. + properties: + created_by_user: + $ref: "#/components/schemas/RelationshipToUser" + last_modified_by_user: + $ref: "#/components/schemas/RelationshipToUser" + type: object + IncidentTimestampOverrideRequest: + description: Request payload for creating a timestamp override. + properties: + data: + $ref: "#/components/schemas/IncidentTimestampOverrideDataRequest" + required: + - data + type: object + IncidentTimestampOverrideResponse: + description: Response with a single timestamp override. + properties: + data: + $ref: "#/components/schemas/IncidentTimestampOverrideDataResponse" + included: + description: Included related resources. + items: + $ref: "#/components/schemas/IncidentUserData" + readOnly: true + type: array + required: + - data + type: object + IncidentTimestampOverrideType: + description: Incident timestamp override resource type. + enum: + - incidents_timestamp_overrides + example: incidents_timestamp_overrides + type: string + x-enum-varnames: + - INCIDENTS_TIMESTAMP_OVERRIDES + IncidentTimestampOverridesResponse: + description: Response with a list of timestamp overrides. + properties: + data: + description: List of timestamp overrides. + items: + $ref: "#/components/schemas/IncidentTimestampOverrideDataResponse" + type: array + included: + description: Included related resources. + items: + $ref: "#/components/schemas/IncidentUserData" + readOnly: true + type: array + required: + - data + type: object + IncidentTimestampType: + description: The type of timestamp to override. + enum: + - created + - detected + - resolved + - declared + example: detected + type: string + x-enum-varnames: + - CREATED + - DETECTED + - RESOLVED + - DECLARED IncidentTodoAnonymousAssignee: description: Anonymous assignee entity. properties: @@ -41731,6 +43650,229 @@ components: - display_name - value type: object + IncidentUserDefinedRoleDataAttributesRequest: + description: Attributes for creating an incident user-defined role. + properties: + description: + description: A description of the user-defined role. + example: "The technical lead for the incident." + nullable: true + type: string + name: + description: The name of the user-defined role. + example: "Tech Lead" + type: string + policy: + $ref: "#/components/schemas/IncidentUserDefinedRolePolicy" + required: + - name + - policy + type: object + IncidentUserDefinedRoleDataAttributesResponse: + description: Attributes of an incident user-defined role. + properties: + created: + description: Timestamp when the role was created. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + description: + description: A description of the user-defined role. + example: "The technical lead for the incident." + nullable: true + type: string + modified: + description: Timestamp when the role was last modified. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + name: + description: The name of the user-defined role. + example: "Tech Lead" + type: string + policy: + $ref: "#/components/schemas/IncidentUserDefinedRolePolicy" + required: + - name + - policy + - created + - modified + type: object + IncidentUserDefinedRoleDataRequest: + description: Data for creating an incident user-defined role. + properties: + attributes: + $ref: "#/components/schemas/IncidentUserDefinedRoleDataAttributesRequest" + relationships: + $ref: "#/components/schemas/IncidentUserDefinedRoleRelationshipsRequest" + type: + $ref: "#/components/schemas/IncidentUserDefinedRoleType" + required: + - type + - attributes + - relationships + type: object + IncidentUserDefinedRoleDataResponse: + description: Data for an incident user-defined role response. + properties: + attributes: + $ref: "#/components/schemas/IncidentUserDefinedRoleDataAttributesResponse" + id: + description: The ID of the user-defined role. + example: "00000000-0000-0000-0000-000000000002" + format: uuid + type: string + relationships: + $ref: "#/components/schemas/IncidentUserDefinedRoleRelationshipsResponse" + type: + $ref: "#/components/schemas/IncidentUserDefinedRoleType" + required: + - id + - type + - attributes + type: object + IncidentUserDefinedRoleIncidentTypeRelationship: + description: Relationship to an incident type for a user-defined role. + properties: + data: + $ref: "#/components/schemas/IncidentUserDefinedRoleIncidentTypeRelationshipData" + required: + - data + type: object + IncidentUserDefinedRoleIncidentTypeRelationshipData: + description: Data for the incident type relationship of a user-defined role. + properties: + id: + description: The ID of the incident type. + example: "00000000-0000-0000-0000-000000000001" + format: uuid + type: string + type: + description: The type of the resource. + example: "incident_types" + type: string + required: + - id + - type + type: object + IncidentUserDefinedRoleIncludedItem: + description: A single included resource in a user-defined role response. + oneOf: + - $ref: "#/components/schemas/IncidentUserData" + - $ref: "#/components/schemas/IncidentTypeObject" + IncidentUserDefinedRoleIncludedResponse: + description: Included resources for an incident user-defined role response. + items: + $ref: "#/components/schemas/IncidentUserDefinedRoleIncludedItem" + type: array + IncidentUserDefinedRolePatchDataAttributesRequest: + description: Attributes for updating an incident user-defined role. + properties: + description: + description: A description of the user-defined role. + example: "The technical lead for the incident." + nullable: true + type: string + name: + description: The name of the user-defined role. + example: "Tech Lead" + type: string + policy: + $ref: "#/components/schemas/IncidentUserDefinedRolePolicy" + type: object + IncidentUserDefinedRolePatchDataRequest: + description: Data for updating an incident user-defined role. + properties: + attributes: + $ref: "#/components/schemas/IncidentUserDefinedRolePatchDataAttributesRequest" + id: + description: The ID of the user-defined role to update. + example: "00000000-0000-0000-0000-000000000002" + format: uuid + type: string + type: + $ref: "#/components/schemas/IncidentUserDefinedRoleType" + required: + - id + - type + type: object + IncidentUserDefinedRolePatchRequest: + description: Request for updating an incident user-defined role. + properties: + data: + $ref: "#/components/schemas/IncidentUserDefinedRolePatchDataRequest" + required: + - data + type: object + IncidentUserDefinedRolePolicy: + description: Policy configuration for a user-defined role. + properties: + is_single: + description: Whether this role can only be assigned to one responder at a time. + example: true + type: boolean + required: + - is_single + type: object + IncidentUserDefinedRoleRelationshipsRequest: + description: Relationships for creating a user-defined role. + properties: + incident_type: + $ref: "#/components/schemas/IncidentUserDefinedRoleIncidentTypeRelationship" + required: + - incident_type + type: object + IncidentUserDefinedRoleRelationshipsResponse: + description: Relationships of a user-defined role response. + properties: + created_by_user: + $ref: "#/components/schemas/RelationshipToUser" + incident_type: + $ref: "#/components/schemas/IncidentUserDefinedRoleIncidentTypeRelationship" + last_modified_by_user: + $ref: "#/components/schemas/RelationshipToUser" + type: object + IncidentUserDefinedRoleRequest: + description: Request for creating an incident user-defined role. + properties: + data: + $ref: "#/components/schemas/IncidentUserDefinedRoleDataRequest" + required: + - data + type: object + IncidentUserDefinedRoleResponse: + description: Response with a single incident user-defined role. + properties: + data: + $ref: "#/components/schemas/IncidentUserDefinedRoleDataResponse" + included: + $ref: "#/components/schemas/IncidentUserDefinedRoleIncludedResponse" + required: + - data + type: object + IncidentUserDefinedRoleType: + description: Incident user-defined role resource type. + enum: + - incident_user_defined_roles + example: incident_user_defined_roles + type: string + x-enum-varnames: + - INCIDENT_USER_DEFINED_ROLES + IncidentUserDefinedRolesDataResponse: + description: List of incident user-defined role data objects. + items: + $ref: "#/components/schemas/IncidentUserDefinedRoleDataResponse" + type: array + IncidentUserDefinedRolesResponse: + description: Response with a list of incident user-defined roles. + properties: + data: + $ref: "#/components/schemas/IncidentUserDefinedRolesDataResponse" + included: + $ref: "#/components/schemas/IncidentUserDefinedRoleIncludedResponse" + required: + - data + type: object IncidentsResponse: description: Response with a list of incidents. properties: @@ -120478,6 +122620,491 @@ paths: x-unstable: |- **Note**: This endpoint is in public beta and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/config/google-chat-configurations: + post: + description: Create a Google Chat configuration for incidents. + operationId: CreateIncidentGoogleChatConfiguration + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + domain_id: my-domain + space_name_template: "{{incident.title}}" + space_target_audience_id: "123456789" + space_time_zone: America/New_York + relationships: + incident_type: + data: + id: 00000000-0000-0000-0000-000000000000 + type: incident_types + type: google_chat_configurations + schema: + $ref: "#/components/schemas/IncidentGoogleChatConfigurationRequest" + description: Google Chat configuration payload. + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00.000Z" + domain_id: my-domain + modified_at: "2024-01-01T00:00:00.000Z" + space_name_template: "{{incident.title}}" + space_target_audience_id: "123456789" + space_time_zone: America/New_York + id: 00000000-0000-0000-0000-000000000001 + type: google_chat_configurations + schema: + $ref: "#/components/schemas/IncidentGoogleChatConfigurationResponse" + description: Created + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Create an incident Google Chat configuration + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_settings_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/config/google-chat-configurations/{id}: + patch: + description: Update a Google Chat configuration for incidents. + operationId: UpdateIncidentGoogleChatConfiguration + parameters: + - $ref: "#/components/parameters/IncidentGoogleChatConfigurationIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + domain_id: updated-domain + id: 00000000-0000-0000-0000-000000000001 + type: google_chat_configurations + schema: + $ref: "#/components/schemas/IncidentGoogleChatConfigurationPatchRequest" + description: Google Chat configuration patch payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00.000Z" + domain_id: updated-domain + modified_at: "2024-01-02T00:00:00.000Z" + space_name_template: "{{incident.title}}" + space_target_audience_id: "123456789" + space_time_zone: America/New_York + id: 00000000-0000-0000-0000-000000000001 + type: google_chat_configurations + schema: + $ref: "#/components/schemas/IncidentGoogleChatConfigurationResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Update an incident Google Chat configuration + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_settings_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/config/google-meet-configurations: + post: + description: Create a Google Meet configuration for incidents. + operationId: CreateIncidentGoogleMeetConfiguration + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + allow_manual_meeting_creation: true + auto_summarize: false + relationships: + incident_type: + data: + id: 00000000-0000-0000-0000-000000000000 + type: incident_types + type: google_meet_configurations + schema: + $ref: "#/components/schemas/IncidentGoogleMeetConfigurationRequest" + description: Google Meet configuration payload. + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + allow_manual_meeting_creation: true + auto_summarize: false + created_at: "2024-01-01T00:00:00.000Z" + modified_at: "2024-01-01T00:00:00.000Z" + id: 00000000-0000-0000-0000-000000000001 + type: google_meet_configurations + schema: + $ref: "#/components/schemas/IncidentGoogleMeetConfigurationResponse" + description: Created + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Create an incident Google Meet configuration + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_settings_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/config/google-meet-configurations/{id}: + patch: + description: Update a Google Meet configuration for incidents. + operationId: UpdateIncidentGoogleMeetConfiguration + parameters: + - $ref: "#/components/parameters/IncidentGoogleMeetConfigurationIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + auto_summarize: true + id: 00000000-0000-0000-0000-000000000001 + type: google_meet_configurations + schema: + $ref: "#/components/schemas/IncidentGoogleMeetConfigurationPatchRequest" + description: Google Meet configuration patch payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + allow_manual_meeting_creation: true + auto_summarize: true + created_at: "2024-01-01T00:00:00.000Z" + modified_at: "2024-01-02T00:00:00.000Z" + id: 00000000-0000-0000-0000-000000000001 + type: google_meet_configurations + schema: + $ref: "#/components/schemas/IncidentGoogleMeetConfigurationResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Update an incident Google Meet configuration + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_settings_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/config/impact-fields: + get: + description: List all impact fields for incidents. + operationId: ListIncidentImpactFields + responses: + "200": + content: + application/json: + examples: + default: + value: + data: [] + schema: + $ref: "#/components/schemas/IncidentImpactFieldsResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_read + summary: List incident impact fields + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_settings_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Create an impact field for incidents. + operationId: CreateIncidentImpactField + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + display_name: Customer Impact Scope + field_choices: + - description: Affects all customers + display_name: All Customers + value: all_customers + - description: Affects some customers + display_name: Some Customers + value: some_customers + field_type: dropdown + name: customer_impact_scope + relationships: + incident_type: + data: + id: 00000000-0000-0000-0000-000000000000 + type: incident_types + type: impact_fields + schema: + $ref: "#/components/schemas/IncidentImpactFieldRequest" + description: Impact field payload. + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + display_name: Customer Impact Scope + field_choices: + - description: Affects all customers + display_name: All Customers + value: all_customers + field_type: dropdown + name: customer_impact_scope + id: 00000000-0000-0000-0000-000000000001 + type: impact_fields + schema: + $ref: "#/components/schemas/IncidentImpactFieldResponse" + description: Created + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Create an incident impact field + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_settings_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/config/impact-fields/{field_id}: + delete: + description: Delete an impact field for incidents. + operationId: DeleteIncidentImpactField + parameters: + - $ref: "#/components/parameters/IncidentImpactFieldIDPathParameter" + responses: + "204": + description: No Content + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Delete an incident impact field + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_settings_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + put: + description: Update an impact field for incidents. + operationId: UpdateIncidentImpactField + parameters: + - $ref: "#/components/parameters/IncidentImpactFieldIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + display_name: Customer Impact Scope Updated + field_type: dropdown + name: customer_impact_scope + relationships: + incident_type: + data: + id: 00000000-0000-0000-0000-000000000000 + type: incident_types + type: impact_fields + schema: + $ref: "#/components/schemas/IncidentImpactFieldRequest" + description: Impact field update payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + display_name: Customer Impact Scope Updated + field_type: dropdown + name: customer_impact_scope + id: 00000000-0000-0000-0000-000000000001 + type: impact_fields + schema: + $ref: "#/components/schemas/IncidentImpactFieldResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Update an incident impact field + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_settings_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/incidents/config/notification-rules: get: description: Lists all notification rules for the organization. Optionally filter by incident type. @@ -121321,6 +123948,302 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/config/rules: + get: + description: List all incident rules. + operationId: ListIncidentRules + parameters: + - description: Filter rules by task ID. + in: query + name: "filter[task_id]" + required: false + schema: + example: notify-incident-handles-job + type: string + - description: Filter rules by trigger. + in: query + name: "filter[trigger]" + required: false + schema: + example: incident_created_trigger + type: string + - description: Filter rules by incident type UUID. + in: query + name: incidentTypeUUID + required: false + schema: + example: 00000000-0000-0000-0000-000000000000 + format: uuid + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: [] + schema: + $ref: "#/components/schemas/IncidentRulesResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_read + summary: List incident rules + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_settings_read + - incident_notification_settings_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Create an incident rule. + operationId: CreateIncidentRule + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + condition: + raw_query: "severity:SEV-1" + condition_table_type: 1 + enabled: true + execution_type: 1 + task_id: notify-incident-handles-job + task_payload: "{}" + trigger: incident_created_trigger + type: incident_rules + schema: + $ref: "#/components/schemas/IncidentRuleRequest" + description: Incident rule payload. + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + condition: + raw_query: "severity:SEV-1" + condition_table_type: 1 + created: "2024-01-01T00:00:00.000Z" + enabled: true + execution_type: 1 + modified: "2024-01-01T00:00:00.000Z" + task_id: notify-incident-handles-job + task_payload: "{}" + trigger: incident_created_trigger + id: 00000000-0000-0000-0000-000000000001 + type: incidents_rules + schema: + $ref: "#/components/schemas/IncidentRuleResponse" + description: Created + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Create an incident rule + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_settings_write + - incident_notification_settings_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/config/rules/{rule_id}: + delete: + description: Delete an incident rule. + operationId: DeleteIncidentRule + parameters: + - $ref: "#/components/parameters/IncidentRuleIDPathParameter" + responses: + "204": + description: No Content + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Delete an incident rule + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_settings_write + - incident_notification_settings_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Get a single incident rule by ID. + operationId: GetIncidentRule + parameters: + - $ref: "#/components/parameters/IncidentRuleIDPathParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + condition: + raw_query: "severity:SEV-1" + condition_table_type: 1 + created: "2024-01-01T00:00:00.000Z" + enabled: true + execution_type: 1 + modified: "2024-01-01T00:00:00.000Z" + task_id: notify-incident-handles-job + task_payload: "{}" + trigger: incident_created_trigger + id: 00000000-0000-0000-0000-000000000001 + type: incidents_rules + schema: + $ref: "#/components/schemas/IncidentRuleResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_read + summary: Get an incident rule + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_settings_read + - incident_notification_settings_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + patch: + description: Update an incident rule. + operationId: UpdateIncidentRule + parameters: + - $ref: "#/components/parameters/IncidentRuleIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + enabled: false + id: 00000000-0000-0000-0000-000000000001 + type: incident_rules + schema: + $ref: "#/components/schemas/IncidentRulePatchRequest" + description: Incident rule patch payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + condition: + raw_query: "severity:SEV-1" + condition_table_type: 1 + created: "2024-01-01T00:00:00.000Z" + enabled: false + execution_type: 1 + modified: "2024-01-02T00:00:00.000Z" + task_id: notify-incident-handles-job + task_payload: "{}" + trigger: incident_created_trigger + id: 00000000-0000-0000-0000-000000000001 + type: incidents_rules + schema: + $ref: "#/components/schemas/IncidentRuleResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Update an incident rule + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_settings_write + - incident_notification_settings_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/incidents/config/types: get: description: Get all incident types. @@ -121433,6 +124356,74 @@ paths: x-unstable: |- **Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/config/types/org-settings: + get: + description: List org settings for all incident types. + operationId: ListOrgSettings + parameters: + - description: Maximum number of results to return. + in: query + name: "page[size]" + required: false + schema: + example: 10 + type: integer + - description: The offset for pagination. + in: query + name: "page[offset]" + required: false + schema: + example: 0 + type: integer + - description: Whether to include deleted records. + in: query + name: include-deleted + required: false + schema: + example: false + type: boolean + - description: Comma-separated list of related resources to include in the response. + in: query + name: include + required: false + schema: + example: incident_type + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: [] + schema: + $ref: "#/components/schemas/IncidentOrgSettingsListResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_read + summary: List incident type org settings + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_settings_read + - incident_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/incidents/config/types/{incident_type_id}: delete: description: Delete an incident type. @@ -121583,6 +124574,66 @@ paths: x-unstable: |- **Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/config/types/{incident_type_id}/org-settings: + get: + description: Get the org settings for a specific incident type. + operationId: GetOrgSettingsByIncidentType + parameters: + - $ref: "#/components/parameters/IncidentOrgSettingsTypeIDPathParameter" + - description: Comma-separated list of related resources to include in the response. + in: query + name: include + required: false + schema: + example: incident_type + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created: "2024-01-01T00:00:00.000Z" + modified: "2024-01-01T00:00:00.000Z" + settings: + allow_anonymous_incident_declaration: false + allow_guest_incident_declaration: false + pagerduty_paging: true + private_incidents_by_default: false + id: 00000000-0000-0000-0000-000000000001 + type: incident_org_settings + schema: + $ref: "#/components/schemas/IncidentOrgSettingsResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_read + summary: Get org settings by incident type + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_settings_read + - incident_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/incidents/config/user-defined-fields: get: description: Get a list of all incident user-defined fields. @@ -122060,6 +125111,303 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/config/user-defined-roles: + get: + description: List all user-defined roles for incidents. + operationId: ListIncidentUserDefinedRoles + parameters: + - description: Filter roles by incident type UUID. + in: query + name: filter[incident-type] + required: false + schema: + example: "00000000-0000-0000-0000-000000000001" + format: uuid + type: string + - description: Comma-separated list of related resources to include in the response. + in: query + name: include + required: false + schema: + example: "created_by_user,last_modified_by_user,incident_type" + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + created: "2024-01-01T00:00:00.000Z" + description: "The technical lead for the incident." + modified: "2024-01-01T00:00:00.000Z" + name: "Tech Lead" + policy: + is_single: true + id: "00000000-0000-0000-0000-000000000002" + type: incident_user_defined_roles + schema: + $ref: "#/components/schemas/IncidentUserDefinedRolesResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_read + summary: List incident user-defined roles + tags: + - Incidents + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Create a new user-defined role for incidents. + operationId: CreateIncidentUserDefinedRole + parameters: + - description: Comma-separated list of related resources to include in the response. + in: query + name: include + required: false + schema: + example: "created_by_user,last_modified_by_user,incident_type" + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + description: "The technical lead for the incident." + name: "Tech Lead" + policy: + is_single: true + relationships: + incident_type: + data: + id: "00000000-0000-0000-0000-000000000001" + type: incident_types + type: incident_user_defined_roles + schema: + $ref: "#/components/schemas/IncidentUserDefinedRoleRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created: "2024-01-01T00:00:00.000Z" + description: "The technical lead for the incident." + modified: "2024-01-01T00:00:00.000Z" + name: "Tech Lead" + policy: + is_single: true + id: "00000000-0000-0000-0000-000000000002" + type: incident_user_defined_roles + schema: + $ref: "#/components/schemas/IncidentUserDefinedRoleResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Create an incident user-defined role + tags: + - Incidents + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/config/user-defined-roles/{role_id}: + delete: + description: Delete an existing user-defined role for incidents. + operationId: DeleteIncidentUserDefinedRole + parameters: + - $ref: "#/components/parameters/IncidentUserDefinedRoleIDPathParameter" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Delete an incident user-defined role + tags: + - Incidents + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Retrieve a single user-defined role for incidents. + operationId: GetIncidentUserDefinedRole + parameters: + - $ref: "#/components/parameters/IncidentUserDefinedRoleIDPathParameter" + - description: Comma-separated list of related resources to include in the response. + in: query + name: include + required: false + schema: + example: "created_by_user,last_modified_by_user,incident_type" + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created: "2024-01-01T00:00:00.000Z" + description: "The technical lead for the incident." + modified: "2024-01-01T00:00:00.000Z" + name: "Tech Lead" + policy: + is_single: true + id: "00000000-0000-0000-0000-000000000002" + type: incident_user_defined_roles + schema: + $ref: "#/components/schemas/IncidentUserDefinedRoleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_read + summary: Get an incident user-defined role + tags: + - Incidents + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + patch: + description: Update an existing user-defined role for incidents. + operationId: UpdateIncidentUserDefinedRole + parameters: + - $ref: "#/components/parameters/IncidentUserDefinedRoleIDPathParameter" + - description: Comma-separated list of related resources to include in the response. + in: query + name: include + required: false + schema: + example: "created_by_user,last_modified_by_user,incident_type" + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + name: "Updated Tech Lead" + id: "00000000-0000-0000-0000-000000000002" + type: incident_user_defined_roles + schema: + $ref: "#/components/schemas/IncidentUserDefinedRolePatchRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created: "2024-01-01T00:00:00.000Z" + modified: "2024-01-02T00:00:00.000Z" + name: "Updated Tech Lead" + policy: + is_single: true + id: "00000000-0000-0000-0000-000000000002" + type: incident_user_defined_roles + schema: + $ref: "#/components/schemas/IncidentUserDefinedRoleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Update an incident user-defined role + tags: + - Incidents + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/incidents/import: post: description: |- @@ -122394,6 +125742,57 @@ paths: x-unstable: |- **Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/{incident_id}/ai/postmortem: + post: + description: Generate an AI postmortem for an incident. + operationId: GetIncidentAIPostmortem + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + action_items: "1. Improve failover testing." + customer_impact: "5% of users experienced timeouts for 30 minutes." + executive_summary: "A database failover caused a 30-minute service outage." + key_timeline: "10:00 - Alert fired. 10:30 - Issue resolved." + lessons_learned: "We need to test the failover process under realistic load." + system_overview: "The primary database cluster experienced a failover event." + id: 00000000-0000-0000-0000-000000000000 + type: get_incident_ai_postmortem_response + schema: + $ref: "#/components/schemas/IncidentAIPostmortemResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Get an AI-generated incident postmortem + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/incidents/{incident_id}/attachments: get: description: List incident attachments. @@ -122689,6 +126088,211 @@ paths: x-unstable: |- **Note**: This endpoint is in Preview. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/{incident_id}/cases/page: + post: + description: Create a page from an incident using the Cases service. + operationId: CreatePageFromIncident + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + description: A critical incident affecting production systems. + services: + - web-store + tags: + - env:prod + target: + identifier: my-oncall-team + type: team_handle + title: Production outage - SEV-1 + type: page + schema: + $ref: "#/components/schemas/IncidentCreatePageFromIncidentRequest" + description: Page creation payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + id: 00000000-0000-0000-0000-000000000001 + type: page_uuid + schema: + $ref: "#/components/schemas/IncidentPageUUIDResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Create a page from an incident + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: AND + permissions: + - oncall_page + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/{incident_id}/configurations: + patch: + description: Update a configuration for an incident. + operationId: UpdateIncidentConfiguration + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + include_in_search: false + id: 00000000-0000-0000-0000-000000000001 + type: incidents_configurations + schema: + $ref: "#/components/schemas/IncidentConfigurationPatchRequest" + description: Incident configuration patch payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00.000Z" + execute_integrations: true + execute_notification_rules: true + incident_id: 00000000-0000-0000-0000-000000000000 + include_in_analytics: true + include_in_search: false + modified_at: "2024-01-02T00:00:00.000Z" + id: 00000000-0000-0000-0000-000000000001 + type: incidents_configurations + schema: + $ref: "#/components/schemas/IncidentConfigurationResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Update an incident configuration + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Create a configuration for an incident. + operationId: CreateIncidentConfiguration + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + execute_integrations: true + execute_notification_rules: true + include_in_analytics: true + include_in_search: true + type: incidents_configurations + schema: + $ref: "#/components/schemas/IncidentConfigurationRequest" + description: Incident configuration payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00.000Z" + execute_integrations: true + execute_notification_rules: true + incident_id: 00000000-0000-0000-0000-000000000000 + include_in_analytics: true + include_in_search: true + modified_at: "2024-01-01T00:00:00.000Z" + id: 00000000-0000-0000-0000-000000000001 + type: incidents_configurations + schema: + $ref: "#/components/schemas/IncidentConfigurationResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Create an incident configuration + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/incidents/{incident_id}/impacts: get: description: Get all impacts for an incident. @@ -122832,6 +126436,273 @@ paths: operator: OR permissions: - incident_write + patch: + description: Partially update an incident impact. + operationId: PatchIncidentImpact + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + - $ref: "#/components/parameters/IncidentImpactIDPathParameter" + - $ref: "#/components/parameters/IncidentImpactIncludeQueryParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + description: Patched service impact description + type: incident_impacts + schema: + $ref: "#/components/schemas/IncidentImpactCreateRequest" + description: Incident impact patch payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + description: Patched service impact description + start_at: "2025-08-28T13:17:00Z" + id: 00000000-0000-0000-0000-000000000002 + type: incident_impacts + schema: + $ref: "#/components/schemas/IncidentImpactResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Patch an incident impact + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + put: + description: Update an incident impact. + operationId: UpdateIncidentImpact + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + - $ref: "#/components/parameters/IncidentImpactIDPathParameter" + - $ref: "#/components/parameters/IncidentImpactIncludeQueryParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + description: Updated service impact description + end_at: "2025-08-29T13:17:00Z" + start_at: "2025-08-28T13:17:00Z" + type: incident_impacts + schema: + $ref: "#/components/schemas/IncidentImpactCreateRequest" + description: Incident impact payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + description: Updated service impact description + end_at: "2025-08-29T13:17:00Z" + start_at: "2025-08-28T13:17:00Z" + id: 00000000-0000-0000-0000-000000000002 + type: incident_impacts + schema: + $ref: "#/components/schemas/IncidentImpactResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Update an incident impact + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/{incident_id}/page: + post: + description: Create an on-call page directly from an incident. + operationId: CreateOnCallPageFromIncident + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + description: A critical incident affecting production systems. + services: + - web-store + target: + identifier: my-oncall-team + type: team_handle + title: Production outage - SEV-1 + type: page + schema: + $ref: "#/components/schemas/IncidentCreateOnCallPageRequest" + description: On-call page creation payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + id: 00000000-0000-0000-0000-000000000001 + type: page_uuid + schema: + $ref: "#/components/schemas/IncidentPageUUIDResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Create an on-call page from an incident + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: AND + permissions: + - oncall_page + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/{incident_id}/pages/link: + post: + description: Link an existing on-call page to an incident. + operationId: LinkPageToIncident + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + key: PAGE-12345 + page_target: + identifier: my-oncall-team + type: team_handle + id: PAGE-12345 + type: page + schema: + $ref: "#/components/schemas/IncidentOnCallPageLinkRequest" + description: On-call page link payload. + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + integration_type: 1 + status: 1 + id: 00000000-0000-0000-0000-000000000001 + type: incident_integrations + schema: + $ref: "#/components/schemas/IncidentIntegrationMetadataResponse" + description: Created + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict - page already linked to incident + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Link a page to an incident + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/incidents/{incident_id}/relationships/integrations: get: description: Get all integration metadata for an incident. @@ -123370,6 +127241,491 @@ paths: x-unstable: |- **Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/{incident_id}/responders: + get: + description: List all responders for an incident. + operationId: ListIncidentResponders + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: [] + schema: + $ref: "#/components/schemas/IncidentRespondersResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_read + summary: List incident responders + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Add a responder to an incident. + operationId: CreateIncidentResponder + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + relationships: + user: + data: + id: 00000000-0000-0000-0000-000000000001 + type: users + type: incident_responders + schema: + $ref: "#/components/schemas/IncidentResponderRequest" + description: Incident responder payload. + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created: "2024-01-01T00:00:00.000Z" + is_billable: true + modified: "2024-01-01T00:00:00.000Z" + id: 00000000-0000-0000-0000-000000000002 + type: incident_responders + schema: + $ref: "#/components/schemas/IncidentResponderResponse" + description: Created + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Create an incident responder + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/{incident_id}/responders/{responder_id}: + delete: + description: Remove a responder from an incident. + operationId: DeleteIncidentResponder + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + - $ref: "#/components/parameters/IncidentResponderIDPathParameter" + responses: + "204": + description: No Content + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Delete an incident responder + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Get a single responder for an incident. + operationId: GetIncidentResponder + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + - $ref: "#/components/parameters/IncidentResponderIDPathParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created: "2024-01-01T00:00:00.000Z" + is_billable: true + modified: "2024-01-01T00:00:00.000Z" + id: 00000000-0000-0000-0000-000000000002 + type: incident_responders + schema: + $ref: "#/components/schemas/IncidentResponderResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_read + summary: Get an incident responder + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/{incident_id}/servicenow-records: + post: + description: Create a ServiceNow record for an incident. + operationId: CreateIncidentServiceNowRecord + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + assignment_group: IT Support + configuration_item_mapping: my-service + instance_name: my-instance + type: incident_servicenow_record_prompt + schema: + $ref: "#/components/schemas/IncidentServiceNowRecordRequest" + description: ServiceNow record payload. + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + incident_id: 00000000-0000-0000-0000-000000000000 + integration_type: 0 + metadata: + records: + - instance_name: my-instance + record_num: INC0001234 + redirect_url: https://my-instance.service-now.com/nav_to.do?uri=incident.do?sys_id=abc123 + status: 1 + id: 00000000-0000-0000-0000-000000000001 + type: incident_integrations + schema: + $ref: "#/components/schemas/IncidentIntegrationMetadataResponse" + description: Created + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Create an incident ServiceNow record + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/{incident_id}/timestamp-overrides: + get: + description: List all timestamp overrides for an incident. + operationId: ListTimestampOverrides + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: [] + schema: + $ref: "#/components/schemas/IncidentTimestampOverridesResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_read + summary: List incident timestamp overrides + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Create a timestamp override for an incident. + operationId: CreateTimestampOverride + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + timestamp_type: detected + timestamp_value: "2024-01-01T10:00:00.000Z" + type: incidents_timestamp_overrides + schema: + $ref: "#/components/schemas/IncidentTimestampOverrideRequest" + description: Timestamp override payload. + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00.000Z" + incident_id: 00000000-0000-0000-0000-000000000000 + modified_at: "2024-01-01T00:00:00.000Z" + timestamp_type: detected + timestamp_value: "2024-01-01T10:00:00.000Z" + id: 00000000-0000-0000-0000-000000000001 + type: incidents_timestamp_overrides + schema: + $ref: "#/components/schemas/IncidentTimestampOverrideResponse" + description: Created + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Create an incident timestamp override + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/{incident_id}/timestamp-overrides/{id}: + delete: + description: Delete a timestamp override for an incident. + operationId: DeleteTimestampOverride + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + - $ref: "#/components/parameters/IncidentTimestampOverrideIDPathParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00.000Z" + deleted_at: "2024-01-03T00:00:00.000Z" + incident_id: 00000000-0000-0000-0000-000000000000 + modified_at: "2024-01-01T00:00:00.000Z" + timestamp_type: detected + timestamp_value: "2024-01-01T10:00:00.000Z" + id: 00000000-0000-0000-0000-000000000001 + type: incidents_timestamp_overrides + schema: + $ref: "#/components/schemas/IncidentTimestampOverrideResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Delete an incident timestamp override + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + patch: + description: Update a timestamp override for an incident. + operationId: UpdateTimestampOverride + parameters: + - $ref: "#/components/parameters/IncidentIDPathParameter" + - $ref: "#/components/parameters/IncidentTimestampOverrideIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + timestamp_value: "2024-01-01T11:00:00.000Z" + id: 00000000-0000-0000-0000-000000000001 + type: incidents_timestamp_overrides + schema: + $ref: "#/components/schemas/IncidentTimestampOverridePatchRequest" + description: Timestamp override patch payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00.000Z" + incident_id: 00000000-0000-0000-0000-000000000000 + modified_at: "2024-01-02T00:00:00.000Z" + timestamp_type: detected + timestamp_value: "2024-01-01T11:00:00.000Z" + id: 00000000-0000-0000-0000-000000000001 + type: incidents_timestamp_overrides + schema: + $ref: "#/components/schemas/IncidentTimestampOverrideResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Update an incident timestamp override + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - incident_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/integration/aws/accounts: get: description: Get a list of AWS Account Integration Configs. diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index 44e0c571d4d..4007882537d 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -898,56 +898,93 @@ func NewConfiguration() *Configuration { "v2.CreateGlobalIncidentHandle": false, "v2.CreateIncident": false, "v2.CreateIncidentAttachment": false, + "v2.CreateIncidentConfiguration": false, + "v2.CreateIncidentGoogleChatConfiguration": false, + "v2.CreateIncidentGoogleMeetConfiguration": false, + "v2.CreateIncidentImpactField": false, "v2.CreateIncidentIntegration": false, "v2.CreateIncidentNotificationRule": false, "v2.CreateIncidentNotificationTemplate": false, "v2.CreateIncidentPostmortemAttachment": false, "v2.CreateIncidentPostmortemTemplate": false, + "v2.CreateIncidentResponder": false, + "v2.CreateIncidentRule": false, + "v2.CreateIncidentServiceNowRecord": false, "v2.CreateIncidentTodo": false, "v2.CreateIncidentType": false, "v2.CreateIncidentUserDefinedField": false, + "v2.CreateIncidentUserDefinedRole": false, + "v2.CreateOnCallPageFromIncident": false, + "v2.CreatePageFromIncident": false, + "v2.CreateTimestampOverride": false, "v2.DeleteGlobalIncidentHandle": false, "v2.DeleteIncident": false, "v2.DeleteIncidentAttachment": false, + "v2.DeleteIncidentImpactField": false, "v2.DeleteIncidentIntegration": false, "v2.DeleteIncidentNotificationRule": false, "v2.DeleteIncidentNotificationTemplate": false, "v2.DeleteIncidentPostmortemTemplate": false, + "v2.DeleteIncidentResponder": false, + "v2.DeleteIncidentRule": false, "v2.DeleteIncidentTodo": false, "v2.DeleteIncidentType": false, "v2.DeleteIncidentUserDefinedField": false, + "v2.DeleteIncidentUserDefinedRole": false, + "v2.DeleteTimestampOverride": false, "v2.GetGlobalIncidentSettings": false, "v2.GetIncident": false, + "v2.GetIncidentAIPostmortem": false, "v2.GetIncidentIntegration": false, "v2.GetIncidentNotificationRule": false, "v2.GetIncidentNotificationTemplate": false, "v2.GetIncidentPostmortemTemplate": false, + "v2.GetIncidentResponder": false, + "v2.GetIncidentRule": false, "v2.GetIncidentTodo": false, "v2.GetIncidentType": false, "v2.GetIncidentUserDefinedField": false, + "v2.GetIncidentUserDefinedRole": false, + "v2.GetOrgSettingsByIncidentType": false, "v2.ImportIncident": false, + "v2.LinkPageToIncident": false, "v2.ListGlobalIncidentHandles": false, "v2.ListIncidentAttachments": false, + "v2.ListIncidentImpactFields": false, "v2.ListIncidentIntegrations": false, "v2.ListIncidentNotificationRules": false, "v2.ListIncidentNotificationTemplates": false, "v2.ListIncidentPostmortemTemplates": false, + "v2.ListIncidentResponders": false, + "v2.ListIncidentRules": false, "v2.ListIncidents": false, "v2.ListIncidentTodos": false, "v2.ListIncidentTypes": false, "v2.ListIncidentUserDefinedFields": false, + "v2.ListIncidentUserDefinedRoles": false, + "v2.ListOrgSettings": false, + "v2.ListTimestampOverrides": false, + "v2.PatchIncidentImpact": false, "v2.SearchIncidents": false, "v2.UpdateGlobalIncidentHandle": false, "v2.UpdateGlobalIncidentSettings": false, "v2.UpdateIncident": false, "v2.UpdateIncidentAttachment": false, + "v2.UpdateIncidentConfiguration": false, + "v2.UpdateIncidentGoogleChatConfiguration": false, + "v2.UpdateIncidentGoogleMeetConfiguration": false, + "v2.UpdateIncidentImpact": false, + "v2.UpdateIncidentImpactField": false, "v2.UpdateIncidentIntegration": false, "v2.UpdateIncidentNotificationRule": false, "v2.UpdateIncidentNotificationTemplate": false, "v2.UpdateIncidentPostmortemTemplate": false, + "v2.UpdateIncidentRule": false, "v2.UpdateIncidentTodo": false, "v2.UpdateIncidentType": false, "v2.UpdateIncidentUserDefinedField": false, + "v2.UpdateIncidentUserDefinedRole": false, + "v2.UpdateTimestampOverride": false, "v2.CreateAWSAccountCCMConfig": false, "v2.DeleteAWSAccountCCMConfig": false, "v2.GetAWSAccountCCMConfig": false, diff --git a/api/datadogV2/api_incidents.go b/api/datadogV2/api_incidents.go index aacbc6be95a..f93a0f3f654 100644 --- a/api/datadogV2/api_incidents.go +++ b/api/datadogV2/api_incidents.go @@ -351,54 +351,35 @@ func (a *IncidentsApi) CreateIncidentAttachment(ctx _context.Context, incidentId return localVarReturnValue, localVarHTTPResponse, nil } -// CreateIncidentImpactOptionalParameters holds optional parameters for CreateIncidentImpact. -type CreateIncidentImpactOptionalParameters struct { - Include *[]IncidentImpactRelatedObject -} - -// NewCreateIncidentImpactOptionalParameters creates an empty struct for parameters. -func NewCreateIncidentImpactOptionalParameters() *CreateIncidentImpactOptionalParameters { - this := CreateIncidentImpactOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *CreateIncidentImpactOptionalParameters) WithInclude(include []IncidentImpactRelatedObject) *CreateIncidentImpactOptionalParameters { - r.Include = &include - return r -} - -// CreateIncidentImpact Create an incident impact. -// Create an impact for an incident. -func (a *IncidentsApi) CreateIncidentImpact(ctx _context.Context, incidentId string, body IncidentImpactCreateRequest, o ...CreateIncidentImpactOptionalParameters) (IncidentImpactResponse, *_nethttp.Response, error) { +// CreateIncidentConfiguration Create an incident configuration. +// Create a configuration for an incident. +func (a *IncidentsApi) CreateIncidentConfiguration(ctx _context.Context, incidentId string, body IncidentConfigurationRequest) (IncidentConfigurationResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} - localVarReturnValue IncidentImpactResponse - optionalParams CreateIncidentImpactOptionalParameters + localVarReturnValue IncidentConfigurationResponse ) - if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type CreateIncidentImpactOptionalParameters is allowed") + operationId := "v2.CreateIncidentConfiguration" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} } - if len(o) == 1 { - optionalParams = o[0] + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentImpact") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentConfiguration") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/impacts" + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/configurations" localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "csv")) - } localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" @@ -460,16 +441,16 @@ func (a *IncidentsApi) CreateIncidentImpact(ctx _context.Context, incidentId str return localVarReturnValue, localVarHTTPResponse, nil } -// CreateIncidentIntegration Create an incident integration metadata. -// Create an incident integration metadata. -func (a *IncidentsApi) CreateIncidentIntegration(ctx _context.Context, incidentId string, body IncidentIntegrationMetadataCreateRequest) (IncidentIntegrationMetadataResponse, *_nethttp.Response, error) { +// CreateIncidentGoogleChatConfiguration Create an incident Google Chat configuration. +// Create a Google Chat configuration for incidents. +func (a *IncidentsApi) CreateIncidentGoogleChatConfiguration(ctx _context.Context, body IncidentGoogleChatConfigurationRequest) (IncidentGoogleChatConfigurationResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} - localVarReturnValue IncidentIntegrationMetadataResponse + localVarReturnValue IncidentGoogleChatConfigurationResponse ) - operationId := "v2.CreateIncidentIntegration" + operationId := "v2.CreateIncidentGoogleChatConfiguration" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -478,13 +459,12 @@ func (a *IncidentsApi) CreateIncidentIntegration(ctx _context.Context, incidentI _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentIntegration") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentGoogleChatConfiguration") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/integrations" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/google-chat-configurations" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -527,7 +507,7 @@ func (a *IncidentsApi) CreateIncidentIntegration(ctx _context.Context, incidentI ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -550,16 +530,16 @@ func (a *IncidentsApi) CreateIncidentIntegration(ctx _context.Context, incidentI return localVarReturnValue, localVarHTTPResponse, nil } -// CreateIncidentNotificationRule Create an incident notification rule. -// Creates a new notification rule. -func (a *IncidentsApi) CreateIncidentNotificationRule(ctx _context.Context, body CreateIncidentNotificationRuleRequest) (IncidentNotificationRule, *_nethttp.Response, error) { +// CreateIncidentGoogleMeetConfiguration Create an incident Google Meet configuration. +// Create a Google Meet configuration for incidents. +func (a *IncidentsApi) CreateIncidentGoogleMeetConfiguration(ctx _context.Context, body IncidentGoogleMeetConfigurationRequest) (IncidentGoogleMeetConfigurationResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} - localVarReturnValue IncidentNotificationRule + localVarReturnValue IncidentGoogleMeetConfigurationResponse ) - operationId := "v2.CreateIncidentNotificationRule" + operationId := "v2.CreateIncidentGoogleMeetConfiguration" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -568,12 +548,12 @@ func (a *IncidentsApi) CreateIncidentNotificationRule(ctx _context.Context, body _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentNotificationRule") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentGoogleMeetConfiguration") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/notification-rules" + localVarPath := localBasePath + "/api/v2/incidents/config/google-meet-configurations" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -616,7 +596,7 @@ func (a *IncidentsApi) CreateIncidentNotificationRule(ctx _context.Context, body ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -639,34 +619,54 @@ func (a *IncidentsApi) CreateIncidentNotificationRule(ctx _context.Context, body return localVarReturnValue, localVarHTTPResponse, nil } -// CreateIncidentNotificationTemplate Create incident notification template. -// Creates a new notification template. -func (a *IncidentsApi) CreateIncidentNotificationTemplate(ctx _context.Context, body CreateIncidentNotificationTemplateRequest) (IncidentNotificationTemplate, *_nethttp.Response, error) { +// CreateIncidentImpactOptionalParameters holds optional parameters for CreateIncidentImpact. +type CreateIncidentImpactOptionalParameters struct { + Include *[]IncidentImpactRelatedObject +} + +// NewCreateIncidentImpactOptionalParameters creates an empty struct for parameters. +func NewCreateIncidentImpactOptionalParameters() *CreateIncidentImpactOptionalParameters { + this := CreateIncidentImpactOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *CreateIncidentImpactOptionalParameters) WithInclude(include []IncidentImpactRelatedObject) *CreateIncidentImpactOptionalParameters { + r.Include = &include + return r +} + +// CreateIncidentImpact Create an incident impact. +// Create an impact for an incident. +func (a *IncidentsApi) CreateIncidentImpact(ctx _context.Context, incidentId string, body IncidentImpactCreateRequest, o ...CreateIncidentImpactOptionalParameters) (IncidentImpactResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} - localVarReturnValue IncidentNotificationTemplate + localVarReturnValue IncidentImpactResponse + optionalParams CreateIncidentImpactOptionalParameters ) - operationId := "v2.CreateIncidentNotificationTemplate" - isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) - if !isOperationEnabled { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type CreateIncidentImpactOptionalParameters is allowed") } - if isOperationEnabled && a.Client.Cfg.Debug { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) + if len(o) == 1 { + optionalParams = o[0] } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentNotificationTemplate") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentImpact") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/notification-templates" + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/impacts" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "csv")) + } localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" @@ -728,20 +728,16 @@ func (a *IncidentsApi) CreateIncidentNotificationTemplate(ctx _context.Context, return localVarReturnValue, localVarHTTPResponse, nil } -// CreateIncidentPostmortemAttachment Create postmortem attachment. -// Create a postmortem attachment for an incident. -// -// The endpoint accepts markdown for notebooks created in Confluence or Google Docs. -// Postmortems created from notebooks need to be formatted using frontend notebook cells, -// in addition to markdown format. -func (a *IncidentsApi) CreateIncidentPostmortemAttachment(ctx _context.Context, incidentId string, body PostmortemAttachmentRequest) (Attachment, *_nethttp.Response, error) { +// CreateIncidentImpactField Create an incident impact field. +// Create an impact field for incidents. +func (a *IncidentsApi) CreateIncidentImpactField(ctx _context.Context, body IncidentImpactFieldRequest) (IncidentImpactFieldResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} - localVarReturnValue Attachment + localVarReturnValue IncidentImpactFieldResponse ) - operationId := "v2.CreateIncidentPostmortemAttachment" + operationId := "v2.CreateIncidentImpactField" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -750,13 +746,12 @@ func (a *IncidentsApi) CreateIncidentPostmortemAttachment(ctx _context.Context, _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentPostmortemAttachment") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentImpactField") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/attachments/postmortems" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/impact-fields" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -799,16 +794,7 @@ func (a *IncidentsApi) CreateIncidentPostmortemAttachment(ctx _context.Context, ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -831,16 +817,16 @@ func (a *IncidentsApi) CreateIncidentPostmortemAttachment(ctx _context.Context, return localVarReturnValue, localVarHTTPResponse, nil } -// CreateIncidentPostmortemTemplate Create postmortem template. -// Create a new postmortem template for incidents. -func (a *IncidentsApi) CreateIncidentPostmortemTemplate(ctx _context.Context, body PostmortemTemplateRequest) (PostmortemTemplateResponse, *_nethttp.Response, error) { +// CreateIncidentIntegration Create an incident integration metadata. +// Create an incident integration metadata. +func (a *IncidentsApi) CreateIncidentIntegration(ctx _context.Context, incidentId string, body IncidentIntegrationMetadataCreateRequest) (IncidentIntegrationMetadataResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} - localVarReturnValue PostmortemTemplateResponse + localVarReturnValue IncidentIntegrationMetadataResponse ) - operationId := "v2.CreateIncidentPostmortemTemplate" + operationId := "v2.CreateIncidentIntegration" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -849,12 +835,13 @@ func (a *IncidentsApi) CreateIncidentPostmortemTemplate(ctx _context.Context, bo _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentPostmortemTemplate") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentIntegration") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/postmortem-templates" + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/integrations" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -897,16 +884,7 @@ func (a *IncidentsApi) CreateIncidentPostmortemTemplate(ctx _context.Context, bo ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -929,16 +907,16 @@ func (a *IncidentsApi) CreateIncidentPostmortemTemplate(ctx _context.Context, bo return localVarReturnValue, localVarHTTPResponse, nil } -// CreateIncidentTodo Create an incident todo. -// Create an incident todo. -func (a *IncidentsApi) CreateIncidentTodo(ctx _context.Context, incidentId string, body IncidentTodoCreateRequest) (IncidentTodoResponse, *_nethttp.Response, error) { +// CreateIncidentNotificationRule Create an incident notification rule. +// Creates a new notification rule. +func (a *IncidentsApi) CreateIncidentNotificationRule(ctx _context.Context, body CreateIncidentNotificationRuleRequest) (IncidentNotificationRule, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} - localVarReturnValue IncidentTodoResponse + localVarReturnValue IncidentNotificationRule ) - operationId := "v2.CreateIncidentTodo" + operationId := "v2.CreateIncidentNotificationRule" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -947,13 +925,12 @@ func (a *IncidentsApi) CreateIncidentTodo(ctx _context.Context, incidentId strin _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentTodo") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentNotificationRule") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/todos" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/notification-rules" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1019,16 +996,16 @@ func (a *IncidentsApi) CreateIncidentTodo(ctx _context.Context, incidentId strin return localVarReturnValue, localVarHTTPResponse, nil } -// CreateIncidentType Create an incident type. -// Create an incident type. -func (a *IncidentsApi) CreateIncidentType(ctx _context.Context, body IncidentTypeCreateRequest) (IncidentTypeResponse, *_nethttp.Response, error) { +// CreateIncidentNotificationTemplate Create incident notification template. +// Creates a new notification template. +func (a *IncidentsApi) CreateIncidentNotificationTemplate(ctx _context.Context, body CreateIncidentNotificationTemplateRequest) (IncidentNotificationTemplate, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} - localVarReturnValue IncidentTypeResponse + localVarReturnValue IncidentNotificationTemplate ) - operationId := "v2.CreateIncidentType" + operationId := "v2.CreateIncidentNotificationTemplate" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -1037,12 +1014,12 @@ func (a *IncidentsApi) CreateIncidentType(ctx _context.Context, body IncidentTyp _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentType") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentNotificationTemplate") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/types" + localVarPath := localBasePath + "/api/v2/incidents/config/notification-templates" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1108,41 +1085,20 @@ func (a *IncidentsApi) CreateIncidentType(ctx _context.Context, body IncidentTyp return localVarReturnValue, localVarHTTPResponse, nil } -// CreateIncidentUserDefinedFieldOptionalParameters holds optional parameters for CreateIncidentUserDefinedField. -type CreateIncidentUserDefinedFieldOptionalParameters struct { - Include *string -} - -// NewCreateIncidentUserDefinedFieldOptionalParameters creates an empty struct for parameters. -func NewCreateIncidentUserDefinedFieldOptionalParameters() *CreateIncidentUserDefinedFieldOptionalParameters { - this := CreateIncidentUserDefinedFieldOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *CreateIncidentUserDefinedFieldOptionalParameters) WithInclude(include string) *CreateIncidentUserDefinedFieldOptionalParameters { - r.Include = &include - return r -} - -// CreateIncidentUserDefinedField Create an incident user-defined field. -// Create an incident user-defined field. -func (a *IncidentsApi) CreateIncidentUserDefinedField(ctx _context.Context, body IncidentUserDefinedFieldCreateRequest, o ...CreateIncidentUserDefinedFieldOptionalParameters) (IncidentUserDefinedFieldResponse, *_nethttp.Response, error) { +// CreateIncidentPostmortemAttachment Create postmortem attachment. +// Create a postmortem attachment for an incident. +// +// The endpoint accepts markdown for notebooks created in Confluence or Google Docs. +// Postmortems created from notebooks need to be formatted using frontend notebook cells, +// in addition to markdown format. +func (a *IncidentsApi) CreateIncidentPostmortemAttachment(ctx _context.Context, incidentId string, body PostmortemAttachmentRequest) (Attachment, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} - localVarReturnValue IncidentUserDefinedFieldResponse - optionalParams CreateIncidentUserDefinedFieldOptionalParameters + localVarReturnValue Attachment ) - if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type CreateIncidentUserDefinedFieldOptionalParameters is allowed") - } - if len(o) == 1 { - optionalParams = o[0] - } - - operationId := "v2.CreateIncidentUserDefinedField" + operationId := "v2.CreateIncidentPostmortemAttachment" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -1151,19 +1107,17 @@ func (a *IncidentsApi) CreateIncidentUserDefinedField(ctx _context.Context, body _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentUserDefinedField") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentPostmortemAttachment") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/user-defined-fields" + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/attachments/postmortems" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) - } localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" @@ -1202,7 +1156,7 @@ func (a *IncidentsApi) CreateIncidentUserDefinedField(ctx _context.Context, body ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 { + if localVarHTTPResponse.StatusCode == 400 { var v JSONAPIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1211,7 +1165,7 @@ func (a *IncidentsApi) CreateIncidentUserDefinedField(ctx _context.Context, body newErr.ErrorModel = v return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1234,39 +1188,43 @@ func (a *IncidentsApi) CreateIncidentUserDefinedField(ctx _context.Context, body return localVarReturnValue, localVarHTTPResponse, nil } -// DeleteGlobalIncidentHandle Delete global incident handle. -// Delete a global incident handle. -func (a *IncidentsApi) DeleteGlobalIncidentHandle(ctx _context.Context) (*_nethttp.Response, error) { +// CreateIncidentPostmortemTemplate Create postmortem template. +// Create a new postmortem template for incidents. +func (a *IncidentsApi) CreateIncidentPostmortemTemplate(ctx _context.Context, body PostmortemTemplateRequest) (PostmortemTemplateResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue PostmortemTemplateResponse ) - operationId := "v2.DeleteGlobalIncidentHandle" + operationId := "v2.CreateIncidentPostmortemTemplate" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { - return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} } if isOperationEnabled && a.Client.Cfg.Debug { _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteGlobalIncidentHandle") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentPostmortemTemplate") if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/global/incident-handles" + localVarPath := localBasePath + "/api/v2/incidents/config/postmortem-templates" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { - return nil, err + return localVarReturnValue, nil, err } } else { datadog.SetAuthKeys( @@ -1278,17 +1236,17 @@ func (a *IncidentsApi) DeleteGlobalIncidentHandle(ctx _context.Context) (*_netht } req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.Client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := datadog.ReadBody(localVarHTTPResponse) if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -1296,63 +1254,76 @@ func (a *IncidentsApi) DeleteGlobalIncidentHandle(ctx _context.Context) (*_netht ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 { var v JSONAPIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.ErrorModel = v - return localVarHTTPResponse, newErr + return localVarReturnValue, 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 + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.ErrorModel = v } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -// 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) { +// CreateIncidentResponder Create an incident responder. +// Add a responder to an incident. +func (a *IncidentsApi) CreateIncidentResponder(ctx _context.Context, incidentId string, body IncidentResponderRequest) (IncidentResponderResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentResponderResponse ) - operationId := "v2.DeleteIncident" + operationId := "v2.CreateIncidentResponder" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { - return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} } if isOperationEnabled && a.Client.Cfg.Debug { _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncident") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentResponder") if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}" + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/responders" localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { - return nil, err + return localVarReturnValue, nil, err } } else { datadog.SetAuthKeys( @@ -1364,17 +1335,17 @@ func (a *IncidentsApi) DeleteIncident(ctx _context.Context, incidentId string) ( } req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.Client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := datadog.ReadBody(localVarHTTPResponse) if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -1386,51 +1357,62 @@ func (a *IncidentsApi) DeleteIncident(ctx _context.Context, incidentId string) ( var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.ErrorModel = v } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil -} + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } -// DeleteIncidentAttachment Delete incident attachment. + return localVarReturnValue, localVarHTTPResponse, nil +} -func (a *IncidentsApi) DeleteIncidentAttachment(ctx _context.Context, incidentId string, attachmentId string) (*_nethttp.Response, error) { +// CreateIncidentRule Create an incident rule. +// Create an incident rule. +func (a *IncidentsApi) CreateIncidentRule(ctx _context.Context, body IncidentRuleRequest) (IncidentRuleResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentRuleResponse ) - operationId := "v2.DeleteIncidentAttachment" + operationId := "v2.CreateIncidentRule" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { - return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} } if isOperationEnabled && a.Client.Cfg.Debug { _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentAttachment") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentRule") if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/attachments/{attachment_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) - localVarPath = datadog.ReplacePathParameter(localVarPath, "{attachment_id}", _neturl.PathEscape(datadog.ParameterToString(attachmentId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/rules" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { - return nil, err + return localVarReturnValue, nil, err } } else { datadog.SetAuthKeys( @@ -1442,17 +1424,17 @@ func (a *IncidentsApi) DeleteIncidentAttachment(ctx _context.Context, incidentId } req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.Client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := datadog.ReadBody(localVarHTTPResponse) if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -1460,46 +1442,67 @@ func (a *IncidentsApi) DeleteIncidentAttachment(ctx _context.Context, incidentId ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.ErrorModel = v } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -// DeleteIncidentImpact Delete an incident impact. -// Delete an incident impact. -func (a *IncidentsApi) DeleteIncidentImpact(ctx _context.Context, incidentId string, impactId string) (*_nethttp.Response, error) { +// CreateIncidentServiceNowRecord Create an incident ServiceNow record. +// Create a ServiceNow record for an incident. +func (a *IncidentsApi) CreateIncidentServiceNowRecord(ctx _context.Context, incidentId string, body IncidentServiceNowRecordRequest) (IncidentIntegrationMetadataResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentIntegrationMetadataResponse ) - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentImpact") + operationId := "v2.CreateIncidentServiceNowRecord" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentServiceNowRecord") if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/impacts/{impact_id}" + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/servicenow-records" localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) - localVarPath = datadog.ReplacePathParameter(localVarPath, "{impact_id}", _neturl.PathEscape(datadog.ParameterToString(impactId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { - return nil, err + return localVarReturnValue, nil, err } } else { datadog.SetAuthKeys( @@ -1511,17 +1514,17 @@ func (a *IncidentsApi) DeleteIncidentImpact(ctx _context.Context, incidentId str } req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.Client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := datadog.ReadBody(localVarHTTPResponse) if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -1529,55 +1532,67 @@ func (a *IncidentsApi) DeleteIncidentImpact(ctx _context.Context, incidentId str ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.ErrorModel = v } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -// DeleteIncidentIntegration Delete an incident integration metadata. -// Delete an incident integration metadata. -func (a *IncidentsApi) DeleteIncidentIntegration(ctx _context.Context, incidentId string, integrationMetadataId string) (*_nethttp.Response, error) { +// CreateIncidentTodo Create an incident todo. +// Create an incident todo. +func (a *IncidentsApi) CreateIncidentTodo(ctx _context.Context, incidentId string, body IncidentTodoCreateRequest) (IncidentTodoResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentTodoResponse ) - operationId := "v2.DeleteIncidentIntegration" + operationId := "v2.CreateIncidentTodo" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { - return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} } if isOperationEnabled && a.Client.Cfg.Debug { _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentIntegration") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentTodo") if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}" + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/todos" localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) - localVarPath = datadog.ReplacePathParameter(localVarPath, "{integration_metadata_id}", _neturl.PathEscape(datadog.ParameterToString(integrationMetadataId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { - return nil, err + return localVarReturnValue, nil, err } } else { datadog.SetAuthKeys( @@ -1589,17 +1604,17 @@ func (a *IncidentsApi) DeleteIncidentIntegration(ctx _context.Context, incidentI } req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.Client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := datadog.ReadBody(localVarHTTPResponse) if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -1611,78 +1626,62 @@ func (a *IncidentsApi) DeleteIncidentIntegration(ctx _context.Context, incidentI var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.ErrorModel = v } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil -} - -// DeleteIncidentNotificationRuleOptionalParameters holds optional parameters for DeleteIncidentNotificationRule. -type DeleteIncidentNotificationRuleOptionalParameters struct { - Include *string -} - -// NewDeleteIncidentNotificationRuleOptionalParameters creates an empty struct for parameters. -func NewDeleteIncidentNotificationRuleOptionalParameters() *DeleteIncidentNotificationRuleOptionalParameters { - this := DeleteIncidentNotificationRuleOptionalParameters{} - return &this -} + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *DeleteIncidentNotificationRuleOptionalParameters) WithInclude(include string) *DeleteIncidentNotificationRuleOptionalParameters { - r.Include = &include - return r + return localVarReturnValue, localVarHTTPResponse, nil } -// DeleteIncidentNotificationRule Delete an incident notification rule. -// Deletes a notification rule by its ID. -func (a *IncidentsApi) DeleteIncidentNotificationRule(ctx _context.Context, id uuid.UUID, o ...DeleteIncidentNotificationRuleOptionalParameters) (*_nethttp.Response, error) { +// CreateIncidentType Create an incident type. +// Create an incident type. +func (a *IncidentsApi) CreateIncidentType(ctx _context.Context, body IncidentTypeCreateRequest) (IncidentTypeResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - optionalParams DeleteIncidentNotificationRuleOptionalParameters + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentTypeResponse ) - if len(o) > 1 { - return nil, datadog.ReportError("only one argument of type DeleteIncidentNotificationRuleOptionalParameters is allowed") - } - if len(o) == 1 { - optionalParams = o[0] - } - - operationId := "v2.DeleteIncidentNotificationRule" + operationId := "v2.CreateIncidentType" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { - return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} } if isOperationEnabled && a.Client.Cfg.Debug { _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentNotificationRule") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentType") if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/notification-rules/{id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/types" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) - } - localVarHeaderParams["Accept"] = "*/*" + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { - return nil, err + return localVarReturnValue, nil, err } } else { datadog.SetAuthKeys( @@ -1694,17 +1693,17 @@ func (a *IncidentsApi) DeleteIncidentNotificationRule(ctx _context.Context, id u } req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.Client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := datadog.ReadBody(localVarHTTPResponse) if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -1716,65 +1715,74 @@ func (a *IncidentsApi) DeleteIncidentNotificationRule(ctx _context.Context, id u var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.ErrorModel = v } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -// DeleteIncidentNotificationTemplateOptionalParameters holds optional parameters for DeleteIncidentNotificationTemplate. -type DeleteIncidentNotificationTemplateOptionalParameters struct { +// CreateIncidentUserDefinedFieldOptionalParameters holds optional parameters for CreateIncidentUserDefinedField. +type CreateIncidentUserDefinedFieldOptionalParameters struct { Include *string } -// NewDeleteIncidentNotificationTemplateOptionalParameters creates an empty struct for parameters. -func NewDeleteIncidentNotificationTemplateOptionalParameters() *DeleteIncidentNotificationTemplateOptionalParameters { - this := DeleteIncidentNotificationTemplateOptionalParameters{} +// NewCreateIncidentUserDefinedFieldOptionalParameters creates an empty struct for parameters. +func NewCreateIncidentUserDefinedFieldOptionalParameters() *CreateIncidentUserDefinedFieldOptionalParameters { + this := CreateIncidentUserDefinedFieldOptionalParameters{} return &this } // WithInclude sets the corresponding parameter name and returns the struct. -func (r *DeleteIncidentNotificationTemplateOptionalParameters) WithInclude(include string) *DeleteIncidentNotificationTemplateOptionalParameters { +func (r *CreateIncidentUserDefinedFieldOptionalParameters) WithInclude(include string) *CreateIncidentUserDefinedFieldOptionalParameters { r.Include = &include return r } -// DeleteIncidentNotificationTemplate Delete a notification template. -// Deletes a notification template by its ID. -func (a *IncidentsApi) DeleteIncidentNotificationTemplate(ctx _context.Context, id uuid.UUID, o ...DeleteIncidentNotificationTemplateOptionalParameters) (*_nethttp.Response, error) { +// CreateIncidentUserDefinedField Create an incident user-defined field. +// Create an incident user-defined field. +func (a *IncidentsApi) CreateIncidentUserDefinedField(ctx _context.Context, body IncidentUserDefinedFieldCreateRequest, o ...CreateIncidentUserDefinedFieldOptionalParameters) (IncidentUserDefinedFieldResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - optionalParams DeleteIncidentNotificationTemplateOptionalParameters + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentUserDefinedFieldResponse + optionalParams CreateIncidentUserDefinedFieldOptionalParameters ) if len(o) > 1 { - return nil, datadog.ReportError("only one argument of type DeleteIncidentNotificationTemplateOptionalParameters is allowed") + return localVarReturnValue, nil, datadog.ReportError("only one argument of type CreateIncidentUserDefinedFieldOptionalParameters is allowed") } if len(o) == 1 { optionalParams = o[0] } - operationId := "v2.DeleteIncidentNotificationTemplate" + operationId := "v2.CreateIncidentUserDefinedField" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { - return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} } if isOperationEnabled && a.Client.Cfg.Debug { _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentNotificationTemplate") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentUserDefinedField") if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/notification-templates/{id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/user-defined-fields" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1782,12 +1790,15 @@ func (a *IncidentsApi) DeleteIncidentNotificationTemplate(ctx _context.Context, if optionalParams.Include != nil { localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) } - localVarHeaderParams["Accept"] = "*/*" + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { - return nil, err + return localVarReturnValue, nil, err } } else { datadog.SetAuthKeys( @@ -1799,17 +1810,17 @@ func (a *IncidentsApi) DeleteIncidentNotificationTemplate(ctx _context.Context, } req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.Client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := datadog.ReadBody(localVarHTTPResponse) if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -1817,54 +1828,103 @@ func (a *IncidentsApi) DeleteIncidentNotificationTemplate(ctx _context.Context, ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&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 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.ErrorModel = v } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -// DeleteIncidentPostmortemTemplate Delete postmortem template. -// Delete a postmortem template. -func (a *IncidentsApi) DeleteIncidentPostmortemTemplate(ctx _context.Context, templateId string) (*_nethttp.Response, error) { +// CreateIncidentUserDefinedRoleOptionalParameters holds optional parameters for CreateIncidentUserDefinedRole. +type CreateIncidentUserDefinedRoleOptionalParameters struct { + Include *string +} + +// NewCreateIncidentUserDefinedRoleOptionalParameters creates an empty struct for parameters. +func NewCreateIncidentUserDefinedRoleOptionalParameters() *CreateIncidentUserDefinedRoleOptionalParameters { + this := CreateIncidentUserDefinedRoleOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *CreateIncidentUserDefinedRoleOptionalParameters) WithInclude(include string) *CreateIncidentUserDefinedRoleOptionalParameters { + r.Include = &include + return r +} + +// CreateIncidentUserDefinedRole Create an incident user-defined role. +// Create a new user-defined role for incidents. +func (a *IncidentsApi) CreateIncidentUserDefinedRole(ctx _context.Context, body IncidentUserDefinedRoleRequest, o ...CreateIncidentUserDefinedRoleOptionalParameters) (IncidentUserDefinedRoleResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentUserDefinedRoleResponse + optionalParams CreateIncidentUserDefinedRoleOptionalParameters ) - operationId := "v2.DeleteIncidentPostmortemTemplate" + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type CreateIncidentUserDefinedRoleOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.CreateIncidentUserDefinedRole" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { - return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} } if isOperationEnabled && a.Client.Cfg.Debug { _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentPostmortemTemplate") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateIncidentUserDefinedRole") if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/postmortem-templates/{template_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{template_id}", _neturl.PathEscape(datadog.ParameterToString(templateId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/user-defined-roles" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { - return nil, err + return localVarReturnValue, nil, err } } else { datadog.SetAuthKeys( @@ -1876,17 +1936,17 @@ func (a *IncidentsApi) DeleteIncidentPostmortemTemplate(ctx _context.Context, te } req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.Client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := datadog.ReadBody(localVarHTTPResponse) if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -1894,64 +1954,76 @@ func (a *IncidentsApi) DeleteIncidentPostmortemTemplate(ctx _context.Context, te ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 { var v JSONAPIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.ErrorModel = v - return localVarHTTPResponse, newErr + return localVarReturnValue, 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 + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.ErrorModel = v } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -// DeleteIncidentTodo Delete an incident todo. -// Delete an incident todo. -func (a *IncidentsApi) DeleteIncidentTodo(ctx _context.Context, incidentId string, todoId string) (*_nethttp.Response, error) { +// CreateOnCallPageFromIncident Create an on-call page from an incident. +// Create an on-call page directly from an incident. +func (a *IncidentsApi) CreateOnCallPageFromIncident(ctx _context.Context, incidentId string, body IncidentCreateOnCallPageRequest) (IncidentPageUUIDResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentPageUUIDResponse ) - operationId := "v2.DeleteIncidentTodo" + operationId := "v2.CreateOnCallPageFromIncident" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { - return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} } if isOperationEnabled && a.Client.Cfg.Debug { _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentTodo") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateOnCallPageFromIncident") if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}" + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/page" localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) - localVarPath = datadog.ReplacePathParameter(localVarPath, "{todo_id}", _neturl.PathEscape(datadog.ParameterToString(todoId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { - return nil, err + return localVarReturnValue, nil, err } } else { datadog.SetAuthKeys( @@ -1963,17 +2035,17 @@ func (a *IncidentsApi) DeleteIncidentTodo(ctx _context.Context, incidentId strin } req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.Client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := datadog.ReadBody(localVarHTTPResponse) if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -1985,50 +2057,63 @@ func (a *IncidentsApi) DeleteIncidentTodo(ctx _context.Context, incidentId strin var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.ErrorModel = v } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -// DeleteIncidentType Delete an incident type. -// Delete an incident type. -func (a *IncidentsApi) DeleteIncidentType(ctx _context.Context, incidentTypeId string) (*_nethttp.Response, error) { +// CreatePageFromIncident Create a page from an incident. +// Create a page from an incident using the Cases service. +func (a *IncidentsApi) CreatePageFromIncident(ctx _context.Context, incidentId string, body IncidentCreatePageFromIncidentRequest) (IncidentPageUUIDResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentPageUUIDResponse ) - operationId := "v2.DeleteIncidentType" + operationId := "v2.CreatePageFromIncident" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { - return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} } if isOperationEnabled && a.Client.Cfg.Debug { _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentType") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreatePageFromIncident") if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/types/{incident_type_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_type_id}", _neturl.PathEscape(datadog.ParameterToString(incidentTypeId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/cases/page" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { - return nil, err + return localVarReturnValue, nil, err } } else { datadog.SetAuthKeys( @@ -2040,17 +2125,17 @@ func (a *IncidentsApi) DeleteIncidentType(ctx _context.Context, incidentTypeId s } req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.Client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := datadog.ReadBody(localVarHTTPResponse) if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -2062,50 +2147,63 @@ func (a *IncidentsApi) DeleteIncidentType(ctx _context.Context, incidentTypeId s var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.ErrorModel = v } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -// DeleteIncidentUserDefinedField Delete an incident user-defined field. -// Delete an incident user-defined field. -func (a *IncidentsApi) DeleteIncidentUserDefinedField(ctx _context.Context, fieldId string) (*_nethttp.Response, error) { +// CreateTimestampOverride Create an incident timestamp override. +// Create a timestamp override for an incident. +func (a *IncidentsApi) CreateTimestampOverride(ctx _context.Context, incidentId string, body IncidentTimestampOverrideRequest) (IncidentTimestampOverrideResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentTimestampOverrideResponse ) - operationId := "v2.DeleteIncidentUserDefinedField" + operationId := "v2.CreateTimestampOverride" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { - return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} } if isOperationEnabled && a.Client.Cfg.Debug { _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentUserDefinedField") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.CreateTimestampOverride") if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/user-defined-fields/{field_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{field_id}", _neturl.PathEscape(datadog.ParameterToString(fieldId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/timestamp-overrides" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { - return nil, err + return localVarReturnValue, nil, err } } else { datadog.SetAuthKeys( @@ -2117,17 +2215,17 @@ func (a *IncidentsApi) DeleteIncidentUserDefinedField(ctx _context.Context, fiel } req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) if err != nil { - return nil, err + return localVarReturnValue, nil, err } localVarHTTPResponse, err := a.Client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } localVarBody, err := datadog.ReadBody(localVarHTTPResponse) if err != nil { - return localVarHTTPResponse, err + return localVarReturnValue, localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -2135,63 +2233,62 @@ func (a *IncidentsApi) DeleteIncidentUserDefinedField(ctx _context.Context, fiel ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 { - var v JSONAPIErrorResponse - 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 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } newErr.ErrorModel = v } - return localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarHTTPResponse, nil + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -// GetGlobalIncidentSettings Get global incident settings. -// Retrieve global incident settings for the organization. -func (a *IncidentsApi) GetGlobalIncidentSettings(ctx _context.Context) (GlobalIncidentSettingsResponse, *_nethttp.Response, error) { +// DeleteGlobalIncidentHandle Delete global incident handle. +// Delete a global incident handle. +func (a *IncidentsApi) DeleteGlobalIncidentHandle(ctx _context.Context) (*_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue GlobalIncidentSettingsResponse + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} ) - operationId := "v2.GetGlobalIncidentSettings" + operationId := "v2.DeleteGlobalIncidentHandle" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} } if isOperationEnabled && a.Client.Cfg.Debug { _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetGlobalIncidentSettings") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteGlobalIncidentHandle") if err != nil { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/global/settings" + localVarPath := localBasePath + "/api/v2/incidents/config/global/incident-handles" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" + localVarHeaderParams["Accept"] = "*/*" if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { - return localVarReturnValue, nil, err + return nil, err } } else { datadog.SetAuthKeys( @@ -2203,17 +2300,17 @@ func (a *IncidentsApi) GetGlobalIncidentSettings(ctx _context.Context) (GlobalIn } req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) if err != nil { - return localVarReturnValue, nil, err + return nil, err } localVarHTTPResponse, err := a.Client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err + return localVarHTTPResponse, err } localVarBody, err := datadog.ReadBody(localVarHTTPResponse) if err != nil { - return localVarReturnValue, localVarHTTPResponse, err + return localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -2225,80 +2322,45 @@ func (a *IncidentsApi) GetGlobalIncidentSettings(ctx _context.Context) (GlobalIn var v JSONAPIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr } newErr.ErrorModel = v - return localVarReturnValue, localVarHTTPResponse, newErr + 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 localVarReturnValue, localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr } newErr.ErrorModel = v } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := datadog.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr } - return localVarReturnValue, localVarHTTPResponse, nil -} - -// 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 + return localVarHTTPResponse, 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) { +// 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) { var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue IncidentResponse - optionalParams GetIncidentOptionalParameters + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} ) - if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetIncidentOptionalParameters is allowed") - } - if len(o) == 1 { - optionalParams = o[0] - } - - operationId := "v2.GetIncident" + operationId := "v2.DeleteIncident" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} } if isOperationEnabled && a.Client.Cfg.Debug { _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncident") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncident") if err != nil { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } localVarPath := localBasePath + "/api/v2/incidents/{incident_id}" @@ -2307,15 +2369,12 @@ func (a *IncidentsApi) GetIncident(ctx _context.Context, incidentId string, o .. localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "csv")) - } - localVarHeaderParams["Accept"] = "application/json" + localVarHeaderParams["Accept"] = "*/*" if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { - return localVarReturnValue, nil, err + return nil, err } } else { datadog.SetAuthKeys( @@ -2327,17 +2386,17 @@ func (a *IncidentsApi) GetIncident(ctx _context.Context, incidentId string, o .. } req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) if err != nil { - return localVarReturnValue, nil, err + return nil, err } localVarHTTPResponse, err := a.Client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err + return localVarHTTPResponse, err } localVarBody, err := datadog.ReadBody(localVarHTTPResponse) if err != nil { - return localVarReturnValue, localVarHTTPResponse, err + return localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -2349,61 +2408,51 @@ func (a *IncidentsApi) GetIncident(ctx _context.Context, incidentId string, o .. var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr } newErr.ErrorModel = v } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := datadog.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr } - return localVarReturnValue, localVarHTTPResponse, nil + return localVarHTTPResponse, nil } -// GetIncidentIntegration Get incident integration metadata details. -// Get incident integration metadata details. -func (a *IncidentsApi) GetIncidentIntegration(ctx _context.Context, incidentId string, integrationMetadataId string) (IncidentIntegrationMetadataResponse, *_nethttp.Response, error) { +// DeleteIncidentAttachment Delete incident attachment. + +func (a *IncidentsApi) DeleteIncidentAttachment(ctx _context.Context, incidentId string, attachmentId string) (*_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodGet - localVarPostBody interface{} - localVarReturnValue IncidentIntegrationMetadataResponse + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} ) - operationId := "v2.GetIncidentIntegration" + operationId := "v2.DeleteIncidentAttachment" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} } if isOperationEnabled && a.Client.Cfg.Debug { _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentIntegration") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentAttachment") if err != nil { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}" + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/attachments/{attachment_id}" localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) - localVarPath = datadog.ReplacePathParameter(localVarPath, "{integration_metadata_id}", _neturl.PathEscape(datadog.ParameterToString(integrationMetadataId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{attachment_id}", _neturl.PathEscape(datadog.ParameterToString(attachmentId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "application/json" + localVarHeaderParams["Accept"] = "*/*" if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { - return localVarReturnValue, nil, err + return nil, err } } else { datadog.SetAuthKeys( @@ -2415,17 +2464,17 @@ func (a *IncidentsApi) GetIncidentIntegration(ctx _context.Context, incidentId s } req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) if err != nil { - return localVarReturnValue, nil, err + return nil, err } localVarHTTPResponse, err := a.Client.CallAPI(req) if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err + return localVarHTTPResponse, err } localVarBody, err := datadog.ReadBody(localVarHTTPResponse) if err != nil { - return localVarReturnValue, localVarHTTPResponse, err + return localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { @@ -2433,64 +2482,3622 @@ func (a *IncidentsApi) GetIncidentIntegration(ctx _context.Context, incidentId s ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr } newErr.ErrorModel = v } - return localVarReturnValue, localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr } - err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + return localVarHTTPResponse, nil +} + +// DeleteIncidentImpact Delete an incident impact. +// Delete an incident impact. +func (a *IncidentsApi) DeleteIncidentImpact(ctx _context.Context, incidentId string, impactId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentImpact") if err != nil { - newErr := datadog.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - return localVarReturnValue, localVarHTTPResponse, nil -} + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/impacts/{impact_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{impact_id}", _neturl.PathEscape(datadog.ParameterToString(impactId, ""))) -// GetIncidentNotificationRuleOptionalParameters holds optional parameters for GetIncidentNotificationRule. -type GetIncidentNotificationRuleOptionalParameters struct { - Include *string + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// DeleteIncidentImpactField Delete an incident impact field. +// Delete an impact field for incidents. +func (a *IncidentsApi) DeleteIncidentImpactField(ctx _context.Context, fieldId uuid.UUID) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteIncidentImpactField" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentImpactField") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/impact-fields/{field_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{field_id}", _neturl.PathEscape(datadog.ParameterToString(fieldId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// DeleteIncidentIntegration Delete an incident integration metadata. +// Delete an incident integration metadata. +func (a *IncidentsApi) DeleteIncidentIntegration(ctx _context.Context, incidentId string, integrationMetadataId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteIncidentIntegration" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentIntegration") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{integration_metadata_id}", _neturl.PathEscape(datadog.ParameterToString(integrationMetadataId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// DeleteIncidentNotificationRuleOptionalParameters holds optional parameters for DeleteIncidentNotificationRule. +type DeleteIncidentNotificationRuleOptionalParameters struct { + Include *string +} + +// NewDeleteIncidentNotificationRuleOptionalParameters creates an empty struct for parameters. +func NewDeleteIncidentNotificationRuleOptionalParameters() *DeleteIncidentNotificationRuleOptionalParameters { + this := DeleteIncidentNotificationRuleOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *DeleteIncidentNotificationRuleOptionalParameters) WithInclude(include string) *DeleteIncidentNotificationRuleOptionalParameters { + r.Include = &include + return r +} + +// DeleteIncidentNotificationRule Delete an incident notification rule. +// Deletes a notification rule by its ID. +func (a *IncidentsApi) DeleteIncidentNotificationRule(ctx _context.Context, id uuid.UUID, o ...DeleteIncidentNotificationRuleOptionalParameters) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + optionalParams DeleteIncidentNotificationRuleOptionalParameters + ) + + if len(o) > 1 { + return nil, datadog.ReportError("only one argument of type DeleteIncidentNotificationRuleOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.DeleteIncidentNotificationRule" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentNotificationRule") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/notification-rules/{id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// DeleteIncidentNotificationTemplateOptionalParameters holds optional parameters for DeleteIncidentNotificationTemplate. +type DeleteIncidentNotificationTemplateOptionalParameters struct { + Include *string +} + +// NewDeleteIncidentNotificationTemplateOptionalParameters creates an empty struct for parameters. +func NewDeleteIncidentNotificationTemplateOptionalParameters() *DeleteIncidentNotificationTemplateOptionalParameters { + this := DeleteIncidentNotificationTemplateOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *DeleteIncidentNotificationTemplateOptionalParameters) WithInclude(include string) *DeleteIncidentNotificationTemplateOptionalParameters { + r.Include = &include + return r +} + +// DeleteIncidentNotificationTemplate Delete a notification template. +// Deletes a notification template by its ID. +func (a *IncidentsApi) DeleteIncidentNotificationTemplate(ctx _context.Context, id uuid.UUID, o ...DeleteIncidentNotificationTemplateOptionalParameters) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + optionalParams DeleteIncidentNotificationTemplateOptionalParameters + ) + + if len(o) > 1 { + return nil, datadog.ReportError("only one argument of type DeleteIncidentNotificationTemplateOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.DeleteIncidentNotificationTemplate" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentNotificationTemplate") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/notification-templates/{id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// DeleteIncidentPostmortemTemplate Delete postmortem template. +// Delete a postmortem template. +func (a *IncidentsApi) DeleteIncidentPostmortemTemplate(ctx _context.Context, templateId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteIncidentPostmortemTemplate" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentPostmortemTemplate") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/postmortem-templates/{template_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{template_id}", _neturl.PathEscape(datadog.ParameterToString(templateId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + 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 +} + +// DeleteIncidentResponder Delete an incident responder. +// Remove a responder from an incident. +func (a *IncidentsApi) DeleteIncidentResponder(ctx _context.Context, incidentId string, responderId uuid.UUID) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteIncidentResponder" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentResponder") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/responders/{responder_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{responder_id}", _neturl.PathEscape(datadog.ParameterToString(responderId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// DeleteIncidentRule Delete an incident rule. +// Delete an incident rule. +func (a *IncidentsApi) DeleteIncidentRule(ctx _context.Context, ruleId uuid.UUID) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteIncidentRule" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentRule") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/rules/{rule_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{rule_id}", _neturl.PathEscape(datadog.ParameterToString(ruleId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// DeleteIncidentTodo Delete an incident todo. +// Delete an incident todo. +func (a *IncidentsApi) DeleteIncidentTodo(ctx _context.Context, incidentId string, todoId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteIncidentTodo" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentTodo") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{todo_id}", _neturl.PathEscape(datadog.ParameterToString(todoId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// DeleteIncidentType Delete an incident type. +// Delete an incident type. +func (a *IncidentsApi) DeleteIncidentType(ctx _context.Context, incidentTypeId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteIncidentType" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentType") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/types/{incident_type_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_type_id}", _neturl.PathEscape(datadog.ParameterToString(incidentTypeId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// DeleteIncidentUserDefinedField Delete an incident user-defined field. +// Delete an incident user-defined field. +func (a *IncidentsApi) DeleteIncidentUserDefinedField(ctx _context.Context, fieldId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteIncidentUserDefinedField" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentUserDefinedField") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/user-defined-fields/{field_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{field_id}", _neturl.PathEscape(datadog.ParameterToString(fieldId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + 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 || localVarHTTPResponse.StatusCode == 403 || 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 +} + +// DeleteIncidentUserDefinedRole Delete an incident user-defined role. +// Delete an existing user-defined role for incidents. +func (a *IncidentsApi) DeleteIncidentUserDefinedRole(ctx _context.Context, roleId uuid.UUID) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteIncidentUserDefinedRole" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteIncidentUserDefinedRole") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/user-defined-roles/{role_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{role_id}", _neturl.PathEscape(datadog.ParameterToString(roleId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + 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 +} + +// DeleteTimestampOverride Delete an incident timestamp override. +// Delete a timestamp override for an incident. +func (a *IncidentsApi) DeleteTimestampOverride(ctx _context.Context, incidentId string, id uuid.UUID) (IncidentTimestampOverrideResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarReturnValue IncidentTimestampOverrideResponse + ) + + operationId := "v2.DeleteTimestampOverride" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.DeleteTimestampOverride") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/timestamp-overrides/{id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetGlobalIncidentSettings Get global incident settings. +// Retrieve global incident settings for the organization. +func (a *IncidentsApi) GetGlobalIncidentSettings(ctx _context.Context) (GlobalIncidentSettingsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue GlobalIncidentSettingsResponse + ) + + operationId := "v2.GetGlobalIncidentSettings" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetGlobalIncidentSettings") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/global/settings" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// 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 +} + +// 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) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentResponse + optionalParams GetIncidentOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetIncidentOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.GetIncident" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncident") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "csv")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetIncidentAIPostmortem Get an AI-generated incident postmortem. +// Generate an AI postmortem for an incident. +func (a *IncidentsApi) GetIncidentAIPostmortem(ctx _context.Context, incidentId string) (IncidentAIPostmortemResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentAIPostmortemResponse + ) + + operationId := "v2.GetIncidentAIPostmortem" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentAIPostmortem") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/ai/postmortem" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetIncidentIntegration Get incident integration metadata details. +// Get incident integration metadata details. +func (a *IncidentsApi) GetIncidentIntegration(ctx _context.Context, incidentId string, integrationMetadataId string) (IncidentIntegrationMetadataResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentIntegrationMetadataResponse + ) + + operationId := "v2.GetIncidentIntegration" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentIntegration") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{integration_metadata_id}", _neturl.PathEscape(datadog.ParameterToString(integrationMetadataId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetIncidentNotificationRuleOptionalParameters holds optional parameters for GetIncidentNotificationRule. +type GetIncidentNotificationRuleOptionalParameters struct { + Include *string +} + +// NewGetIncidentNotificationRuleOptionalParameters creates an empty struct for parameters. +func NewGetIncidentNotificationRuleOptionalParameters() *GetIncidentNotificationRuleOptionalParameters { + this := GetIncidentNotificationRuleOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *GetIncidentNotificationRuleOptionalParameters) WithInclude(include string) *GetIncidentNotificationRuleOptionalParameters { + r.Include = &include + return r +} + +// GetIncidentNotificationRule Get an incident notification rule. +// Retrieves a specific notification rule by its ID. +func (a *IncidentsApi) GetIncidentNotificationRule(ctx _context.Context, id uuid.UUID, o ...GetIncidentNotificationRuleOptionalParameters) (IncidentNotificationRule, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentNotificationRule + optionalParams GetIncidentNotificationRuleOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetIncidentNotificationRuleOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.GetIncidentNotificationRule" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentNotificationRule") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/notification-rules/{id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetIncidentNotificationTemplateOptionalParameters holds optional parameters for GetIncidentNotificationTemplate. +type GetIncidentNotificationTemplateOptionalParameters struct { + Include *string +} + +// NewGetIncidentNotificationTemplateOptionalParameters creates an empty struct for parameters. +func NewGetIncidentNotificationTemplateOptionalParameters() *GetIncidentNotificationTemplateOptionalParameters { + this := GetIncidentNotificationTemplateOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *GetIncidentNotificationTemplateOptionalParameters) WithInclude(include string) *GetIncidentNotificationTemplateOptionalParameters { + r.Include = &include + return r +} + +// GetIncidentNotificationTemplate Get incident notification template. +// Retrieves a specific notification template by its ID. +func (a *IncidentsApi) GetIncidentNotificationTemplate(ctx _context.Context, id uuid.UUID, o ...GetIncidentNotificationTemplateOptionalParameters) (IncidentNotificationTemplate, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentNotificationTemplate + optionalParams GetIncidentNotificationTemplateOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetIncidentNotificationTemplateOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.GetIncidentNotificationTemplate" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentNotificationTemplate") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/notification-templates/{id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetIncidentPostmortemTemplate Get postmortem template. +// Retrieve details of a specific postmortem template. +func (a *IncidentsApi) GetIncidentPostmortemTemplate(ctx _context.Context, templateId string) (PostmortemTemplateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue PostmortemTemplateResponse + ) + + operationId := "v2.GetIncidentPostmortemTemplate" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentPostmortemTemplate") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/postmortem-templates/{template_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{template_id}", _neturl.PathEscape(datadog.ParameterToString(templateId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetIncidentResponder Get an incident responder. +// Get a single responder for an incident. +func (a *IncidentsApi) GetIncidentResponder(ctx _context.Context, incidentId string, responderId uuid.UUID) (IncidentResponderResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentResponderResponse + ) + + operationId := "v2.GetIncidentResponder" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentResponder") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/responders/{responder_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{responder_id}", _neturl.PathEscape(datadog.ParameterToString(responderId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetIncidentRule Get an incident rule. +// Get a single incident rule by ID. +func (a *IncidentsApi) GetIncidentRule(ctx _context.Context, ruleId uuid.UUID) (IncidentRuleResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentRuleResponse + ) + + operationId := "v2.GetIncidentRule" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentRule") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/rules/{rule_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{rule_id}", _neturl.PathEscape(datadog.ParameterToString(ruleId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetIncidentTodo Get incident todo details. +// Get incident todo details. +func (a *IncidentsApi) GetIncidentTodo(ctx _context.Context, incidentId string, todoId string) (IncidentTodoResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentTodoResponse + ) + + operationId := "v2.GetIncidentTodo" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentTodo") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{todo_id}", _neturl.PathEscape(datadog.ParameterToString(todoId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetIncidentType Get incident type details. +// Get incident type details. +func (a *IncidentsApi) GetIncidentType(ctx _context.Context, incidentTypeId string) (IncidentTypeResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentTypeResponse + ) + + operationId := "v2.GetIncidentType" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentType") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/types/{incident_type_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_type_id}", _neturl.PathEscape(datadog.ParameterToString(incidentTypeId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetIncidentUserDefinedFieldOptionalParameters holds optional parameters for GetIncidentUserDefinedField. +type GetIncidentUserDefinedFieldOptionalParameters struct { + Include *string +} + +// NewGetIncidentUserDefinedFieldOptionalParameters creates an empty struct for parameters. +func NewGetIncidentUserDefinedFieldOptionalParameters() *GetIncidentUserDefinedFieldOptionalParameters { + this := GetIncidentUserDefinedFieldOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *GetIncidentUserDefinedFieldOptionalParameters) WithInclude(include string) *GetIncidentUserDefinedFieldOptionalParameters { + r.Include = &include + return r +} + +// GetIncidentUserDefinedField Get an incident user-defined field. +// Get details of an incident user-defined field. +func (a *IncidentsApi) GetIncidentUserDefinedField(ctx _context.Context, fieldId string, o ...GetIncidentUserDefinedFieldOptionalParameters) (IncidentUserDefinedFieldResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentUserDefinedFieldResponse + optionalParams GetIncidentUserDefinedFieldOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetIncidentUserDefinedFieldOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.GetIncidentUserDefinedField" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentUserDefinedField") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/user-defined-fields/{field_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{field_id}", _neturl.PathEscape(datadog.ParameterToString(fieldId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetIncidentUserDefinedRoleOptionalParameters holds optional parameters for GetIncidentUserDefinedRole. +type GetIncidentUserDefinedRoleOptionalParameters struct { + Include *string +} + +// NewGetIncidentUserDefinedRoleOptionalParameters creates an empty struct for parameters. +func NewGetIncidentUserDefinedRoleOptionalParameters() *GetIncidentUserDefinedRoleOptionalParameters { + this := GetIncidentUserDefinedRoleOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *GetIncidentUserDefinedRoleOptionalParameters) WithInclude(include string) *GetIncidentUserDefinedRoleOptionalParameters { + r.Include = &include + return r +} + +// GetIncidentUserDefinedRole Get an incident user-defined role. +// Retrieve a single user-defined role for incidents. +func (a *IncidentsApi) GetIncidentUserDefinedRole(ctx _context.Context, roleId uuid.UUID, o ...GetIncidentUserDefinedRoleOptionalParameters) (IncidentUserDefinedRoleResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentUserDefinedRoleResponse + optionalParams GetIncidentUserDefinedRoleOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetIncidentUserDefinedRoleOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.GetIncidentUserDefinedRole" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentUserDefinedRole") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/user-defined-roles/{role_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{role_id}", _neturl.PathEscape(datadog.ParameterToString(roleId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetOrgSettingsByIncidentTypeOptionalParameters holds optional parameters for GetOrgSettingsByIncidentType. +type GetOrgSettingsByIncidentTypeOptionalParameters struct { + Include *string +} + +// NewGetOrgSettingsByIncidentTypeOptionalParameters creates an empty struct for parameters. +func NewGetOrgSettingsByIncidentTypeOptionalParameters() *GetOrgSettingsByIncidentTypeOptionalParameters { + this := GetOrgSettingsByIncidentTypeOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *GetOrgSettingsByIncidentTypeOptionalParameters) WithInclude(include string) *GetOrgSettingsByIncidentTypeOptionalParameters { + r.Include = &include + return r +} + +// GetOrgSettingsByIncidentType Get org settings by incident type. +// Get the org settings for a specific incident type. +func (a *IncidentsApi) GetOrgSettingsByIncidentType(ctx _context.Context, incidentTypeId uuid.UUID, o ...GetOrgSettingsByIncidentTypeOptionalParameters) (IncidentOrgSettingsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentOrgSettingsResponse + optionalParams GetOrgSettingsByIncidentTypeOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetOrgSettingsByIncidentTypeOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.GetOrgSettingsByIncidentType" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetOrgSettingsByIncidentType") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/types/{incident_type_id}/org-settings" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_type_id}", _neturl.PathEscape(datadog.ParameterToString(incidentTypeId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ImportIncidentOptionalParameters holds optional parameters for ImportIncident. +type ImportIncidentOptionalParameters struct { + Include *[]IncidentImportRelatedObject +} + +// NewImportIncidentOptionalParameters creates an empty struct for parameters. +func NewImportIncidentOptionalParameters() *ImportIncidentOptionalParameters { + this := ImportIncidentOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *ImportIncidentOptionalParameters) WithInclude(include []IncidentImportRelatedObject) *ImportIncidentOptionalParameters { + r.Include = &include + return r +} + +// ImportIncident Import an incident. +// Import an incident from an external system. This endpoint allows you to create incidents with +// historical data such as custom timestamps for detection, declaration, and resolution. +// Imported incidents do not execute integrations or notification rules. +func (a *IncidentsApi) ImportIncident(ctx _context.Context, body IncidentImportRequest, o ...ImportIncidentOptionalParameters) (IncidentImportResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentImportResponse + optionalParams ImportIncidentOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ImportIncidentOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ImportIncident" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ImportIncident") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/import" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "csv")) + } + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// LinkPageToIncident Link a page to an incident. +// Link an existing on-call page to an incident. +func (a *IncidentsApi) LinkPageToIncident(ctx _context.Context, incidentId string, body IncidentOnCallPageLinkRequest) (IncidentIntegrationMetadataResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue IncidentIntegrationMetadataResponse + ) + + operationId := "v2.LinkPageToIncident" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.LinkPageToIncident") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/pages/link" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListGlobalIncidentHandlesOptionalParameters holds optional parameters for ListGlobalIncidentHandles. +type ListGlobalIncidentHandlesOptionalParameters struct { + Include *string +} + +// NewListGlobalIncidentHandlesOptionalParameters creates an empty struct for parameters. +func NewListGlobalIncidentHandlesOptionalParameters() *ListGlobalIncidentHandlesOptionalParameters { + this := ListGlobalIncidentHandlesOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *ListGlobalIncidentHandlesOptionalParameters) WithInclude(include string) *ListGlobalIncidentHandlesOptionalParameters { + r.Include = &include + return r +} + +// ListGlobalIncidentHandles List global incident handles. +// Retrieve a list of global incident handles. +func (a *IncidentsApi) ListGlobalIncidentHandles(ctx _context.Context, o ...ListGlobalIncidentHandlesOptionalParameters) (IncidentHandlesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentHandlesResponse + optionalParams ListGlobalIncidentHandlesOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListGlobalIncidentHandlesOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ListGlobalIncidentHandles" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListGlobalIncidentHandles") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/global/incident-handles" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListIncidentAttachmentsOptionalParameters holds optional parameters for ListIncidentAttachments. +type ListIncidentAttachmentsOptionalParameters struct { + FilterAttachmentType *string + Include *string +} + +// NewListIncidentAttachmentsOptionalParameters creates an empty struct for parameters. +func NewListIncidentAttachmentsOptionalParameters() *ListIncidentAttachmentsOptionalParameters { + this := ListIncidentAttachmentsOptionalParameters{} + return &this +} + +// WithFilterAttachmentType sets the corresponding parameter name and returns the struct. +func (r *ListIncidentAttachmentsOptionalParameters) WithFilterAttachmentType(filterAttachmentType string) *ListIncidentAttachmentsOptionalParameters { + r.FilterAttachmentType = &filterAttachmentType + return r +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *ListIncidentAttachmentsOptionalParameters) WithInclude(include string) *ListIncidentAttachmentsOptionalParameters { + r.Include = &include + return r +} + +// ListIncidentAttachments List incident attachments. +// List incident attachments. +func (a *IncidentsApi) ListIncidentAttachments(ctx _context.Context, incidentId string, o ...ListIncidentAttachmentsOptionalParameters) (AttachmentArray, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue AttachmentArray + optionalParams ListIncidentAttachmentsOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentAttachmentsOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ListIncidentAttachments" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentAttachments") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/attachments" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.FilterAttachmentType != nil { + localVarQueryParams.Add("filter[attachment_type]", datadog.ParameterToString(*optionalParams.FilterAttachmentType, "")) + } + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListIncidentImpactFields List incident impact fields. +// List all impact fields for incidents. +func (a *IncidentsApi) ListIncidentImpactFields(ctx _context.Context) (IncidentImpactFieldsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentImpactFieldsResponse + ) + + operationId := "v2.ListIncidentImpactFields" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentImpactFields") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/impact-fields" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListIncidentImpactsOptionalParameters holds optional parameters for ListIncidentImpacts. +type ListIncidentImpactsOptionalParameters struct { + Include *[]IncidentImpactRelatedObject +} + +// NewListIncidentImpactsOptionalParameters creates an empty struct for parameters. +func NewListIncidentImpactsOptionalParameters() *ListIncidentImpactsOptionalParameters { + this := ListIncidentImpactsOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *ListIncidentImpactsOptionalParameters) WithInclude(include []IncidentImpactRelatedObject) *ListIncidentImpactsOptionalParameters { + r.Include = &include + return r +} + +// ListIncidentImpacts List an incident's impacts. +// Get all impacts for an incident. +func (a *IncidentsApi) ListIncidentImpacts(ctx _context.Context, incidentId string, o ...ListIncidentImpactsOptionalParameters) (IncidentImpactsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentImpactsResponse + optionalParams ListIncidentImpactsOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentImpactsOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentImpacts") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/impacts" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "csv")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListIncidentIntegrations Get a list of an incident's integration metadata. +// Get all integration metadata for an incident. +func (a *IncidentsApi) ListIncidentIntegrations(ctx _context.Context, incidentId string) (IncidentIntegrationMetadataListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentIntegrationMetadataListResponse + ) + + operationId := "v2.ListIncidentIntegrations" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentIntegrations") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/integrations" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListIncidentNotificationRulesOptionalParameters holds optional parameters for ListIncidentNotificationRules. +type ListIncidentNotificationRulesOptionalParameters struct { + Include *string +} + +// NewListIncidentNotificationRulesOptionalParameters creates an empty struct for parameters. +func NewListIncidentNotificationRulesOptionalParameters() *ListIncidentNotificationRulesOptionalParameters { + this := ListIncidentNotificationRulesOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *ListIncidentNotificationRulesOptionalParameters) WithInclude(include string) *ListIncidentNotificationRulesOptionalParameters { + r.Include = &include + return r +} + +// ListIncidentNotificationRules List incident notification rules. +// Lists all notification rules for the organization. Optionally filter by incident type. +func (a *IncidentsApi) ListIncidentNotificationRules(ctx _context.Context, o ...ListIncidentNotificationRulesOptionalParameters) (IncidentNotificationRuleArray, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentNotificationRuleArray + optionalParams ListIncidentNotificationRulesOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentNotificationRulesOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ListIncidentNotificationRules" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentNotificationRules") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/notification-rules" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListIncidentNotificationTemplatesOptionalParameters holds optional parameters for ListIncidentNotificationTemplates. +type ListIncidentNotificationTemplatesOptionalParameters struct { + FilterIncidentType *uuid.UUID + Include *string +} + +// NewListIncidentNotificationTemplatesOptionalParameters creates an empty struct for parameters. +func NewListIncidentNotificationTemplatesOptionalParameters() *ListIncidentNotificationTemplatesOptionalParameters { + this := ListIncidentNotificationTemplatesOptionalParameters{} + return &this +} + +// WithFilterIncidentType sets the corresponding parameter name and returns the struct. +func (r *ListIncidentNotificationTemplatesOptionalParameters) WithFilterIncidentType(filterIncidentType uuid.UUID) *ListIncidentNotificationTemplatesOptionalParameters { + r.FilterIncidentType = &filterIncidentType + return r +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *ListIncidentNotificationTemplatesOptionalParameters) WithInclude(include string) *ListIncidentNotificationTemplatesOptionalParameters { + r.Include = &include + return r } -// NewGetIncidentNotificationRuleOptionalParameters creates an empty struct for parameters. -func NewGetIncidentNotificationRuleOptionalParameters() *GetIncidentNotificationRuleOptionalParameters { - this := GetIncidentNotificationRuleOptionalParameters{} - return &this -} +// ListIncidentNotificationTemplates List incident notification templates. +// Lists all notification templates. Optionally filter by incident type. +func (a *IncidentsApi) ListIncidentNotificationTemplates(ctx _context.Context, o ...ListIncidentNotificationTemplatesOptionalParameters) (IncidentNotificationTemplateArray, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentNotificationTemplateArray + optionalParams ListIncidentNotificationTemplatesOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentNotificationTemplatesOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ListIncidentNotificationTemplates" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentNotificationTemplates") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/notification-templates" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.FilterIncidentType != nil { + localVarQueryParams.Add("filter[incident-type]", datadog.ParameterToString(*optionalParams.FilterIncidentType, "")) + } + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *GetIncidentNotificationRuleOptionalParameters) WithInclude(include string) *GetIncidentNotificationRuleOptionalParameters { - r.Include = &include - return r + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil } -// GetIncidentNotificationRule Get an incident notification rule. -// Retrieves a specific notification rule by its ID. -func (a *IncidentsApi) GetIncidentNotificationRule(ctx _context.Context, id uuid.UUID, o ...GetIncidentNotificationRuleOptionalParameters) (IncidentNotificationRule, *_nethttp.Response, error) { +// ListIncidentPostmortemTemplates List postmortem templates. +// Retrieve a list of all postmortem templates for incidents. +func (a *IncidentsApi) ListIncidentPostmortemTemplates(ctx _context.Context) (PostmortemTemplatesResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} - localVarReturnValue IncidentNotificationRule - optionalParams GetIncidentNotificationRuleOptionalParameters + localVarReturnValue PostmortemTemplatesResponse ) - if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetIncidentNotificationRuleOptionalParameters is allowed") + operationId := "v2.ListIncidentPostmortemTemplates" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} } - if len(o) == 1 { - optionalParams = o[0] + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - operationId := "v2.GetIncidentNotificationRule" + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentPostmortemTemplates") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/incidents/config/postmortem-templates" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListIncidentResponders List incident responders. +// List all responders for an incident. +func (a *IncidentsApi) ListIncidentResponders(ctx _context.Context, incidentId string) (IncidentRespondersResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue IncidentRespondersResponse + ) + + operationId := "v2.ListIncidentResponders" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -2499,20 +6106,17 @@ func (a *IncidentsApi) GetIncidentNotificationRule(ctx _context.Context, id uuid _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentNotificationRule") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentResponders") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/notification-rules/{id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/responders" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) - } localVarHeaderParams["Accept"] = "application/json" if a.Client.Cfg.DelegatedTokenConfig != nil { @@ -2571,41 +6175,55 @@ func (a *IncidentsApi) GetIncidentNotificationRule(ctx _context.Context, id uuid return localVarReturnValue, localVarHTTPResponse, nil } -// GetIncidentNotificationTemplateOptionalParameters holds optional parameters for GetIncidentNotificationTemplate. -type GetIncidentNotificationTemplateOptionalParameters struct { - Include *string +// ListIncidentRulesOptionalParameters holds optional parameters for ListIncidentRules. +type ListIncidentRulesOptionalParameters struct { + FilterTaskId *string + FilterTrigger *string + IncidentTypeUuid *uuid.UUID } -// NewGetIncidentNotificationTemplateOptionalParameters creates an empty struct for parameters. -func NewGetIncidentNotificationTemplateOptionalParameters() *GetIncidentNotificationTemplateOptionalParameters { - this := GetIncidentNotificationTemplateOptionalParameters{} +// NewListIncidentRulesOptionalParameters creates an empty struct for parameters. +func NewListIncidentRulesOptionalParameters() *ListIncidentRulesOptionalParameters { + this := ListIncidentRulesOptionalParameters{} return &this } -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *GetIncidentNotificationTemplateOptionalParameters) WithInclude(include string) *GetIncidentNotificationTemplateOptionalParameters { - r.Include = &include +// WithFilterTaskId sets the corresponding parameter name and returns the struct. +func (r *ListIncidentRulesOptionalParameters) WithFilterTaskId(filterTaskId string) *ListIncidentRulesOptionalParameters { + r.FilterTaskId = &filterTaskId return r } -// GetIncidentNotificationTemplate Get incident notification template. -// Retrieves a specific notification template by its ID. -func (a *IncidentsApi) GetIncidentNotificationTemplate(ctx _context.Context, id uuid.UUID, o ...GetIncidentNotificationTemplateOptionalParameters) (IncidentNotificationTemplate, *_nethttp.Response, error) { +// WithFilterTrigger sets the corresponding parameter name and returns the struct. +func (r *ListIncidentRulesOptionalParameters) WithFilterTrigger(filterTrigger string) *ListIncidentRulesOptionalParameters { + r.FilterTrigger = &filterTrigger + return r +} + +// WithIncidentTypeUuid sets the corresponding parameter name and returns the struct. +func (r *ListIncidentRulesOptionalParameters) WithIncidentTypeUuid(incidentTypeUuid uuid.UUID) *ListIncidentRulesOptionalParameters { + r.IncidentTypeUuid = &incidentTypeUuid + return r +} + +// ListIncidentRules List incident rules. +// List all incident rules. +func (a *IncidentsApi) ListIncidentRules(ctx _context.Context, o ...ListIncidentRulesOptionalParameters) (IncidentRulesResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} - localVarReturnValue IncidentNotificationTemplate - optionalParams GetIncidentNotificationTemplateOptionalParameters + localVarReturnValue IncidentRulesResponse + optionalParams ListIncidentRulesOptionalParameters ) if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetIncidentNotificationTemplateOptionalParameters is allowed") + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentRulesOptionalParameters is allowed") } if len(o) == 1 { optionalParams = o[0] } - operationId := "v2.GetIncidentNotificationTemplate" + operationId := "v2.ListIncidentRules" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -2614,19 +6232,24 @@ func (a *IncidentsApi) GetIncidentNotificationTemplate(ctx _context.Context, id _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentNotificationTemplate") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentRules") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/notification-templates/{id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/rules" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + if optionalParams.FilterTaskId != nil { + localVarQueryParams.Add("filter[task_id]", datadog.ParameterToString(*optionalParams.FilterTaskId, "")) + } + if optionalParams.FilterTrigger != nil { + localVarQueryParams.Add("filter[trigger]", datadog.ParameterToString(*optionalParams.FilterTrigger, "")) + } + if optionalParams.IncidentTypeUuid != nil { + localVarQueryParams.Add("incidentTypeUUID", datadog.ParameterToString(*optionalParams.IncidentTypeUuid, "")) } localVarHeaderParams["Accept"] = "application/json" @@ -2663,7 +6286,7 @@ func (a *IncidentsApi) GetIncidentNotificationTemplate(ctx _context.Context, id ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -2686,16 +6309,16 @@ func (a *IncidentsApi) GetIncidentNotificationTemplate(ctx _context.Context, id return localVarReturnValue, localVarHTTPResponse, nil } -// GetIncidentPostmortemTemplate Get postmortem template. -// Retrieve details of a specific postmortem template. -func (a *IncidentsApi) GetIncidentPostmortemTemplate(ctx _context.Context, templateId string) (PostmortemTemplateResponse, *_nethttp.Response, error) { +// ListIncidentTodos Get a list of an incident's todos. +// Get all todos for an incident. +func (a *IncidentsApi) ListIncidentTodos(ctx _context.Context, incidentId string) (IncidentTodoListResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} - localVarReturnValue PostmortemTemplateResponse + localVarReturnValue IncidentTodoListResponse ) - operationId := "v2.GetIncidentPostmortemTemplate" + operationId := "v2.ListIncidentTodos" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -2704,13 +6327,13 @@ func (a *IncidentsApi) GetIncidentPostmortemTemplate(ctx _context.Context, templ _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentPostmortemTemplate") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentTodos") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/postmortem-templates/{template_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{template_id}", _neturl.PathEscape(datadog.ParameterToString(templateId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/todos" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2750,16 +6373,7 @@ func (a *IncidentsApi) GetIncidentPostmortemTemplate(ctx _context.Context, templ ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -2782,16 +6396,41 @@ func (a *IncidentsApi) GetIncidentPostmortemTemplate(ctx _context.Context, templ return localVarReturnValue, localVarHTTPResponse, nil } -// GetIncidentTodo Get incident todo details. -// Get incident todo details. -func (a *IncidentsApi) GetIncidentTodo(ctx _context.Context, incidentId string, todoId string) (IncidentTodoResponse, *_nethttp.Response, error) { +// ListIncidentTypesOptionalParameters holds optional parameters for ListIncidentTypes. +type ListIncidentTypesOptionalParameters struct { + IncludeDeleted *bool +} + +// NewListIncidentTypesOptionalParameters creates an empty struct for parameters. +func NewListIncidentTypesOptionalParameters() *ListIncidentTypesOptionalParameters { + this := ListIncidentTypesOptionalParameters{} + return &this +} + +// WithIncludeDeleted sets the corresponding parameter name and returns the struct. +func (r *ListIncidentTypesOptionalParameters) WithIncludeDeleted(includeDeleted bool) *ListIncidentTypesOptionalParameters { + r.IncludeDeleted = &includeDeleted + return r +} + +// ListIncidentTypes Get a list of incident types. +// Get all incident types. +func (a *IncidentsApi) ListIncidentTypes(ctx _context.Context, o ...ListIncidentTypesOptionalParameters) (IncidentTypeListResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} - localVarReturnValue IncidentTodoResponse + localVarReturnValue IncidentTypeListResponse + optionalParams ListIncidentTypesOptionalParameters ) - operationId := "v2.GetIncidentTodo" + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentTypesOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ListIncidentTypes" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -2800,18 +6439,19 @@ func (a *IncidentsApi) GetIncidentTodo(ctx _context.Context, incidentId string, _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentTodo") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentTypes") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) - localVarPath = datadog.ReplacePathParameter(localVarPath, "{todo_id}", _neturl.PathEscape(datadog.ParameterToString(todoId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/types" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if optionalParams.IncludeDeleted != nil { + localVarQueryParams.Add("include_deleted", datadog.ParameterToString(*optionalParams.IncludeDeleted, "")) + } localVarHeaderParams["Accept"] = "application/json" if a.Client.Cfg.DelegatedTokenConfig != nil { @@ -2847,7 +6487,7 @@ func (a *IncidentsApi) GetIncidentTodo(ctx _context.Context, incidentId string, ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -2870,16 +6510,69 @@ func (a *IncidentsApi) GetIncidentTodo(ctx _context.Context, incidentId string, return localVarReturnValue, localVarHTTPResponse, nil } -// GetIncidentType Get incident type details. -// Get incident type details. -func (a *IncidentsApi) GetIncidentType(ctx _context.Context, incidentTypeId string) (IncidentTypeResponse, *_nethttp.Response, error) { +// ListIncidentUserDefinedFieldsOptionalParameters holds optional parameters for ListIncidentUserDefinedFields. +type ListIncidentUserDefinedFieldsOptionalParameters struct { + PageSize *int64 + PageNumber *int64 + IncludeDeleted *bool + FilterIncidentType *string + Include *string +} + +// NewListIncidentUserDefinedFieldsOptionalParameters creates an empty struct for parameters. +func NewListIncidentUserDefinedFieldsOptionalParameters() *ListIncidentUserDefinedFieldsOptionalParameters { + this := ListIncidentUserDefinedFieldsOptionalParameters{} + return &this +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListIncidentUserDefinedFieldsOptionalParameters) WithPageSize(pageSize int64) *ListIncidentUserDefinedFieldsOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListIncidentUserDefinedFieldsOptionalParameters) WithPageNumber(pageNumber int64) *ListIncidentUserDefinedFieldsOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// WithIncludeDeleted sets the corresponding parameter name and returns the struct. +func (r *ListIncidentUserDefinedFieldsOptionalParameters) WithIncludeDeleted(includeDeleted bool) *ListIncidentUserDefinedFieldsOptionalParameters { + r.IncludeDeleted = &includeDeleted + return r +} + +// WithFilterIncidentType sets the corresponding parameter name and returns the struct. +func (r *ListIncidentUserDefinedFieldsOptionalParameters) WithFilterIncidentType(filterIncidentType string) *ListIncidentUserDefinedFieldsOptionalParameters { + r.FilterIncidentType = &filterIncidentType + return r +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *ListIncidentUserDefinedFieldsOptionalParameters) WithInclude(include string) *ListIncidentUserDefinedFieldsOptionalParameters { + r.Include = &include + return r +} + +// ListIncidentUserDefinedFields Get a list of incident user-defined fields. +// Get a list of all incident user-defined fields. +func (a *IncidentsApi) ListIncidentUserDefinedFields(ctx _context.Context, o ...ListIncidentUserDefinedFieldsOptionalParameters) (IncidentUserDefinedFieldListResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} - localVarReturnValue IncidentTypeResponse + localVarReturnValue IncidentUserDefinedFieldListResponse + optionalParams ListIncidentUserDefinedFieldsOptionalParameters ) - operationId := "v2.GetIncidentType" + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentUserDefinedFieldsOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ListIncidentUserDefinedFields" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -2888,17 +6581,31 @@ func (a *IncidentsApi) GetIncidentType(ctx _context.Context, incidentTypeId stri _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentType") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentUserDefinedFields") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/types/{incident_type_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_type_id}", _neturl.PathEscape(datadog.ParameterToString(incidentTypeId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/user-defined-fields" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if optionalParams.PageSize != nil { + localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, "")) + } + if optionalParams.PageNumber != nil { + localVarQueryParams.Add("page[number]", datadog.ParameterToString(*optionalParams.PageNumber, "")) + } + if optionalParams.IncludeDeleted != nil { + localVarQueryParams.Add("include-deleted", datadog.ParameterToString(*optionalParams.IncludeDeleted, "")) + } + if optionalParams.FilterIncidentType != nil { + localVarQueryParams.Add("filter[incident-type]", datadog.ParameterToString(*optionalParams.FilterIncidentType, "")) + } + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } localVarHeaderParams["Accept"] = "application/json" if a.Client.Cfg.DelegatedTokenConfig != nil { @@ -2934,7 +6641,16 @@ func (a *IncidentsApi) GetIncidentType(ctx _context.Context, incidentTypeId stri ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&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 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -2957,41 +6673,48 @@ func (a *IncidentsApi) GetIncidentType(ctx _context.Context, incidentTypeId stri return localVarReturnValue, localVarHTTPResponse, nil } -// GetIncidentUserDefinedFieldOptionalParameters holds optional parameters for GetIncidentUserDefinedField. -type GetIncidentUserDefinedFieldOptionalParameters struct { - Include *string +// ListIncidentUserDefinedRolesOptionalParameters holds optional parameters for ListIncidentUserDefinedRoles. +type ListIncidentUserDefinedRolesOptionalParameters struct { + FilterIncidentType *uuid.UUID + Include *string } -// NewGetIncidentUserDefinedFieldOptionalParameters creates an empty struct for parameters. -func NewGetIncidentUserDefinedFieldOptionalParameters() *GetIncidentUserDefinedFieldOptionalParameters { - this := GetIncidentUserDefinedFieldOptionalParameters{} +// NewListIncidentUserDefinedRolesOptionalParameters creates an empty struct for parameters. +func NewListIncidentUserDefinedRolesOptionalParameters() *ListIncidentUserDefinedRolesOptionalParameters { + this := ListIncidentUserDefinedRolesOptionalParameters{} return &this } +// WithFilterIncidentType sets the corresponding parameter name and returns the struct. +func (r *ListIncidentUserDefinedRolesOptionalParameters) WithFilterIncidentType(filterIncidentType uuid.UUID) *ListIncidentUserDefinedRolesOptionalParameters { + r.FilterIncidentType = &filterIncidentType + return r +} + // WithInclude sets the corresponding parameter name and returns the struct. -func (r *GetIncidentUserDefinedFieldOptionalParameters) WithInclude(include string) *GetIncidentUserDefinedFieldOptionalParameters { +func (r *ListIncidentUserDefinedRolesOptionalParameters) WithInclude(include string) *ListIncidentUserDefinedRolesOptionalParameters { r.Include = &include return r } -// GetIncidentUserDefinedField Get an incident user-defined field. -// Get details of an incident user-defined field. -func (a *IncidentsApi) GetIncidentUserDefinedField(ctx _context.Context, fieldId string, o ...GetIncidentUserDefinedFieldOptionalParameters) (IncidentUserDefinedFieldResponse, *_nethttp.Response, error) { +// ListIncidentUserDefinedRoles List incident user-defined roles. +// List all user-defined roles for incidents. +func (a *IncidentsApi) ListIncidentUserDefinedRoles(ctx _context.Context, o ...ListIncidentUserDefinedRolesOptionalParameters) (IncidentUserDefinedRolesResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} - localVarReturnValue IncidentUserDefinedFieldResponse - optionalParams GetIncidentUserDefinedFieldOptionalParameters + localVarReturnValue IncidentUserDefinedRolesResponse + optionalParams ListIncidentUserDefinedRolesOptionalParameters ) if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetIncidentUserDefinedFieldOptionalParameters is allowed") + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentUserDefinedRolesOptionalParameters is allowed") } if len(o) == 1 { optionalParams = o[0] } - operationId := "v2.GetIncidentUserDefinedField" + operationId := "v2.ListIncidentUserDefinedRoles" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -3000,17 +6723,19 @@ func (a *IncidentsApi) GetIncidentUserDefinedField(ctx _context.Context, fieldId _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.GetIncidentUserDefinedField") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentUserDefinedRoles") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/user-defined-fields/{field_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{field_id}", _neturl.PathEscape(datadog.ParameterToString(fieldId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/user-defined-roles" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if optionalParams.FilterIncidentType != nil { + localVarQueryParams.Add("filter[incident-type]", datadog.ParameterToString(*optionalParams.FilterIncidentType, "")) + } if optionalParams.Include != nil { localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) } @@ -3049,8 +6774,8 @@ func (a *IncidentsApi) GetIncidentUserDefinedField(ctx _context.Context, fieldId ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse + if localVarHTTPResponse.StatusCode == 400 { + var v JSONAPIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { return localVarReturnValue, localVarHTTPResponse, newErr @@ -3058,8 +6783,8 @@ func (a *IncidentsApi) GetIncidentUserDefinedField(ctx _context.Context, fieldId newErr.ErrorModel = v return localVarReturnValue, localVarHTTPResponse, newErr } - if localVarHTTPResponse.StatusCode == 404 { - var v JSONAPIErrorResponse + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { return localVarReturnValue, localVarHTTPResponse, newErr @@ -3081,43 +6806,55 @@ func (a *IncidentsApi) GetIncidentUserDefinedField(ctx _context.Context, fieldId return localVarReturnValue, localVarHTTPResponse, nil } -// ImportIncidentOptionalParameters holds optional parameters for ImportIncident. -type ImportIncidentOptionalParameters struct { - Include *[]IncidentImportRelatedObject +// ListIncidentsOptionalParameters holds optional parameters for ListIncidents. +type ListIncidentsOptionalParameters struct { + Include *[]IncidentRelatedObject + PageSize *int64 + PageOffset *int64 } -// NewImportIncidentOptionalParameters creates an empty struct for parameters. -func NewImportIncidentOptionalParameters() *ImportIncidentOptionalParameters { - this := ImportIncidentOptionalParameters{} +// 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 *ImportIncidentOptionalParameters) WithInclude(include []IncidentImportRelatedObject) *ImportIncidentOptionalParameters { +func (r *ListIncidentsOptionalParameters) WithInclude(include []IncidentRelatedObject) *ListIncidentsOptionalParameters { r.Include = &include return r } -// ImportIncident Import an incident. -// Import an incident from an external system. This endpoint allows you to create incidents with -// historical data such as custom timestamps for detection, declaration, and resolution. -// Imported incidents do not execute integrations or notification rules. -func (a *IncidentsApi) ImportIncident(ctx _context.Context, body IncidentImportRequest, o ...ImportIncidentOptionalParameters) (IncidentImportResponse, *_nethttp.Response, error) { +// 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 +} + +// 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) { var ( - localVarHTTPMethod = _nethttp.MethodPost + localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} - localVarReturnValue IncidentImportResponse - optionalParams ImportIncidentOptionalParameters + localVarReturnValue IncidentsResponse + optionalParams ListIncidentsOptionalParameters ) if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type ImportIncidentOptionalParameters is allowed") + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentsOptionalParameters is allowed") } if len(o) == 1 { optionalParams = o[0] } - operationId := "v2.ImportIncident" + operationId := "v2.ListIncidents" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -3126,12 +6863,12 @@ func (a *IncidentsApi) ImportIncident(ctx _context.Context, body IncidentImportR _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ImportIncident") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidents") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/import" + localVarPath := localBasePath + "/api/v2/incidents" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -3139,11 +6876,14 @@ func (a *IncidentsApi) ImportIncident(ctx _context.Context, body IncidentImportR if optionalParams.Include != nil { localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "csv")) } - localVarHeaderParams["Content-Type"] = "application/json" + if optionalParams.PageSize != nil { + localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, "")) + } + if optionalParams.PageOffset != nil { + localVarQueryParams.Add("page[offset]", datadog.ParameterToString(*optionalParams.PageOffset, "")) + } localVarHeaderParams["Accept"] = "application/json" - // body params - localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { @@ -3197,44 +6937,115 @@ func (a *IncidentsApi) ImportIncident(ctx _context.Context, body IncidentImportR return localVarReturnValue, localVarHTTPResponse, newErr } - return localVarReturnValue, localVarHTTPResponse, nil + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListIncidentsWithPagination provides a paginated version of ListIncidents returning a channel with all items. +func (a *IncidentsApi) ListIncidentsWithPagination(ctx _context.Context, o ...ListIncidentsOptionalParameters) (<-chan datadog.PaginationResult[IncidentResponseData], func()) { + 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 datadog.PaginationResult[IncidentResponseData], pageSize_) + go func() { + for { + resp, _, err := a.ListIncidents(ctx, o...) + if err != nil { + var returnItem IncidentResponseData + items <- datadog.PaginationResult[IncidentResponseData]{Item: returnItem, Error: err} + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- datadog.PaginationResult[IncidentResponseData]{Item: item, Error: nil}: + 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 +} + +// ListOrgSettingsOptionalParameters holds optional parameters for ListOrgSettings. +type ListOrgSettingsOptionalParameters struct { + PageSize *int32 + PageOffset *int32 + IncludeDeleted *bool + Include *string +} + +// NewListOrgSettingsOptionalParameters creates an empty struct for parameters. +func NewListOrgSettingsOptionalParameters() *ListOrgSettingsOptionalParameters { + this := ListOrgSettingsOptionalParameters{} + return &this +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListOrgSettingsOptionalParameters) WithPageSize(pageSize int32) *ListOrgSettingsOptionalParameters { + r.PageSize = &pageSize + return r } -// ListGlobalIncidentHandlesOptionalParameters holds optional parameters for ListGlobalIncidentHandles. -type ListGlobalIncidentHandlesOptionalParameters struct { - Include *string +// WithPageOffset sets the corresponding parameter name and returns the struct. +func (r *ListOrgSettingsOptionalParameters) WithPageOffset(pageOffset int32) *ListOrgSettingsOptionalParameters { + r.PageOffset = &pageOffset + return r } -// NewListGlobalIncidentHandlesOptionalParameters creates an empty struct for parameters. -func NewListGlobalIncidentHandlesOptionalParameters() *ListGlobalIncidentHandlesOptionalParameters { - this := ListGlobalIncidentHandlesOptionalParameters{} - return &this +// WithIncludeDeleted sets the corresponding parameter name and returns the struct. +func (r *ListOrgSettingsOptionalParameters) WithIncludeDeleted(includeDeleted bool) *ListOrgSettingsOptionalParameters { + r.IncludeDeleted = &includeDeleted + return r } // WithInclude sets the corresponding parameter name and returns the struct. -func (r *ListGlobalIncidentHandlesOptionalParameters) WithInclude(include string) *ListGlobalIncidentHandlesOptionalParameters { +func (r *ListOrgSettingsOptionalParameters) WithInclude(include string) *ListOrgSettingsOptionalParameters { r.Include = &include return r } -// ListGlobalIncidentHandles List global incident handles. -// Retrieve a list of global incident handles. -func (a *IncidentsApi) ListGlobalIncidentHandles(ctx _context.Context, o ...ListGlobalIncidentHandlesOptionalParameters) (IncidentHandlesResponse, *_nethttp.Response, error) { +// ListOrgSettings List incident type org settings. +// List org settings for all incident types. +func (a *IncidentsApi) ListOrgSettings(ctx _context.Context, o ...ListOrgSettingsOptionalParameters) (IncidentOrgSettingsListResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} - localVarReturnValue IncidentHandlesResponse - optionalParams ListGlobalIncidentHandlesOptionalParameters + localVarReturnValue IncidentOrgSettingsListResponse + optionalParams ListOrgSettingsOptionalParameters ) if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListGlobalIncidentHandlesOptionalParameters is allowed") + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListOrgSettingsOptionalParameters is allowed") } if len(o) == 1 { optionalParams = o[0] } - operationId := "v2.ListGlobalIncidentHandles" + operationId := "v2.ListOrgSettings" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -3243,16 +7054,25 @@ func (a *IncidentsApi) ListGlobalIncidentHandles(ctx _context.Context, o ...List _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListGlobalIncidentHandles") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListOrgSettings") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/global/incident-handles" + localVarPath := localBasePath + "/api/v2/incidents/config/types/org-settings" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if optionalParams.PageSize != nil { + localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, "")) + } + if optionalParams.PageOffset != nil { + localVarQueryParams.Add("page[offset]", datadog.ParameterToString(*optionalParams.PageOffset, "")) + } + if optionalParams.IncludeDeleted != nil { + localVarQueryParams.Add("include-deleted", datadog.ParameterToString(*optionalParams.IncludeDeleted, "")) + } if optionalParams.Include != nil { localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) } @@ -3291,16 +7111,7 @@ func (a *IncidentsApi) ListGlobalIncidentHandles(ctx _context.Context, o ...List ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -3323,48 +7134,16 @@ func (a *IncidentsApi) ListGlobalIncidentHandles(ctx _context.Context, o ...List return localVarReturnValue, localVarHTTPResponse, nil } -// ListIncidentAttachmentsOptionalParameters holds optional parameters for ListIncidentAttachments. -type ListIncidentAttachmentsOptionalParameters struct { - FilterAttachmentType *string - Include *string -} - -// NewListIncidentAttachmentsOptionalParameters creates an empty struct for parameters. -func NewListIncidentAttachmentsOptionalParameters() *ListIncidentAttachmentsOptionalParameters { - this := ListIncidentAttachmentsOptionalParameters{} - return &this -} - -// WithFilterAttachmentType sets the corresponding parameter name and returns the struct. -func (r *ListIncidentAttachmentsOptionalParameters) WithFilterAttachmentType(filterAttachmentType string) *ListIncidentAttachmentsOptionalParameters { - r.FilterAttachmentType = &filterAttachmentType - return r -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *ListIncidentAttachmentsOptionalParameters) WithInclude(include string) *ListIncidentAttachmentsOptionalParameters { - r.Include = &include - return r -} - -// ListIncidentAttachments List incident attachments. -// List incident attachments. -func (a *IncidentsApi) ListIncidentAttachments(ctx _context.Context, incidentId string, o ...ListIncidentAttachmentsOptionalParameters) (AttachmentArray, *_nethttp.Response, error) { +// ListTimestampOverrides List incident timestamp overrides. +// List all timestamp overrides for an incident. +func (a *IncidentsApi) ListTimestampOverrides(ctx _context.Context, incidentId string) (IncidentTimestampOverridesResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} - localVarReturnValue AttachmentArray - optionalParams ListIncidentAttachmentsOptionalParameters + localVarReturnValue IncidentTimestampOverridesResponse ) - if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentAttachmentsOptionalParameters is allowed") - } - if len(o) == 1 { - optionalParams = o[0] - } - - operationId := "v2.ListIncidentAttachments" + operationId := "v2.ListTimestampOverrides" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -3373,23 +7152,17 @@ func (a *IncidentsApi) ListIncidentAttachments(ctx _context.Context, incidentId _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentAttachments") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListTimestampOverrides") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/attachments" + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/timestamp-overrides" localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if optionalParams.FilterAttachmentType != nil { - localVarQueryParams.Add("filter[attachment_type]", datadog.ParameterToString(*optionalParams.FilterAttachmentType, "")) - } - if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) - } localVarHeaderParams["Accept"] = "application/json" if a.Client.Cfg.DelegatedTokenConfig != nil { @@ -3425,7 +7198,7 @@ func (a *IncidentsApi) ListIncidentAttachments(ctx _context.Context, incidentId ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -3448,47 +7221,57 @@ func (a *IncidentsApi) ListIncidentAttachments(ctx _context.Context, incidentId return localVarReturnValue, localVarHTTPResponse, nil } -// ListIncidentImpactsOptionalParameters holds optional parameters for ListIncidentImpacts. -type ListIncidentImpactsOptionalParameters struct { +// PatchIncidentImpactOptionalParameters holds optional parameters for PatchIncidentImpact. +type PatchIncidentImpactOptionalParameters struct { Include *[]IncidentImpactRelatedObject } -// NewListIncidentImpactsOptionalParameters creates an empty struct for parameters. -func NewListIncidentImpactsOptionalParameters() *ListIncidentImpactsOptionalParameters { - this := ListIncidentImpactsOptionalParameters{} +// NewPatchIncidentImpactOptionalParameters creates an empty struct for parameters. +func NewPatchIncidentImpactOptionalParameters() *PatchIncidentImpactOptionalParameters { + this := PatchIncidentImpactOptionalParameters{} return &this } // WithInclude sets the corresponding parameter name and returns the struct. -func (r *ListIncidentImpactsOptionalParameters) WithInclude(include []IncidentImpactRelatedObject) *ListIncidentImpactsOptionalParameters { +func (r *PatchIncidentImpactOptionalParameters) WithInclude(include []IncidentImpactRelatedObject) *PatchIncidentImpactOptionalParameters { r.Include = &include return r } -// ListIncidentImpacts List an incident's impacts. -// Get all impacts for an incident. -func (a *IncidentsApi) ListIncidentImpacts(ctx _context.Context, incidentId string, o ...ListIncidentImpactsOptionalParameters) (IncidentImpactsResponse, *_nethttp.Response, error) { +// PatchIncidentImpact Patch an incident impact. +// Partially update an incident impact. +func (a *IncidentsApi) PatchIncidentImpact(ctx _context.Context, incidentId string, impactId string, body IncidentImpactCreateRequest, o ...PatchIncidentImpactOptionalParameters) (IncidentImpactResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodGet + localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} - localVarReturnValue IncidentImpactsResponse - optionalParams ListIncidentImpactsOptionalParameters + localVarReturnValue IncidentImpactResponse + optionalParams PatchIncidentImpactOptionalParameters ) if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentImpactsOptionalParameters is allowed") + return localVarReturnValue, nil, datadog.ReportError("only one argument of type PatchIncidentImpactOptionalParameters is allowed") } if len(o) == 1 { optionalParams = o[0] } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentImpacts") + operationId := "v2.PatchIncidentImpact" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.PatchIncidentImpact") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/impacts" + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/impacts/{impact_id}" localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{impact_id}", _neturl.PathEscape(datadog.ParameterToString(impactId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -3496,8 +7279,11 @@ func (a *IncidentsApi) ListIncidentImpacts(ctx _context.Context, incidentId stri if optionalParams.Include != nil { localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "csv")) } + localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { @@ -3554,16 +7340,62 @@ func (a *IncidentsApi) ListIncidentImpacts(ctx _context.Context, incidentId stri return localVarReturnValue, localVarHTTPResponse, nil } -// ListIncidentIntegrations Get a list of an incident's integration metadata. -// Get all integration metadata for an incident. -func (a *IncidentsApi) ListIncidentIntegrations(ctx _context.Context, incidentId string) (IncidentIntegrationMetadataListResponse, *_nethttp.Response, error) { +// SearchIncidentsOptionalParameters holds optional parameters for SearchIncidents. +type SearchIncidentsOptionalParameters struct { + Include *IncidentRelatedObject + Sort *IncidentSearchSortOrder + PageSize *int64 + PageOffset *int64 +} + +// NewSearchIncidentsOptionalParameters creates an empty struct for parameters. +func NewSearchIncidentsOptionalParameters() *SearchIncidentsOptionalParameters { + this := SearchIncidentsOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *SearchIncidentsOptionalParameters) WithInclude(include IncidentRelatedObject) *SearchIncidentsOptionalParameters { + r.Include = &include + return r +} + +// WithSort sets the corresponding parameter name and returns the struct. +func (r *SearchIncidentsOptionalParameters) WithSort(sort IncidentSearchSortOrder) *SearchIncidentsOptionalParameters { + r.Sort = &sort + return r +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *SearchIncidentsOptionalParameters) WithPageSize(pageSize int64) *SearchIncidentsOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageOffset sets the corresponding parameter name and returns the struct. +func (r *SearchIncidentsOptionalParameters) WithPageOffset(pageOffset int64) *SearchIncidentsOptionalParameters { + r.PageOffset = &pageOffset + return r +} + +// SearchIncidents Search for incidents. +// Search for incidents matching a certain query. +func (a *IncidentsApi) SearchIncidents(ctx _context.Context, query string, o ...SearchIncidentsOptionalParameters) (IncidentSearchResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} - localVarReturnValue IncidentIntegrationMetadataListResponse + localVarReturnValue IncidentSearchResponse + optionalParams SearchIncidentsOptionalParameters ) - operationId := "v2.ListIncidentIntegrations" + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type SearchIncidentsOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.SearchIncidents" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -3572,17 +7404,29 @@ func (a *IncidentsApi) ListIncidentIntegrations(ctx _context.Context, incidentId _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentIntegrations") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.SearchIncidents") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/integrations" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/search" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + localVarQueryParams.Add("query", datadog.ParameterToString(query, "")) + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + if optionalParams.Sort != nil { + localVarQueryParams.Add("sort", datadog.ParameterToString(*optionalParams.Sort, "")) + } + if optionalParams.PageSize != nil { + localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, "")) + } + if optionalParams.PageOffset != nil { + localVarQueryParams.Add("page[offset]", datadog.ParameterToString(*optionalParams.PageOffset, "")) + } localVarHeaderParams["Accept"] = "application/json" if a.Client.Cfg.DelegatedTokenConfig != nil { @@ -3635,47 +7479,105 @@ func (a *IncidentsApi) ListIncidentIntegrations(ctx _context.Context, incidentId ErrorBody: localVarBody, ErrorMessage: err.Error(), } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// SearchIncidentsWithPagination provides a paginated version of SearchIncidents returning a channel with all items. +func (a *IncidentsApi) SearchIncidentsWithPagination(ctx _context.Context, query string, o ...SearchIncidentsOptionalParameters) (<-chan datadog.PaginationResult[IncidentSearchResponseIncidentsData], func()) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int64(10) + if len(o) == 0 { + o = append(o, SearchIncidentsOptionalParameters{}) + } + if o[0].PageSize != nil { + pageSize_ = *o[0].PageSize + } + o[0].PageSize = &pageSize_ + + items := make(chan datadog.PaginationResult[IncidentSearchResponseIncidentsData], pageSize_) + go func() { + for { + resp, _, err := a.SearchIncidents(ctx, query, o...) + if err != nil { + var returnItem IncidentSearchResponseIncidentsData + items <- datadog.PaginationResult[IncidentSearchResponseIncidentsData]{Item: returnItem, Error: err} + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + respDataAttributes, ok := respData.GetAttributesOk() + if !ok { + break + } + respDataAttributesIncidents, ok := respDataAttributes.GetIncidentsOk() + if !ok { + break + } + results := *respDataAttributesIncidents + + for _, item := range results { + select { + case items <- datadog.PaginationResult[IncidentSearchResponseIncidentsData]{Item: item, Error: nil}: + 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 } -// ListIncidentNotificationRulesOptionalParameters holds optional parameters for ListIncidentNotificationRules. -type ListIncidentNotificationRulesOptionalParameters struct { +// UpdateGlobalIncidentHandleOptionalParameters holds optional parameters for UpdateGlobalIncidentHandle. +type UpdateGlobalIncidentHandleOptionalParameters struct { Include *string } -// NewListIncidentNotificationRulesOptionalParameters creates an empty struct for parameters. -func NewListIncidentNotificationRulesOptionalParameters() *ListIncidentNotificationRulesOptionalParameters { - this := ListIncidentNotificationRulesOptionalParameters{} +// NewUpdateGlobalIncidentHandleOptionalParameters creates an empty struct for parameters. +func NewUpdateGlobalIncidentHandleOptionalParameters() *UpdateGlobalIncidentHandleOptionalParameters { + this := UpdateGlobalIncidentHandleOptionalParameters{} return &this } // WithInclude sets the corresponding parameter name and returns the struct. -func (r *ListIncidentNotificationRulesOptionalParameters) WithInclude(include string) *ListIncidentNotificationRulesOptionalParameters { +func (r *UpdateGlobalIncidentHandleOptionalParameters) WithInclude(include string) *UpdateGlobalIncidentHandleOptionalParameters { r.Include = &include return r } -// ListIncidentNotificationRules List incident notification rules. -// Lists all notification rules for the organization. Optionally filter by incident type. -func (a *IncidentsApi) ListIncidentNotificationRules(ctx _context.Context, o ...ListIncidentNotificationRulesOptionalParameters) (IncidentNotificationRuleArray, *_nethttp.Response, error) { +// UpdateGlobalIncidentHandle Update global incident handle. +// Update an existing global incident handle. +func (a *IncidentsApi) UpdateGlobalIncidentHandle(ctx _context.Context, body IncidentHandleRequest, o ...UpdateGlobalIncidentHandleOptionalParameters) (IncidentHandleResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodGet + localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} - localVarReturnValue IncidentNotificationRuleArray - optionalParams ListIncidentNotificationRulesOptionalParameters + localVarReturnValue IncidentHandleResponse + optionalParams UpdateGlobalIncidentHandleOptionalParameters ) if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentNotificationRulesOptionalParameters is allowed") + return localVarReturnValue, nil, datadog.ReportError("only one argument of type UpdateGlobalIncidentHandleOptionalParameters is allowed") } if len(o) == 1 { optionalParams = o[0] } - operationId := "v2.ListIncidentNotificationRules" + operationId := "v2.UpdateGlobalIncidentHandle" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -3684,12 +7586,12 @@ func (a *IncidentsApi) ListIncidentNotificationRules(ctx _context.Context, o ... _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentNotificationRules") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateGlobalIncidentHandle") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/notification-rules" + localVarPath := localBasePath + "/api/v2/incidents/config/global/incident-handles" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -3697,8 +7599,11 @@ func (a *IncidentsApi) ListIncidentNotificationRules(ctx _context.Context, o ... if optionalParams.Include != nil { localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) } + localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { @@ -3732,7 +7637,16 @@ func (a *IncidentsApi) ListIncidentNotificationRules(ctx _context.Context, o ... ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -3755,48 +7669,16 @@ func (a *IncidentsApi) ListIncidentNotificationRules(ctx _context.Context, o ... return localVarReturnValue, localVarHTTPResponse, nil } -// ListIncidentNotificationTemplatesOptionalParameters holds optional parameters for ListIncidentNotificationTemplates. -type ListIncidentNotificationTemplatesOptionalParameters struct { - FilterIncidentType *uuid.UUID - Include *string -} - -// NewListIncidentNotificationTemplatesOptionalParameters creates an empty struct for parameters. -func NewListIncidentNotificationTemplatesOptionalParameters() *ListIncidentNotificationTemplatesOptionalParameters { - this := ListIncidentNotificationTemplatesOptionalParameters{} - return &this -} - -// WithFilterIncidentType sets the corresponding parameter name and returns the struct. -func (r *ListIncidentNotificationTemplatesOptionalParameters) WithFilterIncidentType(filterIncidentType uuid.UUID) *ListIncidentNotificationTemplatesOptionalParameters { - r.FilterIncidentType = &filterIncidentType - return r -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *ListIncidentNotificationTemplatesOptionalParameters) WithInclude(include string) *ListIncidentNotificationTemplatesOptionalParameters { - r.Include = &include - return r -} - -// ListIncidentNotificationTemplates List incident notification templates. -// Lists all notification templates. Optionally filter by incident type. -func (a *IncidentsApi) ListIncidentNotificationTemplates(ctx _context.Context, o ...ListIncidentNotificationTemplatesOptionalParameters) (IncidentNotificationTemplateArray, *_nethttp.Response, error) { +// UpdateGlobalIncidentSettings Update global incident settings. +// Update global incident settings for the organization. +func (a *IncidentsApi) UpdateGlobalIncidentSettings(ctx _context.Context, body GlobalIncidentSettingsRequest) (GlobalIncidentSettingsResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodGet + localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} - localVarReturnValue IncidentNotificationTemplateArray - optionalParams ListIncidentNotificationTemplatesOptionalParameters + localVarReturnValue GlobalIncidentSettingsResponse ) - if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentNotificationTemplatesOptionalParameters is allowed") - } - if len(o) == 1 { - optionalParams = o[0] - } - - operationId := "v2.ListIncidentNotificationTemplates" + operationId := "v2.UpdateGlobalIncidentSettings" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -3805,24 +7687,21 @@ func (a *IncidentsApi) ListIncidentNotificationTemplates(ctx _context.Context, o _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentNotificationTemplates") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateGlobalIncidentSettings") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/notification-templates" + localVarPath := localBasePath + "/api/v2/incidents/config/global/settings" localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if optionalParams.FilterIncidentType != nil { - localVarQueryParams.Add("filter[incident-type]", datadog.ParameterToString(*optionalParams.FilterIncidentType, "")) - } - if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) - } + localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { @@ -3856,7 +7735,16 @@ func (a *IncidentsApi) ListIncidentNotificationTemplates(ctx _context.Context, o ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -3879,16 +7767,41 @@ func (a *IncidentsApi) ListIncidentNotificationTemplates(ctx _context.Context, o return localVarReturnValue, localVarHTTPResponse, nil } -// ListIncidentPostmortemTemplates List postmortem templates. -// Retrieve a list of all postmortem templates for incidents. -func (a *IncidentsApi) ListIncidentPostmortemTemplates(ctx _context.Context) (PostmortemTemplatesResponse, *_nethttp.Response, error) { +// 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 +} + +// 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) { var ( - localVarHTTPMethod = _nethttp.MethodGet + localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} - localVarReturnValue PostmortemTemplatesResponse + localVarReturnValue IncidentResponse + optionalParams UpdateIncidentOptionalParameters ) - operationId := "v2.ListIncidentPostmortemTemplates" + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type UpdateIncidentOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.UpdateIncident" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -3897,18 +7810,25 @@ func (a *IncidentsApi) ListIncidentPostmortemTemplates(ctx _context.Context) (Po _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentPostmortemTemplates") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncident") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/postmortem-templates" + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "csv")) + } + localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { @@ -3942,16 +7862,7 @@ func (a *IncidentsApi) ListIncidentPostmortemTemplates(ctx _context.Context) (Po ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -3974,16 +7885,41 @@ func (a *IncidentsApi) ListIncidentPostmortemTemplates(ctx _context.Context) (Po return localVarReturnValue, localVarHTTPResponse, nil } -// ListIncidentTodos Get a list of an incident's todos. -// Get all todos for an incident. -func (a *IncidentsApi) ListIncidentTodos(ctx _context.Context, incidentId string) (IncidentTodoListResponse, *_nethttp.Response, error) { +// UpdateIncidentAttachmentOptionalParameters holds optional parameters for UpdateIncidentAttachment. +type UpdateIncidentAttachmentOptionalParameters struct { + Include *string +} + +// NewUpdateIncidentAttachmentOptionalParameters creates an empty struct for parameters. +func NewUpdateIncidentAttachmentOptionalParameters() *UpdateIncidentAttachmentOptionalParameters { + this := UpdateIncidentAttachmentOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *UpdateIncidentAttachmentOptionalParameters) WithInclude(include string) *UpdateIncidentAttachmentOptionalParameters { + r.Include = &include + return r +} + +// UpdateIncidentAttachment Update incident attachment. + +func (a *IncidentsApi) UpdateIncidentAttachment(ctx _context.Context, incidentId string, attachmentId string, body PatchAttachmentRequest, o ...UpdateIncidentAttachmentOptionalParameters) (Attachment, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodGet + localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} - localVarReturnValue IncidentTodoListResponse + localVarReturnValue Attachment + optionalParams UpdateIncidentAttachmentOptionalParameters ) - operationId := "v2.ListIncidentTodos" + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type UpdateIncidentAttachmentOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.UpdateIncidentAttachment" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -3992,19 +7928,26 @@ func (a *IncidentsApi) ListIncidentTodos(ctx _context.Context, incidentId string _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentTodos") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentAttachment") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/todos" + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/attachments/{attachment_id}" localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{attachment_id}", _neturl.PathEscape(datadog.ParameterToString(attachmentId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } + localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { @@ -4038,7 +7981,7 @@ func (a *IncidentsApi) ListIncidentTodos(ctx _context.Context, incidentId string ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -4061,41 +8004,16 @@ func (a *IncidentsApi) ListIncidentTodos(ctx _context.Context, incidentId string return localVarReturnValue, localVarHTTPResponse, nil } -// ListIncidentTypesOptionalParameters holds optional parameters for ListIncidentTypes. -type ListIncidentTypesOptionalParameters struct { - IncludeDeleted *bool -} - -// NewListIncidentTypesOptionalParameters creates an empty struct for parameters. -func NewListIncidentTypesOptionalParameters() *ListIncidentTypesOptionalParameters { - this := ListIncidentTypesOptionalParameters{} - return &this -} - -// WithIncludeDeleted sets the corresponding parameter name and returns the struct. -func (r *ListIncidentTypesOptionalParameters) WithIncludeDeleted(includeDeleted bool) *ListIncidentTypesOptionalParameters { - r.IncludeDeleted = &includeDeleted - return r -} - -// ListIncidentTypes Get a list of incident types. -// Get all incident types. -func (a *IncidentsApi) ListIncidentTypes(ctx _context.Context, o ...ListIncidentTypesOptionalParameters) (IncidentTypeListResponse, *_nethttp.Response, error) { +// UpdateIncidentConfiguration Update an incident configuration. +// Update a configuration for an incident. +func (a *IncidentsApi) UpdateIncidentConfiguration(ctx _context.Context, incidentId string, body IncidentConfigurationPatchRequest) (IncidentConfigurationResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodGet + localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} - localVarReturnValue IncidentTypeListResponse - optionalParams ListIncidentTypesOptionalParameters + localVarReturnValue IncidentConfigurationResponse ) - if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentTypesOptionalParameters is allowed") - } - if len(o) == 1 { - optionalParams = o[0] - } - - operationId := "v2.ListIncidentTypes" + operationId := "v2.UpdateIncidentConfiguration" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -4104,21 +8022,22 @@ func (a *IncidentsApi) ListIncidentTypes(ctx _context.Context, o ...ListIncident _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentTypes") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentConfiguration") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/types" + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/configurations" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if optionalParams.IncludeDeleted != nil { - localVarQueryParams.Add("include_deleted", datadog.ParameterToString(*optionalParams.IncludeDeleted, "")) - } + localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { @@ -4152,7 +8071,7 @@ func (a *IncidentsApi) ListIncidentTypes(ctx _context.Context, o ...ListIncident ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -4175,69 +8094,16 @@ func (a *IncidentsApi) ListIncidentTypes(ctx _context.Context, o ...ListIncident return localVarReturnValue, localVarHTTPResponse, nil } -// ListIncidentUserDefinedFieldsOptionalParameters holds optional parameters for ListIncidentUserDefinedFields. -type ListIncidentUserDefinedFieldsOptionalParameters struct { - PageSize *int64 - PageNumber *int64 - IncludeDeleted *bool - FilterIncidentType *string - Include *string -} - -// NewListIncidentUserDefinedFieldsOptionalParameters creates an empty struct for parameters. -func NewListIncidentUserDefinedFieldsOptionalParameters() *ListIncidentUserDefinedFieldsOptionalParameters { - this := ListIncidentUserDefinedFieldsOptionalParameters{} - return &this -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *ListIncidentUserDefinedFieldsOptionalParameters) WithPageSize(pageSize int64) *ListIncidentUserDefinedFieldsOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageNumber sets the corresponding parameter name and returns the struct. -func (r *ListIncidentUserDefinedFieldsOptionalParameters) WithPageNumber(pageNumber int64) *ListIncidentUserDefinedFieldsOptionalParameters { - r.PageNumber = &pageNumber - return r -} - -// WithIncludeDeleted sets the corresponding parameter name and returns the struct. -func (r *ListIncidentUserDefinedFieldsOptionalParameters) WithIncludeDeleted(includeDeleted bool) *ListIncidentUserDefinedFieldsOptionalParameters { - r.IncludeDeleted = &includeDeleted - return r -} - -// WithFilterIncidentType sets the corresponding parameter name and returns the struct. -func (r *ListIncidentUserDefinedFieldsOptionalParameters) WithFilterIncidentType(filterIncidentType string) *ListIncidentUserDefinedFieldsOptionalParameters { - r.FilterIncidentType = &filterIncidentType - return r -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *ListIncidentUserDefinedFieldsOptionalParameters) WithInclude(include string) *ListIncidentUserDefinedFieldsOptionalParameters { - r.Include = &include - return r -} - -// ListIncidentUserDefinedFields Get a list of incident user-defined fields. -// Get a list of all incident user-defined fields. -func (a *IncidentsApi) ListIncidentUserDefinedFields(ctx _context.Context, o ...ListIncidentUserDefinedFieldsOptionalParameters) (IncidentUserDefinedFieldListResponse, *_nethttp.Response, error) { +// UpdateIncidentGoogleChatConfiguration Update an incident Google Chat configuration. +// Update a Google Chat configuration for incidents. +func (a *IncidentsApi) UpdateIncidentGoogleChatConfiguration(ctx _context.Context, id uuid.UUID, body IncidentGoogleChatConfigurationPatchRequest) (IncidentGoogleChatConfigurationResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodGet + localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} - localVarReturnValue IncidentUserDefinedFieldListResponse - optionalParams ListIncidentUserDefinedFieldsOptionalParameters + localVarReturnValue IncidentGoogleChatConfigurationResponse ) - if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentUserDefinedFieldsOptionalParameters is allowed") - } - if len(o) == 1 { - optionalParams = o[0] - } - - operationId := "v2.ListIncidentUserDefinedFields" + operationId := "v2.UpdateIncidentGoogleChatConfiguration" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -4246,33 +8112,22 @@ func (a *IncidentsApi) ListIncidentUserDefinedFields(ctx _context.Context, o ... _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidentUserDefinedFields") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentGoogleChatConfiguration") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/user-defined-fields" + localVarPath := localBasePath + "/api/v2/incidents/config/google-chat-configurations/{id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if optionalParams.PageSize != nil { - localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, "")) - } - if optionalParams.PageNumber != nil { - localVarQueryParams.Add("page[number]", datadog.ParameterToString(*optionalParams.PageNumber, "")) - } - if optionalParams.IncludeDeleted != nil { - localVarQueryParams.Add("include-deleted", datadog.ParameterToString(*optionalParams.IncludeDeleted, "")) - } - if optionalParams.FilterIncidentType != nil { - localVarQueryParams.Add("filter[incident-type]", datadog.ParameterToString(*optionalParams.FilterIncidentType, "")) - } - if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) - } + localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { @@ -4306,16 +8161,7 @@ func (a *IncidentsApi) ListIncidentUserDefinedFields(ctx _context.Context, o ... ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&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 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -4338,55 +8184,16 @@ func (a *IncidentsApi) ListIncidentUserDefinedFields(ctx _context.Context, o ... return localVarReturnValue, localVarHTTPResponse, nil } -// 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 -} - -// 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) { +// UpdateIncidentGoogleMeetConfiguration Update an incident Google Meet configuration. +// Update a Google Meet configuration for incidents. +func (a *IncidentsApi) UpdateIncidentGoogleMeetConfiguration(ctx _context.Context, id uuid.UUID, body IncidentGoogleMeetConfigurationPatchRequest) (IncidentGoogleMeetConfigurationResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodGet + localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} - localVarReturnValue IncidentsResponse - optionalParams ListIncidentsOptionalParameters + localVarReturnValue IncidentGoogleMeetConfigurationResponse ) - if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListIncidentsOptionalParameters is allowed") - } - if len(o) == 1 { - optionalParams = o[0] - } - - operationId := "v2.ListIncidents" + operationId := "v2.UpdateIncidentGoogleMeetConfiguration" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -4395,27 +8202,22 @@ func (a *IncidentsApi) ListIncidents(ctx _context.Context, o ...ListIncidentsOpt _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.ListIncidents") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentGoogleMeetConfiguration") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents" + localVarPath := localBasePath + "/api/v2/incidents/config/google-meet-configurations/{id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "csv")) - } - if optionalParams.PageSize != nil { - localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, "")) - } - if optionalParams.PageOffset != nil { - localVarQueryParams.Add("page[offset]", datadog.ParameterToString(*optionalParams.PageOffset, "")) - } + localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { @@ -4472,112 +8274,41 @@ func (a *IncidentsApi) ListIncidents(ctx _context.Context, o ...ListIncidentsOpt return localVarReturnValue, localVarHTTPResponse, nil } -// ListIncidentsWithPagination provides a paginated version of ListIncidents returning a channel with all items. -func (a *IncidentsApi) ListIncidentsWithPagination(ctx _context.Context, o ...ListIncidentsOptionalParameters) (<-chan datadog.PaginationResult[IncidentResponseData], func()) { - 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 datadog.PaginationResult[IncidentResponseData], pageSize_) - go func() { - for { - resp, _, err := a.ListIncidents(ctx, o...) - if err != nil { - var returnItem IncidentResponseData - items <- datadog.PaginationResult[IncidentResponseData]{Item: returnItem, Error: err} - break - } - respData, ok := resp.GetDataOk() - if !ok { - break - } - results := *respData - - for _, item := range results { - select { - case items <- datadog.PaginationResult[IncidentResponseData]{Item: item, Error: nil}: - 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 -} - -// SearchIncidentsOptionalParameters holds optional parameters for SearchIncidents. -type SearchIncidentsOptionalParameters struct { - Include *IncidentRelatedObject - Sort *IncidentSearchSortOrder - PageSize *int64 - PageOffset *int64 +// UpdateIncidentImpactOptionalParameters holds optional parameters for UpdateIncidentImpact. +type UpdateIncidentImpactOptionalParameters struct { + Include *[]IncidentImpactRelatedObject } -// NewSearchIncidentsOptionalParameters creates an empty struct for parameters. -func NewSearchIncidentsOptionalParameters() *SearchIncidentsOptionalParameters { - this := SearchIncidentsOptionalParameters{} +// NewUpdateIncidentImpactOptionalParameters creates an empty struct for parameters. +func NewUpdateIncidentImpactOptionalParameters() *UpdateIncidentImpactOptionalParameters { + this := UpdateIncidentImpactOptionalParameters{} return &this } // WithInclude sets the corresponding parameter name and returns the struct. -func (r *SearchIncidentsOptionalParameters) WithInclude(include IncidentRelatedObject) *SearchIncidentsOptionalParameters { +func (r *UpdateIncidentImpactOptionalParameters) WithInclude(include []IncidentImpactRelatedObject) *UpdateIncidentImpactOptionalParameters { r.Include = &include return r } -// WithSort sets the corresponding parameter name and returns the struct. -func (r *SearchIncidentsOptionalParameters) WithSort(sort IncidentSearchSortOrder) *SearchIncidentsOptionalParameters { - r.Sort = &sort - return r -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *SearchIncidentsOptionalParameters) WithPageSize(pageSize int64) *SearchIncidentsOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageOffset sets the corresponding parameter name and returns the struct. -func (r *SearchIncidentsOptionalParameters) WithPageOffset(pageOffset int64) *SearchIncidentsOptionalParameters { - r.PageOffset = &pageOffset - return r -} - -// SearchIncidents Search for incidents. -// Search for incidents matching a certain query. -func (a *IncidentsApi) SearchIncidents(ctx _context.Context, query string, o ...SearchIncidentsOptionalParameters) (IncidentSearchResponse, *_nethttp.Response, error) { +// UpdateIncidentImpact Update an incident impact. +// Update an incident impact. +func (a *IncidentsApi) UpdateIncidentImpact(ctx _context.Context, incidentId string, impactId string, body IncidentImpactCreateRequest, o ...UpdateIncidentImpactOptionalParameters) (IncidentImpactResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodGet + localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} - localVarReturnValue IncidentSearchResponse - optionalParams SearchIncidentsOptionalParameters + localVarReturnValue IncidentImpactResponse + optionalParams UpdateIncidentImpactOptionalParameters ) if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type SearchIncidentsOptionalParameters is allowed") + return localVarReturnValue, nil, datadog.ReportError("only one argument of type UpdateIncidentImpactOptionalParameters is allowed") } if len(o) == 1 { optionalParams = o[0] } - operationId := "v2.SearchIncidents" + operationId := "v2.UpdateIncidentImpact" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -4586,31 +8317,26 @@ func (a *IncidentsApi) SearchIncidents(ctx _context.Context, query string, o ... _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.SearchIncidents") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentImpact") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/search" + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/impacts/{impact_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{impact_id}", _neturl.PathEscape(datadog.ParameterToString(impactId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - localVarQueryParams.Add("query", datadog.ParameterToString(query, "")) if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) - } - if optionalParams.Sort != nil { - localVarQueryParams.Add("sort", datadog.ParameterToString(*optionalParams.Sort, "")) - } - if optionalParams.PageSize != nil { - localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, "")) - } - if optionalParams.PageOffset != nil { - localVarQueryParams.Add("page[offset]", datadog.ParameterToString(*optionalParams.PageOffset, "")) + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "csv")) } + localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" + // body params + localVarPostBody = &body if a.Client.Cfg.DelegatedTokenConfig != nil { err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) if err != nil { @@ -4667,99 +8393,16 @@ func (a *IncidentsApi) SearchIncidents(ctx _context.Context, query string, o ... return localVarReturnValue, localVarHTTPResponse, nil } -// SearchIncidentsWithPagination provides a paginated version of SearchIncidents returning a channel with all items. -func (a *IncidentsApi) SearchIncidentsWithPagination(ctx _context.Context, query string, o ...SearchIncidentsOptionalParameters) (<-chan datadog.PaginationResult[IncidentSearchResponseIncidentsData], func()) { - ctx, cancel := _context.WithCancel(ctx) - pageSize_ := int64(10) - if len(o) == 0 { - o = append(o, SearchIncidentsOptionalParameters{}) - } - if o[0].PageSize != nil { - pageSize_ = *o[0].PageSize - } - o[0].PageSize = &pageSize_ - - items := make(chan datadog.PaginationResult[IncidentSearchResponseIncidentsData], pageSize_) - go func() { - for { - resp, _, err := a.SearchIncidents(ctx, query, o...) - if err != nil { - var returnItem IncidentSearchResponseIncidentsData - items <- datadog.PaginationResult[IncidentSearchResponseIncidentsData]{Item: returnItem, Error: err} - break - } - respData, ok := resp.GetDataOk() - if !ok { - break - } - respDataAttributes, ok := respData.GetAttributesOk() - if !ok { - break - } - respDataAttributesIncidents, ok := respDataAttributes.GetIncidentsOk() - if !ok { - break - } - results := *respDataAttributesIncidents - - for _, item := range results { - select { - case items <- datadog.PaginationResult[IncidentSearchResponseIncidentsData]{Item: item, Error: nil}: - 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 -} - -// UpdateGlobalIncidentHandleOptionalParameters holds optional parameters for UpdateGlobalIncidentHandle. -type UpdateGlobalIncidentHandleOptionalParameters struct { - Include *string -} - -// NewUpdateGlobalIncidentHandleOptionalParameters creates an empty struct for parameters. -func NewUpdateGlobalIncidentHandleOptionalParameters() *UpdateGlobalIncidentHandleOptionalParameters { - this := UpdateGlobalIncidentHandleOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *UpdateGlobalIncidentHandleOptionalParameters) WithInclude(include string) *UpdateGlobalIncidentHandleOptionalParameters { - r.Include = &include - return r -} - -// UpdateGlobalIncidentHandle Update global incident handle. -// Update an existing global incident handle. -func (a *IncidentsApi) UpdateGlobalIncidentHandle(ctx _context.Context, body IncidentHandleRequest, o ...UpdateGlobalIncidentHandleOptionalParameters) (IncidentHandleResponse, *_nethttp.Response, error) { +// UpdateIncidentImpactField Update an incident impact field. +// Update an impact field for incidents. +func (a *IncidentsApi) UpdateIncidentImpactField(ctx _context.Context, fieldId uuid.UUID, body IncidentImpactFieldRequest) (IncidentImpactFieldResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} - localVarReturnValue IncidentHandleResponse - optionalParams UpdateGlobalIncidentHandleOptionalParameters + localVarReturnValue IncidentImpactFieldResponse ) - if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type UpdateGlobalIncidentHandleOptionalParameters is allowed") - } - if len(o) == 1 { - optionalParams = o[0] - } - - operationId := "v2.UpdateGlobalIncidentHandle" + operationId := "v2.UpdateIncidentImpactField" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -4768,19 +8411,17 @@ func (a *IncidentsApi) UpdateGlobalIncidentHandle(ctx _context.Context, body Inc _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateGlobalIncidentHandle") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentImpactField") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/global/incident-handles" + localVarPath := localBasePath + "/api/v2/incidents/config/impact-fields/{field_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{field_id}", _neturl.PathEscape(datadog.ParameterToString(fieldId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) - } localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" @@ -4819,16 +8460,7 @@ func (a *IncidentsApi) UpdateGlobalIncidentHandle(ctx _context.Context, body Inc ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -4851,16 +8483,16 @@ func (a *IncidentsApi) UpdateGlobalIncidentHandle(ctx _context.Context, body Inc return localVarReturnValue, localVarHTTPResponse, nil } -// UpdateGlobalIncidentSettings Update global incident settings. -// Update global incident settings for the organization. -func (a *IncidentsApi) UpdateGlobalIncidentSettings(ctx _context.Context, body GlobalIncidentSettingsRequest) (GlobalIncidentSettingsResponse, *_nethttp.Response, error) { +// UpdateIncidentIntegration Update an existing incident integration metadata. +// Update an existing incident integration metadata. +func (a *IncidentsApi) UpdateIncidentIntegration(ctx _context.Context, incidentId string, integrationMetadataId string, body IncidentIntegrationMetadataPatchRequest) (IncidentIntegrationMetadataResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} - localVarReturnValue GlobalIncidentSettingsResponse + localVarReturnValue IncidentIntegrationMetadataResponse ) - operationId := "v2.UpdateGlobalIncidentSettings" + operationId := "v2.UpdateIncidentIntegration" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -4869,12 +8501,14 @@ func (a *IncidentsApi) UpdateGlobalIncidentSettings(ctx _context.Context, body G _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateGlobalIncidentSettings") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentIntegration") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/global/settings" + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{integration_metadata_id}", _neturl.PathEscape(datadog.ParameterToString(integrationMetadataId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -4917,16 +8551,7 @@ func (a *IncidentsApi) UpdateGlobalIncidentSettings(ctx _context.Context, body G ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -4949,41 +8574,41 @@ func (a *IncidentsApi) UpdateGlobalIncidentSettings(ctx _context.Context, body G return localVarReturnValue, localVarHTTPResponse, nil } -// UpdateIncidentOptionalParameters holds optional parameters for UpdateIncident. -type UpdateIncidentOptionalParameters struct { - Include *[]IncidentRelatedObject +// UpdateIncidentNotificationRuleOptionalParameters holds optional parameters for UpdateIncidentNotificationRule. +type UpdateIncidentNotificationRuleOptionalParameters struct { + Include *string } -// NewUpdateIncidentOptionalParameters creates an empty struct for parameters. -func NewUpdateIncidentOptionalParameters() *UpdateIncidentOptionalParameters { - this := UpdateIncidentOptionalParameters{} +// NewUpdateIncidentNotificationRuleOptionalParameters creates an empty struct for parameters. +func NewUpdateIncidentNotificationRuleOptionalParameters() *UpdateIncidentNotificationRuleOptionalParameters { + this := UpdateIncidentNotificationRuleOptionalParameters{} return &this } // WithInclude sets the corresponding parameter name and returns the struct. -func (r *UpdateIncidentOptionalParameters) WithInclude(include []IncidentRelatedObject) *UpdateIncidentOptionalParameters { +func (r *UpdateIncidentNotificationRuleOptionalParameters) WithInclude(include string) *UpdateIncidentNotificationRuleOptionalParameters { r.Include = &include return r } -// 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) { +// UpdateIncidentNotificationRule Update an incident notification rule. +// Updates an existing notification rule with a complete replacement. +func (a *IncidentsApi) UpdateIncidentNotificationRule(ctx _context.Context, id uuid.UUID, body PutIncidentNotificationRuleRequest, o ...UpdateIncidentNotificationRuleOptionalParameters) (IncidentNotificationRule, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodPatch + localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} - localVarReturnValue IncidentResponse - optionalParams UpdateIncidentOptionalParameters + localVarReturnValue IncidentNotificationRule + optionalParams UpdateIncidentNotificationRuleOptionalParameters ) if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type UpdateIncidentOptionalParameters is allowed") + return localVarReturnValue, nil, datadog.ReportError("only one argument of type UpdateIncidentNotificationRuleOptionalParameters is allowed") } if len(o) == 1 { optionalParams = o[0] } - operationId := "v2.UpdateIncident" + operationId := "v2.UpdateIncidentNotificationRule" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -4992,19 +8617,19 @@ func (a *IncidentsApi) UpdateIncident(ctx _context.Context, incidentId string, b _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncident") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentNotificationRule") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/notification-rules/{id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "csv")) + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) } localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" @@ -5067,41 +8692,41 @@ func (a *IncidentsApi) UpdateIncident(ctx _context.Context, incidentId string, b return localVarReturnValue, localVarHTTPResponse, nil } -// UpdateIncidentAttachmentOptionalParameters holds optional parameters for UpdateIncidentAttachment. -type UpdateIncidentAttachmentOptionalParameters struct { +// UpdateIncidentNotificationTemplateOptionalParameters holds optional parameters for UpdateIncidentNotificationTemplate. +type UpdateIncidentNotificationTemplateOptionalParameters struct { Include *string } -// NewUpdateIncidentAttachmentOptionalParameters creates an empty struct for parameters. -func NewUpdateIncidentAttachmentOptionalParameters() *UpdateIncidentAttachmentOptionalParameters { - this := UpdateIncidentAttachmentOptionalParameters{} +// NewUpdateIncidentNotificationTemplateOptionalParameters creates an empty struct for parameters. +func NewUpdateIncidentNotificationTemplateOptionalParameters() *UpdateIncidentNotificationTemplateOptionalParameters { + this := UpdateIncidentNotificationTemplateOptionalParameters{} return &this } // WithInclude sets the corresponding parameter name and returns the struct. -func (r *UpdateIncidentAttachmentOptionalParameters) WithInclude(include string) *UpdateIncidentAttachmentOptionalParameters { +func (r *UpdateIncidentNotificationTemplateOptionalParameters) WithInclude(include string) *UpdateIncidentNotificationTemplateOptionalParameters { r.Include = &include return r } -// UpdateIncidentAttachment Update incident attachment. - -func (a *IncidentsApi) UpdateIncidentAttachment(ctx _context.Context, incidentId string, attachmentId string, body PatchAttachmentRequest, o ...UpdateIncidentAttachmentOptionalParameters) (Attachment, *_nethttp.Response, error) { +// UpdateIncidentNotificationTemplate Update incident notification template. +// Updates an existing notification template's attributes. +func (a *IncidentsApi) UpdateIncidentNotificationTemplate(ctx _context.Context, id uuid.UUID, body PatchIncidentNotificationTemplateRequest, o ...UpdateIncidentNotificationTemplateOptionalParameters) (IncidentNotificationTemplate, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} - localVarReturnValue Attachment - optionalParams UpdateIncidentAttachmentOptionalParameters + localVarReturnValue IncidentNotificationTemplate + optionalParams UpdateIncidentNotificationTemplateOptionalParameters ) if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type UpdateIncidentAttachmentOptionalParameters is allowed") + return localVarReturnValue, nil, datadog.ReportError("only one argument of type UpdateIncidentNotificationTemplateOptionalParameters is allowed") } if len(o) == 1 { optionalParams = o[0] } - operationId := "v2.UpdateIncidentAttachment" + operationId := "v2.UpdateIncidentNotificationTemplate" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -5110,14 +8735,13 @@ func (a *IncidentsApi) UpdateIncidentAttachment(ctx _context.Context, incidentId _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentAttachment") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentNotificationTemplate") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/attachments/{attachment_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) - localVarPath = datadog.ReplacePathParameter(localVarPath, "{attachment_id}", _neturl.PathEscape(datadog.ParameterToString(attachmentId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/notification-templates/{id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -5163,7 +8787,7 @@ func (a *IncidentsApi) UpdateIncidentAttachment(ctx _context.Context, incidentId ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -5186,16 +8810,16 @@ func (a *IncidentsApi) UpdateIncidentAttachment(ctx _context.Context, incidentId return localVarReturnValue, localVarHTTPResponse, nil } -// UpdateIncidentIntegration Update an existing incident integration metadata. -// Update an existing incident integration metadata. -func (a *IncidentsApi) UpdateIncidentIntegration(ctx _context.Context, incidentId string, integrationMetadataId string, body IncidentIntegrationMetadataPatchRequest) (IncidentIntegrationMetadataResponse, *_nethttp.Response, error) { +// UpdateIncidentPostmortemTemplate Update postmortem template. +// Update an existing postmortem template. +func (a *IncidentsApi) UpdateIncidentPostmortemTemplate(ctx _context.Context, templateId string, body PostmortemTemplateRequest) (PostmortemTemplateResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} - localVarReturnValue IncidentIntegrationMetadataResponse + localVarReturnValue PostmortemTemplateResponse ) - operationId := "v2.UpdateIncidentIntegration" + operationId := "v2.UpdateIncidentPostmortemTemplate" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -5204,14 +8828,13 @@ func (a *IncidentsApi) UpdateIncidentIntegration(ctx _context.Context, incidentI _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentIntegration") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentPostmortemTemplate") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) - localVarPath = datadog.ReplacePathParameter(localVarPath, "{integration_metadata_id}", _neturl.PathEscape(datadog.ParameterToString(integrationMetadataId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/postmortem-templates/{template_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{template_id}", _neturl.PathEscape(datadog.ParameterToString(templateId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -5254,7 +8877,16 @@ func (a *IncidentsApi) UpdateIncidentIntegration(ctx _context.Context, incidentI ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -5277,41 +8909,16 @@ func (a *IncidentsApi) UpdateIncidentIntegration(ctx _context.Context, incidentI return localVarReturnValue, localVarHTTPResponse, nil } -// UpdateIncidentNotificationRuleOptionalParameters holds optional parameters for UpdateIncidentNotificationRule. -type UpdateIncidentNotificationRuleOptionalParameters struct { - Include *string -} - -// NewUpdateIncidentNotificationRuleOptionalParameters creates an empty struct for parameters. -func NewUpdateIncidentNotificationRuleOptionalParameters() *UpdateIncidentNotificationRuleOptionalParameters { - this := UpdateIncidentNotificationRuleOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *UpdateIncidentNotificationRuleOptionalParameters) WithInclude(include string) *UpdateIncidentNotificationRuleOptionalParameters { - r.Include = &include - return r -} - -// UpdateIncidentNotificationRule Update an incident notification rule. -// Updates an existing notification rule with a complete replacement. -func (a *IncidentsApi) UpdateIncidentNotificationRule(ctx _context.Context, id uuid.UUID, body PutIncidentNotificationRuleRequest, o ...UpdateIncidentNotificationRuleOptionalParameters) (IncidentNotificationRule, *_nethttp.Response, error) { +// UpdateIncidentRule Update an incident rule. +// Update an incident rule. +func (a *IncidentsApi) UpdateIncidentRule(ctx _context.Context, ruleId uuid.UUID, body IncidentRulePatchRequest) (IncidentRuleResponse, *_nethttp.Response, error) { var ( - localVarHTTPMethod = _nethttp.MethodPut + localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} - localVarReturnValue IncidentNotificationRule - optionalParams UpdateIncidentNotificationRuleOptionalParameters + localVarReturnValue IncidentRuleResponse ) - if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type UpdateIncidentNotificationRuleOptionalParameters is allowed") - } - if len(o) == 1 { - optionalParams = o[0] - } - - operationId := "v2.UpdateIncidentNotificationRule" + operationId := "v2.UpdateIncidentRule" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -5320,20 +8927,17 @@ func (a *IncidentsApi) UpdateIncidentNotificationRule(ctx _context.Context, id u _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentNotificationRule") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentRule") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/notification-rules/{id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/rules/{rule_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{rule_id}", _neturl.PathEscape(datadog.ParameterToString(ruleId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) - } localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" @@ -5395,41 +8999,16 @@ func (a *IncidentsApi) UpdateIncidentNotificationRule(ctx _context.Context, id u return localVarReturnValue, localVarHTTPResponse, nil } -// UpdateIncidentNotificationTemplateOptionalParameters holds optional parameters for UpdateIncidentNotificationTemplate. -type UpdateIncidentNotificationTemplateOptionalParameters struct { - Include *string -} - -// NewUpdateIncidentNotificationTemplateOptionalParameters creates an empty struct for parameters. -func NewUpdateIncidentNotificationTemplateOptionalParameters() *UpdateIncidentNotificationTemplateOptionalParameters { - this := UpdateIncidentNotificationTemplateOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *UpdateIncidentNotificationTemplateOptionalParameters) WithInclude(include string) *UpdateIncidentNotificationTemplateOptionalParameters { - r.Include = &include - return r -} - -// UpdateIncidentNotificationTemplate Update incident notification template. -// Updates an existing notification template's attributes. -func (a *IncidentsApi) UpdateIncidentNotificationTemplate(ctx _context.Context, id uuid.UUID, body PatchIncidentNotificationTemplateRequest, o ...UpdateIncidentNotificationTemplateOptionalParameters) (IncidentNotificationTemplate, *_nethttp.Response, error) { +// UpdateIncidentTodo Update an incident todo. +// Update an incident todo. +func (a *IncidentsApi) UpdateIncidentTodo(ctx _context.Context, incidentId string, todoId string, body IncidentTodoPatchRequest) (IncidentTodoResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} - localVarReturnValue IncidentNotificationTemplate - optionalParams UpdateIncidentNotificationTemplateOptionalParameters + localVarReturnValue IncidentTodoResponse ) - if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type UpdateIncidentNotificationTemplateOptionalParameters is allowed") - } - if len(o) == 1 { - optionalParams = o[0] - } - - operationId := "v2.UpdateIncidentNotificationTemplate" + operationId := "v2.UpdateIncidentTodo" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -5438,20 +9017,18 @@ func (a *IncidentsApi) UpdateIncidentNotificationTemplate(ctx _context.Context, _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentNotificationTemplate") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentTodo") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/notification-templates/{id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{todo_id}", _neturl.PathEscape(datadog.ParameterToString(todoId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) - } localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" @@ -5513,16 +9090,16 @@ func (a *IncidentsApi) UpdateIncidentNotificationTemplate(ctx _context.Context, return localVarReturnValue, localVarHTTPResponse, nil } -// UpdateIncidentPostmortemTemplate Update postmortem template. -// Update an existing postmortem template. -func (a *IncidentsApi) UpdateIncidentPostmortemTemplate(ctx _context.Context, templateId string, body PostmortemTemplateRequest) (PostmortemTemplateResponse, *_nethttp.Response, error) { +// UpdateIncidentType Update an incident type. +// Update an incident type. +func (a *IncidentsApi) UpdateIncidentType(ctx _context.Context, incidentTypeId string, body IncidentTypePatchRequest) (IncidentTypeResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} - localVarReturnValue PostmortemTemplateResponse + localVarReturnValue IncidentTypeResponse ) - operationId := "v2.UpdateIncidentPostmortemTemplate" + operationId := "v2.UpdateIncidentType" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -5531,13 +9108,13 @@ func (a *IncidentsApi) UpdateIncidentPostmortemTemplate(ctx _context.Context, te _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentPostmortemTemplate") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentType") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/postmortem-templates/{template_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{template_id}", _neturl.PathEscape(datadog.ParameterToString(templateId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/types/{incident_type_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_type_id}", _neturl.PathEscape(datadog.ParameterToString(incidentTypeId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -5580,16 +9157,7 @@ func (a *IncidentsApi) UpdateIncidentPostmortemTemplate(ctx _context.Context, te ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -5612,16 +9180,41 @@ func (a *IncidentsApi) UpdateIncidentPostmortemTemplate(ctx _context.Context, te return localVarReturnValue, localVarHTTPResponse, nil } -// UpdateIncidentTodo Update an incident todo. -// Update an incident todo. -func (a *IncidentsApi) UpdateIncidentTodo(ctx _context.Context, incidentId string, todoId string, body IncidentTodoPatchRequest) (IncidentTodoResponse, *_nethttp.Response, error) { +// UpdateIncidentUserDefinedFieldOptionalParameters holds optional parameters for UpdateIncidentUserDefinedField. +type UpdateIncidentUserDefinedFieldOptionalParameters struct { + Include *string +} + +// NewUpdateIncidentUserDefinedFieldOptionalParameters creates an empty struct for parameters. +func NewUpdateIncidentUserDefinedFieldOptionalParameters() *UpdateIncidentUserDefinedFieldOptionalParameters { + this := UpdateIncidentUserDefinedFieldOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *UpdateIncidentUserDefinedFieldOptionalParameters) WithInclude(include string) *UpdateIncidentUserDefinedFieldOptionalParameters { + r.Include = &include + return r +} + +// UpdateIncidentUserDefinedField Update an incident user-defined field. +// Update an incident user-defined field. +func (a *IncidentsApi) UpdateIncidentUserDefinedField(ctx _context.Context, fieldId string, body IncidentUserDefinedFieldUpdateRequest, o ...UpdateIncidentUserDefinedFieldOptionalParameters) (IncidentUserDefinedFieldResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} - localVarReturnValue IncidentTodoResponse + localVarReturnValue IncidentUserDefinedFieldResponse + optionalParams UpdateIncidentUserDefinedFieldOptionalParameters ) - operationId := "v2.UpdateIncidentTodo" + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type UpdateIncidentUserDefinedFieldOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.UpdateIncidentUserDefinedField" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -5630,18 +9223,20 @@ func (a *IncidentsApi) UpdateIncidentTodo(ctx _context.Context, incidentId strin _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentTodo") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentUserDefinedField") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) - localVarPath = datadog.ReplacePathParameter(localVarPath, "{todo_id}", _neturl.PathEscape(datadog.ParameterToString(todoId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/user-defined-fields/{field_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{field_id}", _neturl.PathEscape(datadog.ParameterToString(fieldId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" @@ -5680,7 +9275,16 @@ func (a *IncidentsApi) UpdateIncidentTodo(ctx _context.Context, incidentId strin ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&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 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -5703,16 +9307,41 @@ func (a *IncidentsApi) UpdateIncidentTodo(ctx _context.Context, incidentId strin return localVarReturnValue, localVarHTTPResponse, nil } -// UpdateIncidentType Update an incident type. -// Update an incident type. -func (a *IncidentsApi) UpdateIncidentType(ctx _context.Context, incidentTypeId string, body IncidentTypePatchRequest) (IncidentTypeResponse, *_nethttp.Response, error) { +// UpdateIncidentUserDefinedRoleOptionalParameters holds optional parameters for UpdateIncidentUserDefinedRole. +type UpdateIncidentUserDefinedRoleOptionalParameters struct { + Include *string +} + +// NewUpdateIncidentUserDefinedRoleOptionalParameters creates an empty struct for parameters. +func NewUpdateIncidentUserDefinedRoleOptionalParameters() *UpdateIncidentUserDefinedRoleOptionalParameters { + this := UpdateIncidentUserDefinedRoleOptionalParameters{} + return &this +} + +// WithInclude sets the corresponding parameter name and returns the struct. +func (r *UpdateIncidentUserDefinedRoleOptionalParameters) WithInclude(include string) *UpdateIncidentUserDefinedRoleOptionalParameters { + r.Include = &include + return r +} + +// UpdateIncidentUserDefinedRole Update an incident user-defined role. +// Update an existing user-defined role for incidents. +func (a *IncidentsApi) UpdateIncidentUserDefinedRole(ctx _context.Context, roleId uuid.UUID, body IncidentUserDefinedRolePatchRequest, o ...UpdateIncidentUserDefinedRoleOptionalParameters) (IncidentUserDefinedRoleResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} - localVarReturnValue IncidentTypeResponse + localVarReturnValue IncidentUserDefinedRoleResponse + optionalParams UpdateIncidentUserDefinedRoleOptionalParameters ) - operationId := "v2.UpdateIncidentType" + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type UpdateIncidentUserDefinedRoleOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.UpdateIncidentUserDefinedRole" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -5721,17 +9350,20 @@ func (a *IncidentsApi) UpdateIncidentType(ctx _context.Context, incidentTypeId s _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentType") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentUserDefinedRole") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/types/{incident_type_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_type_id}", _neturl.PathEscape(datadog.ParameterToString(incidentTypeId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/config/user-defined-roles/{role_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{role_id}", _neturl.PathEscape(datadog.ParameterToString(roleId, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} + if optionalParams.Include != nil { + localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) + } localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" @@ -5770,7 +9402,16 @@ func (a *IncidentsApi) UpdateIncidentType(ctx _context.Context, incidentTypeId s ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -5793,41 +9434,16 @@ func (a *IncidentsApi) UpdateIncidentType(ctx _context.Context, incidentTypeId s return localVarReturnValue, localVarHTTPResponse, nil } -// UpdateIncidentUserDefinedFieldOptionalParameters holds optional parameters for UpdateIncidentUserDefinedField. -type UpdateIncidentUserDefinedFieldOptionalParameters struct { - Include *string -} - -// NewUpdateIncidentUserDefinedFieldOptionalParameters creates an empty struct for parameters. -func NewUpdateIncidentUserDefinedFieldOptionalParameters() *UpdateIncidentUserDefinedFieldOptionalParameters { - this := UpdateIncidentUserDefinedFieldOptionalParameters{} - return &this -} - -// WithInclude sets the corresponding parameter name and returns the struct. -func (r *UpdateIncidentUserDefinedFieldOptionalParameters) WithInclude(include string) *UpdateIncidentUserDefinedFieldOptionalParameters { - r.Include = &include - return r -} - -// UpdateIncidentUserDefinedField Update an incident user-defined field. -// Update an incident user-defined field. -func (a *IncidentsApi) UpdateIncidentUserDefinedField(ctx _context.Context, fieldId string, body IncidentUserDefinedFieldUpdateRequest, o ...UpdateIncidentUserDefinedFieldOptionalParameters) (IncidentUserDefinedFieldResponse, *_nethttp.Response, error) { +// UpdateTimestampOverride Update an incident timestamp override. +// Update a timestamp override for an incident. +func (a *IncidentsApi) UpdateTimestampOverride(ctx _context.Context, incidentId string, id uuid.UUID, body IncidentTimestampOverridePatchRequest) (IncidentTimestampOverrideResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} - localVarReturnValue IncidentUserDefinedFieldResponse - optionalParams UpdateIncidentUserDefinedFieldOptionalParameters + localVarReturnValue IncidentTimestampOverrideResponse ) - if len(o) > 1 { - return localVarReturnValue, nil, datadog.ReportError("only one argument of type UpdateIncidentUserDefinedFieldOptionalParameters is allowed") - } - if len(o) == 1 { - optionalParams = o[0] - } - - operationId := "v2.UpdateIncidentUserDefinedField" + operationId := "v2.UpdateTimestampOverride" isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) if !isOperationEnabled { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} @@ -5836,20 +9452,18 @@ func (a *IncidentsApi) UpdateIncidentUserDefinedField(ctx _context.Context, fiel _log.Printf("WARNING: Using unstable operation '%s'", operationId) } - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateIncidentUserDefinedField") + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.IncidentsApi.UpdateTimestampOverride") if err != nil { return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/api/v2/incidents/config/user-defined-fields/{field_id}" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{field_id}", _neturl.PathEscape(datadog.ParameterToString(fieldId, ""))) + localVarPath := localBasePath + "/api/v2/incidents/{incident_id}/timestamp-overrides/{id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{incident_id}", _neturl.PathEscape(datadog.ParameterToString(incidentId, ""))) + localVarPath = datadog.ReplacePathParameter(localVarPath, "{id}", _neturl.PathEscape(datadog.ParameterToString(id, ""))) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if optionalParams.Include != nil { - localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, "")) - } localVarHeaderParams["Content-Type"] = "application/json" localVarHeaderParams["Accept"] = "application/json" @@ -5888,16 +9502,7 @@ func (a *IncidentsApi) UpdateIncidentUserDefinedField(ctx _context.Context, fiel ErrorBody: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&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 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { var v APIErrorResponse err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index ee521011899..606d5e8a6de 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -456,59 +456,96 @@ // - [IncidentsApi.CreateGlobalIncidentHandle] // - [IncidentsApi.CreateIncident] // - [IncidentsApi.CreateIncidentAttachment] +// - [IncidentsApi.CreateIncidentConfiguration] +// - [IncidentsApi.CreateIncidentGoogleChatConfiguration] +// - [IncidentsApi.CreateIncidentGoogleMeetConfiguration] // - [IncidentsApi.CreateIncidentImpact] +// - [IncidentsApi.CreateIncidentImpactField] // - [IncidentsApi.CreateIncidentIntegration] // - [IncidentsApi.CreateIncidentNotificationRule] // - [IncidentsApi.CreateIncidentNotificationTemplate] // - [IncidentsApi.CreateIncidentPostmortemAttachment] // - [IncidentsApi.CreateIncidentPostmortemTemplate] +// - [IncidentsApi.CreateIncidentResponder] +// - [IncidentsApi.CreateIncidentRule] +// - [IncidentsApi.CreateIncidentServiceNowRecord] // - [IncidentsApi.CreateIncidentTodo] // - [IncidentsApi.CreateIncidentType] // - [IncidentsApi.CreateIncidentUserDefinedField] +// - [IncidentsApi.CreateIncidentUserDefinedRole] +// - [IncidentsApi.CreateOnCallPageFromIncident] +// - [IncidentsApi.CreatePageFromIncident] +// - [IncidentsApi.CreateTimestampOverride] // - [IncidentsApi.DeleteGlobalIncidentHandle] // - [IncidentsApi.DeleteIncident] // - [IncidentsApi.DeleteIncidentAttachment] // - [IncidentsApi.DeleteIncidentImpact] +// - [IncidentsApi.DeleteIncidentImpactField] // - [IncidentsApi.DeleteIncidentIntegration] // - [IncidentsApi.DeleteIncidentNotificationRule] // - [IncidentsApi.DeleteIncidentNotificationTemplate] // - [IncidentsApi.DeleteIncidentPostmortemTemplate] +// - [IncidentsApi.DeleteIncidentResponder] +// - [IncidentsApi.DeleteIncidentRule] // - [IncidentsApi.DeleteIncidentTodo] // - [IncidentsApi.DeleteIncidentType] // - [IncidentsApi.DeleteIncidentUserDefinedField] +// - [IncidentsApi.DeleteIncidentUserDefinedRole] +// - [IncidentsApi.DeleteTimestampOverride] // - [IncidentsApi.GetGlobalIncidentSettings] // - [IncidentsApi.GetIncident] +// - [IncidentsApi.GetIncidentAIPostmortem] // - [IncidentsApi.GetIncidentIntegration] // - [IncidentsApi.GetIncidentNotificationRule] // - [IncidentsApi.GetIncidentNotificationTemplate] // - [IncidentsApi.GetIncidentPostmortemTemplate] +// - [IncidentsApi.GetIncidentResponder] +// - [IncidentsApi.GetIncidentRule] // - [IncidentsApi.GetIncidentTodo] // - [IncidentsApi.GetIncidentType] // - [IncidentsApi.GetIncidentUserDefinedField] +// - [IncidentsApi.GetIncidentUserDefinedRole] +// - [IncidentsApi.GetOrgSettingsByIncidentType] // - [IncidentsApi.ImportIncident] +// - [IncidentsApi.LinkPageToIncident] // - [IncidentsApi.ListGlobalIncidentHandles] // - [IncidentsApi.ListIncidentAttachments] +// - [IncidentsApi.ListIncidentImpactFields] // - [IncidentsApi.ListIncidentImpacts] // - [IncidentsApi.ListIncidentIntegrations] // - [IncidentsApi.ListIncidentNotificationRules] // - [IncidentsApi.ListIncidentNotificationTemplates] // - [IncidentsApi.ListIncidentPostmortemTemplates] +// - [IncidentsApi.ListIncidentResponders] +// - [IncidentsApi.ListIncidentRules] // - [IncidentsApi.ListIncidentTodos] // - [IncidentsApi.ListIncidentTypes] // - [IncidentsApi.ListIncidentUserDefinedFields] +// - [IncidentsApi.ListIncidentUserDefinedRoles] // - [IncidentsApi.ListIncidents] +// - [IncidentsApi.ListOrgSettings] +// - [IncidentsApi.ListTimestampOverrides] +// - [IncidentsApi.PatchIncidentImpact] // - [IncidentsApi.SearchIncidents] // - [IncidentsApi.UpdateGlobalIncidentHandle] // - [IncidentsApi.UpdateGlobalIncidentSettings] // - [IncidentsApi.UpdateIncident] // - [IncidentsApi.UpdateIncidentAttachment] +// - [IncidentsApi.UpdateIncidentConfiguration] +// - [IncidentsApi.UpdateIncidentGoogleChatConfiguration] +// - [IncidentsApi.UpdateIncidentGoogleMeetConfiguration] +// - [IncidentsApi.UpdateIncidentImpact] +// - [IncidentsApi.UpdateIncidentImpactField] // - [IncidentsApi.UpdateIncidentIntegration] // - [IncidentsApi.UpdateIncidentNotificationRule] // - [IncidentsApi.UpdateIncidentNotificationTemplate] // - [IncidentsApi.UpdateIncidentPostmortemTemplate] +// - [IncidentsApi.UpdateIncidentRule] // - [IncidentsApi.UpdateIncidentTodo] // - [IncidentsApi.UpdateIncidentType] // - [IncidentsApi.UpdateIncidentUserDefinedField] +// - [IncidentsApi.UpdateIncidentUserDefinedRole] +// - [IncidentsApi.UpdateTimestampOverride] // - [IntegrationsApi.ListIntegrations] // - [JiraIntegrationApi.CreateJiraIssueTemplate] // - [JiraIntegrationApi.DeleteJiraAccount] diff --git a/api/datadogV2/model_incident_ai_postmortem_data_attributes_response.go b/api/datadogV2/model_incident_ai_postmortem_data_attributes_response.go new file mode 100644 index 00000000000..155cf8399b9 --- /dev/null +++ b/api/datadogV2/model_incident_ai_postmortem_data_attributes_response.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentAIPostmortemDataAttributesResponse Attributes of an AI-generated incident postmortem. +type IncidentAIPostmortemDataAttributesResponse struct { + // Action items to prevent recurrence. + ActionItems *string `json:"action_items,omitempty"` + // The impact of the incident on customers. + CustomerImpact *string `json:"customer_impact,omitempty"` + // An executive summary of the incident. + ExecutiveSummary *string `json:"executive_summary,omitempty"` + // Key insights from the incident. + KeyInsights *string `json:"key_insights,omitempty"` + // Key timeline events during the incident. + KeyTimeline *string `json:"key_timeline,omitempty"` + // Lessons learned from the incident. + LessonsLearned *string `json:"lessons_learned,omitempty"` + // An overview of the affected systems. + SystemOverview *string `json:"system_overview,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentAIPostmortemDataAttributesResponse instantiates a new IncidentAIPostmortemDataAttributesResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentAIPostmortemDataAttributesResponse() *IncidentAIPostmortemDataAttributesResponse { + this := IncidentAIPostmortemDataAttributesResponse{} + return &this +} + +// NewIncidentAIPostmortemDataAttributesResponseWithDefaults instantiates a new IncidentAIPostmortemDataAttributesResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentAIPostmortemDataAttributesResponseWithDefaults() *IncidentAIPostmortemDataAttributesResponse { + this := IncidentAIPostmortemDataAttributesResponse{} + return &this +} + +// GetActionItems returns the ActionItems field value if set, zero value otherwise. +func (o *IncidentAIPostmortemDataAttributesResponse) GetActionItems() string { + if o == nil || o.ActionItems == nil { + var ret string + return ret + } + return *o.ActionItems +} + +// GetActionItemsOk returns a tuple with the ActionItems field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentAIPostmortemDataAttributesResponse) GetActionItemsOk() (*string, bool) { + if o == nil || o.ActionItems == nil { + return nil, false + } + return o.ActionItems, true +} + +// HasActionItems returns a boolean if a field has been set. +func (o *IncidentAIPostmortemDataAttributesResponse) HasActionItems() bool { + return o != nil && o.ActionItems != nil +} + +// SetActionItems gets a reference to the given string and assigns it to the ActionItems field. +func (o *IncidentAIPostmortemDataAttributesResponse) SetActionItems(v string) { + o.ActionItems = &v +} + +// GetCustomerImpact returns the CustomerImpact field value if set, zero value otherwise. +func (o *IncidentAIPostmortemDataAttributesResponse) GetCustomerImpact() string { + if o == nil || o.CustomerImpact == nil { + var ret string + return ret + } + return *o.CustomerImpact +} + +// GetCustomerImpactOk returns a tuple with the CustomerImpact field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentAIPostmortemDataAttributesResponse) GetCustomerImpactOk() (*string, bool) { + if o == nil || o.CustomerImpact == nil { + return nil, false + } + return o.CustomerImpact, true +} + +// HasCustomerImpact returns a boolean if a field has been set. +func (o *IncidentAIPostmortemDataAttributesResponse) HasCustomerImpact() bool { + return o != nil && o.CustomerImpact != nil +} + +// SetCustomerImpact gets a reference to the given string and assigns it to the CustomerImpact field. +func (o *IncidentAIPostmortemDataAttributesResponse) SetCustomerImpact(v string) { + o.CustomerImpact = &v +} + +// GetExecutiveSummary returns the ExecutiveSummary field value if set, zero value otherwise. +func (o *IncidentAIPostmortemDataAttributesResponse) GetExecutiveSummary() string { + if o == nil || o.ExecutiveSummary == nil { + var ret string + return ret + } + return *o.ExecutiveSummary +} + +// GetExecutiveSummaryOk returns a tuple with the ExecutiveSummary field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentAIPostmortemDataAttributesResponse) GetExecutiveSummaryOk() (*string, bool) { + if o == nil || o.ExecutiveSummary == nil { + return nil, false + } + return o.ExecutiveSummary, true +} + +// HasExecutiveSummary returns a boolean if a field has been set. +func (o *IncidentAIPostmortemDataAttributesResponse) HasExecutiveSummary() bool { + return o != nil && o.ExecutiveSummary != nil +} + +// SetExecutiveSummary gets a reference to the given string and assigns it to the ExecutiveSummary field. +func (o *IncidentAIPostmortemDataAttributesResponse) SetExecutiveSummary(v string) { + o.ExecutiveSummary = &v +} + +// GetKeyInsights returns the KeyInsights field value if set, zero value otherwise. +func (o *IncidentAIPostmortemDataAttributesResponse) GetKeyInsights() string { + if o == nil || o.KeyInsights == nil { + var ret string + return ret + } + return *o.KeyInsights +} + +// GetKeyInsightsOk returns a tuple with the KeyInsights field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentAIPostmortemDataAttributesResponse) GetKeyInsightsOk() (*string, bool) { + if o == nil || o.KeyInsights == nil { + return nil, false + } + return o.KeyInsights, true +} + +// HasKeyInsights returns a boolean if a field has been set. +func (o *IncidentAIPostmortemDataAttributesResponse) HasKeyInsights() bool { + return o != nil && o.KeyInsights != nil +} + +// SetKeyInsights gets a reference to the given string and assigns it to the KeyInsights field. +func (o *IncidentAIPostmortemDataAttributesResponse) SetKeyInsights(v string) { + o.KeyInsights = &v +} + +// GetKeyTimeline returns the KeyTimeline field value if set, zero value otherwise. +func (o *IncidentAIPostmortemDataAttributesResponse) GetKeyTimeline() string { + if o == nil || o.KeyTimeline == nil { + var ret string + return ret + } + return *o.KeyTimeline +} + +// GetKeyTimelineOk returns a tuple with the KeyTimeline field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentAIPostmortemDataAttributesResponse) GetKeyTimelineOk() (*string, bool) { + if o == nil || o.KeyTimeline == nil { + return nil, false + } + return o.KeyTimeline, true +} + +// HasKeyTimeline returns a boolean if a field has been set. +func (o *IncidentAIPostmortemDataAttributesResponse) HasKeyTimeline() bool { + return o != nil && o.KeyTimeline != nil +} + +// SetKeyTimeline gets a reference to the given string and assigns it to the KeyTimeline field. +func (o *IncidentAIPostmortemDataAttributesResponse) SetKeyTimeline(v string) { + o.KeyTimeline = &v +} + +// GetLessonsLearned returns the LessonsLearned field value if set, zero value otherwise. +func (o *IncidentAIPostmortemDataAttributesResponse) GetLessonsLearned() string { + if o == nil || o.LessonsLearned == nil { + var ret string + return ret + } + return *o.LessonsLearned +} + +// GetLessonsLearnedOk returns a tuple with the LessonsLearned field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentAIPostmortemDataAttributesResponse) GetLessonsLearnedOk() (*string, bool) { + if o == nil || o.LessonsLearned == nil { + return nil, false + } + return o.LessonsLearned, true +} + +// HasLessonsLearned returns a boolean if a field has been set. +func (o *IncidentAIPostmortemDataAttributesResponse) HasLessonsLearned() bool { + return o != nil && o.LessonsLearned != nil +} + +// SetLessonsLearned gets a reference to the given string and assigns it to the LessonsLearned field. +func (o *IncidentAIPostmortemDataAttributesResponse) SetLessonsLearned(v string) { + o.LessonsLearned = &v +} + +// GetSystemOverview returns the SystemOverview field value if set, zero value otherwise. +func (o *IncidentAIPostmortemDataAttributesResponse) GetSystemOverview() string { + if o == nil || o.SystemOverview == nil { + var ret string + return ret + } + return *o.SystemOverview +} + +// GetSystemOverviewOk returns a tuple with the SystemOverview field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentAIPostmortemDataAttributesResponse) GetSystemOverviewOk() (*string, bool) { + if o == nil || o.SystemOverview == nil { + return nil, false + } + return o.SystemOverview, true +} + +// HasSystemOverview returns a boolean if a field has been set. +func (o *IncidentAIPostmortemDataAttributesResponse) HasSystemOverview() bool { + return o != nil && o.SystemOverview != nil +} + +// SetSystemOverview gets a reference to the given string and assigns it to the SystemOverview field. +func (o *IncidentAIPostmortemDataAttributesResponse) SetSystemOverview(v string) { + o.SystemOverview = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentAIPostmortemDataAttributesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ActionItems != nil { + toSerialize["action_items"] = o.ActionItems + } + if o.CustomerImpact != nil { + toSerialize["customer_impact"] = o.CustomerImpact + } + if o.ExecutiveSummary != nil { + toSerialize["executive_summary"] = o.ExecutiveSummary + } + if o.KeyInsights != nil { + toSerialize["key_insights"] = o.KeyInsights + } + if o.KeyTimeline != nil { + toSerialize["key_timeline"] = o.KeyTimeline + } + if o.LessonsLearned != nil { + toSerialize["lessons_learned"] = o.LessonsLearned + } + if o.SystemOverview != nil { + toSerialize["system_overview"] = o.SystemOverview + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentAIPostmortemDataAttributesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ActionItems *string `json:"action_items,omitempty"` + CustomerImpact *string `json:"customer_impact,omitempty"` + ExecutiveSummary *string `json:"executive_summary,omitempty"` + KeyInsights *string `json:"key_insights,omitempty"` + KeyTimeline *string `json:"key_timeline,omitempty"` + LessonsLearned *string `json:"lessons_learned,omitempty"` + SystemOverview *string `json:"system_overview,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"action_items", "customer_impact", "executive_summary", "key_insights", "key_timeline", "lessons_learned", "system_overview"}) + } else { + return err + } + o.ActionItems = all.ActionItems + o.CustomerImpact = all.CustomerImpact + o.ExecutiveSummary = all.ExecutiveSummary + o.KeyInsights = all.KeyInsights + o.KeyTimeline = all.KeyTimeline + o.LessonsLearned = all.LessonsLearned + o.SystemOverview = all.SystemOverview + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_ai_postmortem_data_response.go b/api/datadogV2/model_incident_ai_postmortem_data_response.go new file mode 100644 index 00000000000..e1ca480eaf9 --- /dev/null +++ b/api/datadogV2/model_incident_ai_postmortem_data_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 datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentAIPostmortemDataResponse AI postmortem data in a response. +type IncidentAIPostmortemDataResponse struct { + // Attributes of an AI-generated incident postmortem. + Attributes IncidentAIPostmortemDataAttributesResponse `json:"attributes"` + // The incident identifier. + Id uuid.UUID `json:"id"` + // AI postmortem response resource type. + Type IncidentAIPostmortemResponseType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentAIPostmortemDataResponse instantiates a new IncidentAIPostmortemDataResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentAIPostmortemDataResponse(attributes IncidentAIPostmortemDataAttributesResponse, id uuid.UUID, typeVar IncidentAIPostmortemResponseType) *IncidentAIPostmortemDataResponse { + this := IncidentAIPostmortemDataResponse{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentAIPostmortemDataResponseWithDefaults instantiates a new IncidentAIPostmortemDataResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentAIPostmortemDataResponseWithDefaults() *IncidentAIPostmortemDataResponse { + this := IncidentAIPostmortemDataResponse{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentAIPostmortemDataResponse) GetAttributes() IncidentAIPostmortemDataAttributesResponse { + if o == nil { + var ret IncidentAIPostmortemDataAttributesResponse + 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 *IncidentAIPostmortemDataResponse) GetAttributesOk() (*IncidentAIPostmortemDataAttributesResponse, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentAIPostmortemDataResponse) SetAttributes(v IncidentAIPostmortemDataAttributesResponse) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *IncidentAIPostmortemDataResponse) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentAIPostmortemDataResponse) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentAIPostmortemDataResponse) SetId(v uuid.UUID) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *IncidentAIPostmortemDataResponse) GetType() IncidentAIPostmortemResponseType { + if o == nil { + var ret IncidentAIPostmortemResponseType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentAIPostmortemDataResponse) GetTypeOk() (*IncidentAIPostmortemResponseType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentAIPostmortemDataResponse) SetType(v IncidentAIPostmortemResponseType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentAIPostmortemDataResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentAIPostmortemDataResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentAIPostmortemDataAttributesResponse `json:"attributes"` + Id *uuid.UUID `json:"id"` + Type *IncidentAIPostmortemResponseType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_ai_postmortem_response.go b/api/datadogV2/model_incident_ai_postmortem_response.go new file mode 100644 index 00000000000..eb032c1945a --- /dev/null +++ b/api/datadogV2/model_incident_ai_postmortem_response.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentAIPostmortemResponse Response with an AI-generated incident postmortem. +type IncidentAIPostmortemResponse struct { + // AI postmortem data in a response. + Data IncidentAIPostmortemDataResponse `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentAIPostmortemResponse instantiates a new IncidentAIPostmortemResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentAIPostmortemResponse(data IncidentAIPostmortemDataResponse) *IncidentAIPostmortemResponse { + this := IncidentAIPostmortemResponse{} + this.Data = data + return &this +} + +// NewIncidentAIPostmortemResponseWithDefaults instantiates a new IncidentAIPostmortemResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentAIPostmortemResponseWithDefaults() *IncidentAIPostmortemResponse { + this := IncidentAIPostmortemResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentAIPostmortemResponse) GetData() IncidentAIPostmortemDataResponse { + if o == nil { + var ret IncidentAIPostmortemDataResponse + 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 *IncidentAIPostmortemResponse) GetDataOk() (*IncidentAIPostmortemDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentAIPostmortemResponse) SetData(v IncidentAIPostmortemDataResponse) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentAIPostmortemResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentAIPostmortemResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentAIPostmortemDataResponse `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_ai_postmortem_response_type.go b/api/datadogV2/model_incident_ai_postmortem_response_type.go new file mode 100644 index 00000000000..3efe608d8e6 --- /dev/null +++ b/api/datadogV2/model_incident_ai_postmortem_response_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentAIPostmortemResponseType AI postmortem response resource type. +type IncidentAIPostmortemResponseType string + +// List of IncidentAIPostmortemResponseType. +const ( + INCIDENTAIPOSTMORTEMRESPONSETYPE_GET_INCIDENT_AI_POSTMORTEM_RESPONSE IncidentAIPostmortemResponseType = "get_incident_ai_postmortem_response" +) + +var allowedIncidentAIPostmortemResponseTypeEnumValues = []IncidentAIPostmortemResponseType{ + INCIDENTAIPOSTMORTEMRESPONSETYPE_GET_INCIDENT_AI_POSTMORTEM_RESPONSE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentAIPostmortemResponseType) GetAllowedValues() []IncidentAIPostmortemResponseType { + return allowedIncidentAIPostmortemResponseTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentAIPostmortemResponseType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentAIPostmortemResponseType(value) + return nil +} + +// NewIncidentAIPostmortemResponseTypeFromValue returns a pointer to a valid IncidentAIPostmortemResponseType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentAIPostmortemResponseTypeFromValue(v string) (*IncidentAIPostmortemResponseType, error) { + ev := IncidentAIPostmortemResponseType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentAIPostmortemResponseType: valid values are %v", v, allowedIncidentAIPostmortemResponseTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentAIPostmortemResponseType) IsValid() bool { + for _, existing := range allowedIncidentAIPostmortemResponseTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentAIPostmortemResponseType value. +func (v IncidentAIPostmortemResponseType) Ptr() *IncidentAIPostmortemResponseType { + return &v +} diff --git a/api/datadogV2/model_incident_configuration_data_attributes_request.go b/api/datadogV2/model_incident_configuration_data_attributes_request.go new file mode 100644 index 00000000000..4b95bd4aafa --- /dev/null +++ b/api/datadogV2/model_incident_configuration_data_attributes_request.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentConfigurationDataAttributesRequest Attributes for creating an incident configuration. +type IncidentConfigurationDataAttributesRequest struct { + // Whether to execute integrations for this incident. + ExecuteIntegrations *bool `json:"execute_integrations,omitempty"` + // Whether to execute notification rules for this incident. + ExecuteNotificationRules *bool `json:"execute_notification_rules,omitempty"` + // Whether to include this incident in analytics. + IncludeInAnalytics *bool `json:"include_in_analytics,omitempty"` + // Whether to include this incident in search results. + IncludeInSearch *bool `json:"include_in_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{} `json:"-"` +} + +// NewIncidentConfigurationDataAttributesRequest instantiates a new IncidentConfigurationDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentConfigurationDataAttributesRequest() *IncidentConfigurationDataAttributesRequest { + this := IncidentConfigurationDataAttributesRequest{} + return &this +} + +// NewIncidentConfigurationDataAttributesRequestWithDefaults instantiates a new IncidentConfigurationDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentConfigurationDataAttributesRequestWithDefaults() *IncidentConfigurationDataAttributesRequest { + this := IncidentConfigurationDataAttributesRequest{} + return &this +} + +// GetExecuteIntegrations returns the ExecuteIntegrations field value if set, zero value otherwise. +func (o *IncidentConfigurationDataAttributesRequest) GetExecuteIntegrations() bool { + if o == nil || o.ExecuteIntegrations == nil { + var ret bool + return ret + } + return *o.ExecuteIntegrations +} + +// GetExecuteIntegrationsOk returns a tuple with the ExecuteIntegrations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationDataAttributesRequest) GetExecuteIntegrationsOk() (*bool, bool) { + if o == nil || o.ExecuteIntegrations == nil { + return nil, false + } + return o.ExecuteIntegrations, true +} + +// HasExecuteIntegrations returns a boolean if a field has been set. +func (o *IncidentConfigurationDataAttributesRequest) HasExecuteIntegrations() bool { + return o != nil && o.ExecuteIntegrations != nil +} + +// SetExecuteIntegrations gets a reference to the given bool and assigns it to the ExecuteIntegrations field. +func (o *IncidentConfigurationDataAttributesRequest) SetExecuteIntegrations(v bool) { + o.ExecuteIntegrations = &v +} + +// GetExecuteNotificationRules returns the ExecuteNotificationRules field value if set, zero value otherwise. +func (o *IncidentConfigurationDataAttributesRequest) GetExecuteNotificationRules() bool { + if o == nil || o.ExecuteNotificationRules == nil { + var ret bool + return ret + } + return *o.ExecuteNotificationRules +} + +// GetExecuteNotificationRulesOk returns a tuple with the ExecuteNotificationRules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationDataAttributesRequest) GetExecuteNotificationRulesOk() (*bool, bool) { + if o == nil || o.ExecuteNotificationRules == nil { + return nil, false + } + return o.ExecuteNotificationRules, true +} + +// HasExecuteNotificationRules returns a boolean if a field has been set. +func (o *IncidentConfigurationDataAttributesRequest) HasExecuteNotificationRules() bool { + return o != nil && o.ExecuteNotificationRules != nil +} + +// SetExecuteNotificationRules gets a reference to the given bool and assigns it to the ExecuteNotificationRules field. +func (o *IncidentConfigurationDataAttributesRequest) SetExecuteNotificationRules(v bool) { + o.ExecuteNotificationRules = &v +} + +// GetIncludeInAnalytics returns the IncludeInAnalytics field value if set, zero value otherwise. +func (o *IncidentConfigurationDataAttributesRequest) GetIncludeInAnalytics() bool { + if o == nil || o.IncludeInAnalytics == nil { + var ret bool + return ret + } + return *o.IncludeInAnalytics +} + +// GetIncludeInAnalyticsOk returns a tuple with the IncludeInAnalytics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationDataAttributesRequest) GetIncludeInAnalyticsOk() (*bool, bool) { + if o == nil || o.IncludeInAnalytics == nil { + return nil, false + } + return o.IncludeInAnalytics, true +} + +// HasIncludeInAnalytics returns a boolean if a field has been set. +func (o *IncidentConfigurationDataAttributesRequest) HasIncludeInAnalytics() bool { + return o != nil && o.IncludeInAnalytics != nil +} + +// SetIncludeInAnalytics gets a reference to the given bool and assigns it to the IncludeInAnalytics field. +func (o *IncidentConfigurationDataAttributesRequest) SetIncludeInAnalytics(v bool) { + o.IncludeInAnalytics = &v +} + +// GetIncludeInSearch returns the IncludeInSearch field value if set, zero value otherwise. +func (o *IncidentConfigurationDataAttributesRequest) GetIncludeInSearch() bool { + if o == nil || o.IncludeInSearch == nil { + var ret bool + return ret + } + return *o.IncludeInSearch +} + +// GetIncludeInSearchOk returns a tuple with the IncludeInSearch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationDataAttributesRequest) GetIncludeInSearchOk() (*bool, bool) { + if o == nil || o.IncludeInSearch == nil { + return nil, false + } + return o.IncludeInSearch, true +} + +// HasIncludeInSearch returns a boolean if a field has been set. +func (o *IncidentConfigurationDataAttributesRequest) HasIncludeInSearch() bool { + return o != nil && o.IncludeInSearch != nil +} + +// SetIncludeInSearch gets a reference to the given bool and assigns it to the IncludeInSearch field. +func (o *IncidentConfigurationDataAttributesRequest) SetIncludeInSearch(v bool) { + o.IncludeInSearch = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentConfigurationDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ExecuteIntegrations != nil { + toSerialize["execute_integrations"] = o.ExecuteIntegrations + } + if o.ExecuteNotificationRules != nil { + toSerialize["execute_notification_rules"] = o.ExecuteNotificationRules + } + if o.IncludeInAnalytics != nil { + toSerialize["include_in_analytics"] = o.IncludeInAnalytics + } + if o.IncludeInSearch != nil { + toSerialize["include_in_search"] = o.IncludeInSearch + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentConfigurationDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ExecuteIntegrations *bool `json:"execute_integrations,omitempty"` + ExecuteNotificationRules *bool `json:"execute_notification_rules,omitempty"` + IncludeInAnalytics *bool `json:"include_in_analytics,omitempty"` + IncludeInSearch *bool `json:"include_in_search,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"execute_integrations", "execute_notification_rules", "include_in_analytics", "include_in_search"}) + } else { + return err + } + o.ExecuteIntegrations = all.ExecuteIntegrations + o.ExecuteNotificationRules = all.ExecuteNotificationRules + o.IncludeInAnalytics = all.IncludeInAnalytics + o.IncludeInSearch = all.IncludeInSearch + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_configuration_data_attributes_response.go b/api/datadogV2/model_incident_configuration_data_attributes_response.go new file mode 100644 index 00000000000..42021f446fc --- /dev/null +++ b/api/datadogV2/model_incident_configuration_data_attributes_response.go @@ -0,0 +1,314 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentConfigurationDataAttributesResponse Attributes of an incident configuration in a response. +type IncidentConfigurationDataAttributesResponse struct { + // Timestamp when the configuration was created. + CreatedAt time.Time `json:"created_at"` + // Whether integrations are executed for this incident. + ExecuteIntegrations *bool `json:"execute_integrations,omitempty"` + // Whether notification rules are executed for this incident. + ExecuteNotificationRules *bool `json:"execute_notification_rules,omitempty"` + // The incident identifier. + IncidentId string `json:"incident_id"` + // Whether this incident is included in analytics. + IncludeInAnalytics *bool `json:"include_in_analytics,omitempty"` + // Whether this incident is included in search results. + IncludeInSearch *bool `json:"include_in_search,omitempty"` + // Timestamp when the configuration was last modified. + ModifiedAt time.Time `json:"modified_at"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentConfigurationDataAttributesResponse instantiates a new IncidentConfigurationDataAttributesResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentConfigurationDataAttributesResponse(createdAt time.Time, incidentId string, modifiedAt time.Time) *IncidentConfigurationDataAttributesResponse { + this := IncidentConfigurationDataAttributesResponse{} + this.CreatedAt = createdAt + this.IncidentId = incidentId + this.ModifiedAt = modifiedAt + return &this +} + +// NewIncidentConfigurationDataAttributesResponseWithDefaults instantiates a new IncidentConfigurationDataAttributesResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentConfigurationDataAttributesResponseWithDefaults() *IncidentConfigurationDataAttributesResponse { + this := IncidentConfigurationDataAttributesResponse{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value. +func (o *IncidentConfigurationDataAttributesResponse) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationDataAttributesResponse) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value. +func (o *IncidentConfigurationDataAttributesResponse) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetExecuteIntegrations returns the ExecuteIntegrations field value if set, zero value otherwise. +func (o *IncidentConfigurationDataAttributesResponse) GetExecuteIntegrations() bool { + if o == nil || o.ExecuteIntegrations == nil { + var ret bool + return ret + } + return *o.ExecuteIntegrations +} + +// GetExecuteIntegrationsOk returns a tuple with the ExecuteIntegrations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationDataAttributesResponse) GetExecuteIntegrationsOk() (*bool, bool) { + if o == nil || o.ExecuteIntegrations == nil { + return nil, false + } + return o.ExecuteIntegrations, true +} + +// HasExecuteIntegrations returns a boolean if a field has been set. +func (o *IncidentConfigurationDataAttributesResponse) HasExecuteIntegrations() bool { + return o != nil && o.ExecuteIntegrations != nil +} + +// SetExecuteIntegrations gets a reference to the given bool and assigns it to the ExecuteIntegrations field. +func (o *IncidentConfigurationDataAttributesResponse) SetExecuteIntegrations(v bool) { + o.ExecuteIntegrations = &v +} + +// GetExecuteNotificationRules returns the ExecuteNotificationRules field value if set, zero value otherwise. +func (o *IncidentConfigurationDataAttributesResponse) GetExecuteNotificationRules() bool { + if o == nil || o.ExecuteNotificationRules == nil { + var ret bool + return ret + } + return *o.ExecuteNotificationRules +} + +// GetExecuteNotificationRulesOk returns a tuple with the ExecuteNotificationRules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationDataAttributesResponse) GetExecuteNotificationRulesOk() (*bool, bool) { + if o == nil || o.ExecuteNotificationRules == nil { + return nil, false + } + return o.ExecuteNotificationRules, true +} + +// HasExecuteNotificationRules returns a boolean if a field has been set. +func (o *IncidentConfigurationDataAttributesResponse) HasExecuteNotificationRules() bool { + return o != nil && o.ExecuteNotificationRules != nil +} + +// SetExecuteNotificationRules gets a reference to the given bool and assigns it to the ExecuteNotificationRules field. +func (o *IncidentConfigurationDataAttributesResponse) SetExecuteNotificationRules(v bool) { + o.ExecuteNotificationRules = &v +} + +// GetIncidentId returns the IncidentId field value. +func (o *IncidentConfigurationDataAttributesResponse) GetIncidentId() string { + if o == nil { + var ret string + 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 *IncidentConfigurationDataAttributesResponse) GetIncidentIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.IncidentId, true +} + +// SetIncidentId sets field value. +func (o *IncidentConfigurationDataAttributesResponse) SetIncidentId(v string) { + o.IncidentId = v +} + +// GetIncludeInAnalytics returns the IncludeInAnalytics field value if set, zero value otherwise. +func (o *IncidentConfigurationDataAttributesResponse) GetIncludeInAnalytics() bool { + if o == nil || o.IncludeInAnalytics == nil { + var ret bool + return ret + } + return *o.IncludeInAnalytics +} + +// GetIncludeInAnalyticsOk returns a tuple with the IncludeInAnalytics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationDataAttributesResponse) GetIncludeInAnalyticsOk() (*bool, bool) { + if o == nil || o.IncludeInAnalytics == nil { + return nil, false + } + return o.IncludeInAnalytics, true +} + +// HasIncludeInAnalytics returns a boolean if a field has been set. +func (o *IncidentConfigurationDataAttributesResponse) HasIncludeInAnalytics() bool { + return o != nil && o.IncludeInAnalytics != nil +} + +// SetIncludeInAnalytics gets a reference to the given bool and assigns it to the IncludeInAnalytics field. +func (o *IncidentConfigurationDataAttributesResponse) SetIncludeInAnalytics(v bool) { + o.IncludeInAnalytics = &v +} + +// GetIncludeInSearch returns the IncludeInSearch field value if set, zero value otherwise. +func (o *IncidentConfigurationDataAttributesResponse) GetIncludeInSearch() bool { + if o == nil || o.IncludeInSearch == nil { + var ret bool + return ret + } + return *o.IncludeInSearch +} + +// GetIncludeInSearchOk returns a tuple with the IncludeInSearch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationDataAttributesResponse) GetIncludeInSearchOk() (*bool, bool) { + if o == nil || o.IncludeInSearch == nil { + return nil, false + } + return o.IncludeInSearch, true +} + +// HasIncludeInSearch returns a boolean if a field has been set. +func (o *IncidentConfigurationDataAttributesResponse) HasIncludeInSearch() bool { + return o != nil && o.IncludeInSearch != nil +} + +// SetIncludeInSearch gets a reference to the given bool and assigns it to the IncludeInSearch field. +func (o *IncidentConfigurationDataAttributesResponse) SetIncludeInSearch(v bool) { + o.IncludeInSearch = &v +} + +// GetModifiedAt returns the ModifiedAt field value. +func (o *IncidentConfigurationDataAttributesResponse) GetModifiedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationDataAttributesResponse) GetModifiedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.ModifiedAt, true +} + +// SetModifiedAt sets field value. +func (o *IncidentConfigurationDataAttributesResponse) SetModifiedAt(v time.Time) { + o.ModifiedAt = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentConfigurationDataAttributesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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.ExecuteIntegrations != nil { + toSerialize["execute_integrations"] = o.ExecuteIntegrations + } + if o.ExecuteNotificationRules != nil { + toSerialize["execute_notification_rules"] = o.ExecuteNotificationRules + } + toSerialize["incident_id"] = o.IncidentId + if o.IncludeInAnalytics != nil { + toSerialize["include_in_analytics"] = o.IncludeInAnalytics + } + if o.IncludeInSearch != nil { + toSerialize["include_in_search"] = o.IncludeInSearch + } + 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") + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentConfigurationDataAttributesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedAt *time.Time `json:"created_at"` + ExecuteIntegrations *bool `json:"execute_integrations,omitempty"` + ExecuteNotificationRules *bool `json:"execute_notification_rules,omitempty"` + IncidentId *string `json:"incident_id"` + IncludeInAnalytics *bool `json:"include_in_analytics,omitempty"` + IncludeInSearch *bool `json:"include_in_search,omitempty"` + ModifiedAt *time.Time `json:"modified_at"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.CreatedAt == nil { + return fmt.Errorf("required field created_at missing") + } + if all.IncidentId == nil { + return fmt.Errorf("required field incident_id missing") + } + if all.ModifiedAt == nil { + return fmt.Errorf("required field modified_at missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "execute_integrations", "execute_notification_rules", "incident_id", "include_in_analytics", "include_in_search", "modified_at"}) + } else { + return err + } + o.CreatedAt = *all.CreatedAt + o.ExecuteIntegrations = all.ExecuteIntegrations + o.ExecuteNotificationRules = all.ExecuteNotificationRules + o.IncidentId = *all.IncidentId + o.IncludeInAnalytics = all.IncludeInAnalytics + o.IncludeInSearch = all.IncludeInSearch + o.ModifiedAt = *all.ModifiedAt + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_configuration_data_request.go b/api/datadogV2/model_incident_configuration_data_request.go new file mode 100644 index 00000000000..61aa445d8d4 --- /dev/null +++ b/api/datadogV2/model_incident_configuration_data_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentConfigurationDataRequest Incident configuration data in a create request. +type IncidentConfigurationDataRequest struct { + // Attributes for creating an incident configuration. + Attributes *IncidentConfigurationDataAttributesRequest `json:"attributes,omitempty"` + // Incident configuration resource type. + Type IncidentConfigurationType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentConfigurationDataRequest instantiates a new IncidentConfigurationDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentConfigurationDataRequest(typeVar IncidentConfigurationType) *IncidentConfigurationDataRequest { + this := IncidentConfigurationDataRequest{} + this.Type = typeVar + return &this +} + +// NewIncidentConfigurationDataRequestWithDefaults instantiates a new IncidentConfigurationDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentConfigurationDataRequestWithDefaults() *IncidentConfigurationDataRequest { + this := IncidentConfigurationDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *IncidentConfigurationDataRequest) GetAttributes() IncidentConfigurationDataAttributesRequest { + if o == nil || o.Attributes == nil { + var ret IncidentConfigurationDataAttributesRequest + 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 *IncidentConfigurationDataRequest) GetAttributesOk() (*IncidentConfigurationDataAttributesRequest, 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 *IncidentConfigurationDataRequest) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given IncidentConfigurationDataAttributesRequest and assigns it to the Attributes field. +func (o *IncidentConfigurationDataRequest) SetAttributes(v IncidentConfigurationDataAttributesRequest) { + o.Attributes = &v +} + +// GetType returns the Type field value. +func (o *IncidentConfigurationDataRequest) GetType() IncidentConfigurationType { + if o == nil { + var ret IncidentConfigurationType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationDataRequest) GetTypeOk() (*IncidentConfigurationType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentConfigurationDataRequest) SetType(v IncidentConfigurationType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentConfigurationDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentConfigurationDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentConfigurationDataAttributesRequest `json:"attributes,omitempty"` + Type *IncidentConfigurationType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_configuration_data_response.go b/api/datadogV2/model_incident_configuration_data_response.go new file mode 100644 index 00000000000..2db220e4f6e --- /dev/null +++ b/api/datadogV2/model_incident_configuration_data_response.go @@ -0,0 +1,218 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentConfigurationDataResponse Incident configuration data in a response. +type IncidentConfigurationDataResponse struct { + // Attributes of an incident configuration in a response. + Attributes IncidentConfigurationDataAttributesResponse `json:"attributes"` + // The incident configuration identifier. + Id uuid.UUID `json:"id"` + // Relationships for an incident configuration. + Relationships *IncidentConfigurationRelationships `json:"relationships,omitempty"` + // Incident configuration resource type. + Type IncidentConfigurationType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentConfigurationDataResponse instantiates a new IncidentConfigurationDataResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentConfigurationDataResponse(attributes IncidentConfigurationDataAttributesResponse, id uuid.UUID, typeVar IncidentConfigurationType) *IncidentConfigurationDataResponse { + this := IncidentConfigurationDataResponse{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentConfigurationDataResponseWithDefaults instantiates a new IncidentConfigurationDataResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentConfigurationDataResponseWithDefaults() *IncidentConfigurationDataResponse { + this := IncidentConfigurationDataResponse{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentConfigurationDataResponse) GetAttributes() IncidentConfigurationDataAttributesResponse { + if o == nil { + var ret IncidentConfigurationDataAttributesResponse + 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 *IncidentConfigurationDataResponse) GetAttributesOk() (*IncidentConfigurationDataAttributesResponse, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentConfigurationDataResponse) SetAttributes(v IncidentConfigurationDataAttributesResponse) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *IncidentConfigurationDataResponse) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentConfigurationDataResponse) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentConfigurationDataResponse) SetId(v uuid.UUID) { + o.Id = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentConfigurationDataResponse) GetRelationships() IncidentConfigurationRelationships { + if o == nil || o.Relationships == nil { + var ret IncidentConfigurationRelationships + 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 *IncidentConfigurationDataResponse) GetRelationshipsOk() (*IncidentConfigurationRelationships, 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 *IncidentConfigurationDataResponse) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given IncidentConfigurationRelationships and assigns it to the Relationships field. +func (o *IncidentConfigurationDataResponse) SetRelationships(v IncidentConfigurationRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *IncidentConfigurationDataResponse) GetType() IncidentConfigurationType { + if o == nil { + var ret IncidentConfigurationType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationDataResponse) GetTypeOk() (*IncidentConfigurationType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentConfigurationDataResponse) SetType(v IncidentConfigurationType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentConfigurationDataResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentConfigurationDataResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentConfigurationDataAttributesResponse `json:"attributes"` + Id *uuid.UUID `json:"id"` + Relationships *IncidentConfigurationRelationships `json:"relationships,omitempty"` + Type *IncidentConfigurationType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_configuration_patch_data_attributes_request.go b/api/datadogV2/model_incident_configuration_patch_data_attributes_request.go new file mode 100644 index 00000000000..e692bb40658 --- /dev/null +++ b/api/datadogV2/model_incident_configuration_patch_data_attributes_request.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentConfigurationPatchDataAttributesRequest Attributes for patching an incident configuration. All fields are optional. +type IncidentConfigurationPatchDataAttributesRequest struct { + // Whether to execute integrations for this incident. + ExecuteIntegrations *bool `json:"execute_integrations,omitempty"` + // Whether to execute notification rules for this incident. + ExecuteNotificationRules *bool `json:"execute_notification_rules,omitempty"` + // Whether to include this incident in analytics. + IncludeInAnalytics *bool `json:"include_in_analytics,omitempty"` + // Whether to include this incident in search results. + IncludeInSearch *bool `json:"include_in_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{} `json:"-"` +} + +// NewIncidentConfigurationPatchDataAttributesRequest instantiates a new IncidentConfigurationPatchDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentConfigurationPatchDataAttributesRequest() *IncidentConfigurationPatchDataAttributesRequest { + this := IncidentConfigurationPatchDataAttributesRequest{} + return &this +} + +// NewIncidentConfigurationPatchDataAttributesRequestWithDefaults instantiates a new IncidentConfigurationPatchDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentConfigurationPatchDataAttributesRequestWithDefaults() *IncidentConfigurationPatchDataAttributesRequest { + this := IncidentConfigurationPatchDataAttributesRequest{} + return &this +} + +// GetExecuteIntegrations returns the ExecuteIntegrations field value if set, zero value otherwise. +func (o *IncidentConfigurationPatchDataAttributesRequest) GetExecuteIntegrations() bool { + if o == nil || o.ExecuteIntegrations == nil { + var ret bool + return ret + } + return *o.ExecuteIntegrations +} + +// GetExecuteIntegrationsOk returns a tuple with the ExecuteIntegrations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationPatchDataAttributesRequest) GetExecuteIntegrationsOk() (*bool, bool) { + if o == nil || o.ExecuteIntegrations == nil { + return nil, false + } + return o.ExecuteIntegrations, true +} + +// HasExecuteIntegrations returns a boolean if a field has been set. +func (o *IncidentConfigurationPatchDataAttributesRequest) HasExecuteIntegrations() bool { + return o != nil && o.ExecuteIntegrations != nil +} + +// SetExecuteIntegrations gets a reference to the given bool and assigns it to the ExecuteIntegrations field. +func (o *IncidentConfigurationPatchDataAttributesRequest) SetExecuteIntegrations(v bool) { + o.ExecuteIntegrations = &v +} + +// GetExecuteNotificationRules returns the ExecuteNotificationRules field value if set, zero value otherwise. +func (o *IncidentConfigurationPatchDataAttributesRequest) GetExecuteNotificationRules() bool { + if o == nil || o.ExecuteNotificationRules == nil { + var ret bool + return ret + } + return *o.ExecuteNotificationRules +} + +// GetExecuteNotificationRulesOk returns a tuple with the ExecuteNotificationRules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationPatchDataAttributesRequest) GetExecuteNotificationRulesOk() (*bool, bool) { + if o == nil || o.ExecuteNotificationRules == nil { + return nil, false + } + return o.ExecuteNotificationRules, true +} + +// HasExecuteNotificationRules returns a boolean if a field has been set. +func (o *IncidentConfigurationPatchDataAttributesRequest) HasExecuteNotificationRules() bool { + return o != nil && o.ExecuteNotificationRules != nil +} + +// SetExecuteNotificationRules gets a reference to the given bool and assigns it to the ExecuteNotificationRules field. +func (o *IncidentConfigurationPatchDataAttributesRequest) SetExecuteNotificationRules(v bool) { + o.ExecuteNotificationRules = &v +} + +// GetIncludeInAnalytics returns the IncludeInAnalytics field value if set, zero value otherwise. +func (o *IncidentConfigurationPatchDataAttributesRequest) GetIncludeInAnalytics() bool { + if o == nil || o.IncludeInAnalytics == nil { + var ret bool + return ret + } + return *o.IncludeInAnalytics +} + +// GetIncludeInAnalyticsOk returns a tuple with the IncludeInAnalytics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationPatchDataAttributesRequest) GetIncludeInAnalyticsOk() (*bool, bool) { + if o == nil || o.IncludeInAnalytics == nil { + return nil, false + } + return o.IncludeInAnalytics, true +} + +// HasIncludeInAnalytics returns a boolean if a field has been set. +func (o *IncidentConfigurationPatchDataAttributesRequest) HasIncludeInAnalytics() bool { + return o != nil && o.IncludeInAnalytics != nil +} + +// SetIncludeInAnalytics gets a reference to the given bool and assigns it to the IncludeInAnalytics field. +func (o *IncidentConfigurationPatchDataAttributesRequest) SetIncludeInAnalytics(v bool) { + o.IncludeInAnalytics = &v +} + +// GetIncludeInSearch returns the IncludeInSearch field value if set, zero value otherwise. +func (o *IncidentConfigurationPatchDataAttributesRequest) GetIncludeInSearch() bool { + if o == nil || o.IncludeInSearch == nil { + var ret bool + return ret + } + return *o.IncludeInSearch +} + +// GetIncludeInSearchOk returns a tuple with the IncludeInSearch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationPatchDataAttributesRequest) GetIncludeInSearchOk() (*bool, bool) { + if o == nil || o.IncludeInSearch == nil { + return nil, false + } + return o.IncludeInSearch, true +} + +// HasIncludeInSearch returns a boolean if a field has been set. +func (o *IncidentConfigurationPatchDataAttributesRequest) HasIncludeInSearch() bool { + return o != nil && o.IncludeInSearch != nil +} + +// SetIncludeInSearch gets a reference to the given bool and assigns it to the IncludeInSearch field. +func (o *IncidentConfigurationPatchDataAttributesRequest) SetIncludeInSearch(v bool) { + o.IncludeInSearch = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentConfigurationPatchDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ExecuteIntegrations != nil { + toSerialize["execute_integrations"] = o.ExecuteIntegrations + } + if o.ExecuteNotificationRules != nil { + toSerialize["execute_notification_rules"] = o.ExecuteNotificationRules + } + if o.IncludeInAnalytics != nil { + toSerialize["include_in_analytics"] = o.IncludeInAnalytics + } + if o.IncludeInSearch != nil { + toSerialize["include_in_search"] = o.IncludeInSearch + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentConfigurationPatchDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ExecuteIntegrations *bool `json:"execute_integrations,omitempty"` + ExecuteNotificationRules *bool `json:"execute_notification_rules,omitempty"` + IncludeInAnalytics *bool `json:"include_in_analytics,omitempty"` + IncludeInSearch *bool `json:"include_in_search,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"execute_integrations", "execute_notification_rules", "include_in_analytics", "include_in_search"}) + } else { + return err + } + o.ExecuteIntegrations = all.ExecuteIntegrations + o.ExecuteNotificationRules = all.ExecuteNotificationRules + o.IncludeInAnalytics = all.IncludeInAnalytics + o.IncludeInSearch = all.IncludeInSearch + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_configuration_patch_data_request.go b/api/datadogV2/model_incident_configuration_patch_data_request.go new file mode 100644 index 00000000000..e204960b862 --- /dev/null +++ b/api/datadogV2/model_incident_configuration_patch_data_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 datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentConfigurationPatchDataRequest Incident configuration data in a patch request. +type IncidentConfigurationPatchDataRequest struct { + // Attributes for patching an incident configuration. All fields are optional. + Attributes *IncidentConfigurationPatchDataAttributesRequest `json:"attributes,omitempty"` + // The incident configuration identifier. + Id uuid.UUID `json:"id"` + // Incident configuration resource type. + Type IncidentConfigurationType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentConfigurationPatchDataRequest instantiates a new IncidentConfigurationPatchDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentConfigurationPatchDataRequest(id uuid.UUID, typeVar IncidentConfigurationType) *IncidentConfigurationPatchDataRequest { + this := IncidentConfigurationPatchDataRequest{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentConfigurationPatchDataRequestWithDefaults instantiates a new IncidentConfigurationPatchDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentConfigurationPatchDataRequestWithDefaults() *IncidentConfigurationPatchDataRequest { + this := IncidentConfigurationPatchDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *IncidentConfigurationPatchDataRequest) GetAttributes() IncidentConfigurationPatchDataAttributesRequest { + if o == nil || o.Attributes == nil { + var ret IncidentConfigurationPatchDataAttributesRequest + 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 *IncidentConfigurationPatchDataRequest) GetAttributesOk() (*IncidentConfigurationPatchDataAttributesRequest, 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 *IncidentConfigurationPatchDataRequest) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given IncidentConfigurationPatchDataAttributesRequest and assigns it to the Attributes field. +func (o *IncidentConfigurationPatchDataRequest) SetAttributes(v IncidentConfigurationPatchDataAttributesRequest) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *IncidentConfigurationPatchDataRequest) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentConfigurationPatchDataRequest) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentConfigurationPatchDataRequest) SetId(v uuid.UUID) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *IncidentConfigurationPatchDataRequest) GetType() IncidentConfigurationType { + if o == nil { + var ret IncidentConfigurationType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentConfigurationPatchDataRequest) GetTypeOk() (*IncidentConfigurationType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentConfigurationPatchDataRequest) SetType(v IncidentConfigurationType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentConfigurationPatchDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentConfigurationPatchDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentConfigurationPatchDataAttributesRequest `json:"attributes,omitempty"` + Id *uuid.UUID `json:"id"` + Type *IncidentConfigurationType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_configuration_patch_request.go b/api/datadogV2/model_incident_configuration_patch_request.go new file mode 100644 index 00000000000..e1c0aea43ba --- /dev/null +++ b/api/datadogV2/model_incident_configuration_patch_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentConfigurationPatchRequest Request payload for patching an incident configuration. +type IncidentConfigurationPatchRequest struct { + // Incident configuration data in a patch request. + Data IncidentConfigurationPatchDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentConfigurationPatchRequest instantiates a new IncidentConfigurationPatchRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentConfigurationPatchRequest(data IncidentConfigurationPatchDataRequest) *IncidentConfigurationPatchRequest { + this := IncidentConfigurationPatchRequest{} + this.Data = data + return &this +} + +// NewIncidentConfigurationPatchRequestWithDefaults instantiates a new IncidentConfigurationPatchRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentConfigurationPatchRequestWithDefaults() *IncidentConfigurationPatchRequest { + this := IncidentConfigurationPatchRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentConfigurationPatchRequest) GetData() IncidentConfigurationPatchDataRequest { + if o == nil { + var ret IncidentConfigurationPatchDataRequest + 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 *IncidentConfigurationPatchRequest) GetDataOk() (*IncidentConfigurationPatchDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentConfigurationPatchRequest) SetData(v IncidentConfigurationPatchDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentConfigurationPatchRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentConfigurationPatchRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentConfigurationPatchDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_configuration_relationships.go b/api/datadogV2/model_incident_configuration_relationships.go new file mode 100644 index 00000000000..4c6b315ce41 --- /dev/null +++ b/api/datadogV2/model_incident_configuration_relationships.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentConfigurationRelationships Relationships for an incident configuration. +type IncidentConfigurationRelationships struct { + // Relationship to user. + CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"` + // Relationship to user. + LastModifiedByUser *RelationshipToUser `json:"last_modified_by_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{} `json:"-"` +} + +// NewIncidentConfigurationRelationships instantiates a new IncidentConfigurationRelationships object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentConfigurationRelationships() *IncidentConfigurationRelationships { + this := IncidentConfigurationRelationships{} + return &this +} + +// NewIncidentConfigurationRelationshipsWithDefaults instantiates a new IncidentConfigurationRelationships object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentConfigurationRelationshipsWithDefaults() *IncidentConfigurationRelationships { + this := IncidentConfigurationRelationships{} + return &this +} + +// GetCreatedByUser returns the CreatedByUser field value if set, zero value otherwise. +func (o *IncidentConfigurationRelationships) 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 *IncidentConfigurationRelationships) 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 *IncidentConfigurationRelationships) HasCreatedByUser() bool { + return o != nil && o.CreatedByUser != nil +} + +// SetCreatedByUser gets a reference to the given RelationshipToUser and assigns it to the CreatedByUser field. +func (o *IncidentConfigurationRelationships) SetCreatedByUser(v RelationshipToUser) { + o.CreatedByUser = &v +} + +// GetLastModifiedByUser returns the LastModifiedByUser field value if set, zero value otherwise. +func (o *IncidentConfigurationRelationships) 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 *IncidentConfigurationRelationships) 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 *IncidentConfigurationRelationships) HasLastModifiedByUser() bool { + return o != nil && o.LastModifiedByUser != nil +} + +// SetLastModifiedByUser gets a reference to the given RelationshipToUser and assigns it to the LastModifiedByUser field. +func (o *IncidentConfigurationRelationships) SetLastModifiedByUser(v RelationshipToUser) { + o.LastModifiedByUser = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentConfigurationRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CreatedByUser != nil { + toSerialize["created_by_user"] = o.CreatedByUser + } + if o.LastModifiedByUser != nil { + toSerialize["last_modified_by_user"] = o.LastModifiedByUser + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentConfigurationRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"` + LastModifiedByUser *RelationshipToUser `json:"last_modified_by_user,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_by_user", "last_modified_by_user"}) + } else { + return err + } + + hasInvalidField := false + if all.CreatedByUser != nil && all.CreatedByUser.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CreatedByUser = all.CreatedByUser + if all.LastModifiedByUser != nil && all.LastModifiedByUser.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LastModifiedByUser = all.LastModifiedByUser + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_configuration_request.go b/api/datadogV2/model_incident_configuration_request.go new file mode 100644 index 00000000000..fbbec53456b --- /dev/null +++ b/api/datadogV2/model_incident_configuration_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentConfigurationRequest Request payload for creating an incident configuration. +type IncidentConfigurationRequest struct { + // Incident configuration data in a create request. + Data IncidentConfigurationDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentConfigurationRequest instantiates a new IncidentConfigurationRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentConfigurationRequest(data IncidentConfigurationDataRequest) *IncidentConfigurationRequest { + this := IncidentConfigurationRequest{} + this.Data = data + return &this +} + +// NewIncidentConfigurationRequestWithDefaults instantiates a new IncidentConfigurationRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentConfigurationRequestWithDefaults() *IncidentConfigurationRequest { + this := IncidentConfigurationRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentConfigurationRequest) GetData() IncidentConfigurationDataRequest { + if o == nil { + var ret IncidentConfigurationDataRequest + 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 *IncidentConfigurationRequest) GetDataOk() (*IncidentConfigurationDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentConfigurationRequest) SetData(v IncidentConfigurationDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentConfigurationRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentConfigurationRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentConfigurationDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_configuration_response.go b/api/datadogV2/model_incident_configuration_response.go new file mode 100644 index 00000000000..4f9d797354b --- /dev/null +++ b/api/datadogV2/model_incident_configuration_response.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentConfigurationResponse Response with an incident configuration. +type IncidentConfigurationResponse struct { + // Incident configuration data in a response. + Data IncidentConfigurationDataResponse `json:"data"` + // Included related resources. + Included []IncidentUserData `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{} `json:"-"` +} + +// NewIncidentConfigurationResponse instantiates a new IncidentConfigurationResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentConfigurationResponse(data IncidentConfigurationDataResponse) *IncidentConfigurationResponse { + this := IncidentConfigurationResponse{} + this.Data = data + return &this +} + +// NewIncidentConfigurationResponseWithDefaults instantiates a new IncidentConfigurationResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentConfigurationResponseWithDefaults() *IncidentConfigurationResponse { + this := IncidentConfigurationResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentConfigurationResponse) GetData() IncidentConfigurationDataResponse { + if o == nil { + var ret IncidentConfigurationDataResponse + 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 *IncidentConfigurationResponse) GetDataOk() (*IncidentConfigurationDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentConfigurationResponse) SetData(v IncidentConfigurationDataResponse) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentConfigurationResponse) GetIncluded() []IncidentUserData { + if o == nil || o.Included == nil { + var ret []IncidentUserData + 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 *IncidentConfigurationResponse) GetIncludedOk() (*[]IncidentUserData, 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 *IncidentConfigurationResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []IncidentUserData and assigns it to the Included field. +func (o *IncidentConfigurationResponse) SetIncluded(v []IncidentUserData) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentConfigurationResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentConfigurationResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentConfigurationDataResponse `json:"data"` + Included []IncidentUserData `json:"included,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + o.Included = all.Included + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_configuration_type.go b/api/datadogV2/model_incident_configuration_type.go new file mode 100644 index 00000000000..bf9c9be1102 --- /dev/null +++ b/api/datadogV2/model_incident_configuration_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentConfigurationType Incident configuration resource type. +type IncidentConfigurationType string + +// List of IncidentConfigurationType. +const ( + INCIDENTCONFIGURATIONTYPE_INCIDENTS_CONFIGURATIONS IncidentConfigurationType = "incidents_configurations" +) + +var allowedIncidentConfigurationTypeEnumValues = []IncidentConfigurationType{ + INCIDENTCONFIGURATIONTYPE_INCIDENTS_CONFIGURATIONS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentConfigurationType) GetAllowedValues() []IncidentConfigurationType { + return allowedIncidentConfigurationTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentConfigurationType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentConfigurationType(value) + return nil +} + +// NewIncidentConfigurationTypeFromValue returns a pointer to a valid IncidentConfigurationType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentConfigurationTypeFromValue(v string) (*IncidentConfigurationType, error) { + ev := IncidentConfigurationType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentConfigurationType: valid values are %v", v, allowedIncidentConfigurationTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentConfigurationType) IsValid() bool { + for _, existing := range allowedIncidentConfigurationTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentConfigurationType value. +func (v IncidentConfigurationType) Ptr() *IncidentConfigurationType { + return &v +} diff --git a/api/datadogV2/model_incident_create_on_call_page_data_attributes_request.go b/api/datadogV2/model_incident_create_on_call_page_data_attributes_request.go new file mode 100644 index 00000000000..c8b6ecd780a --- /dev/null +++ b/api/datadogV2/model_incident_create_on_call_page_data_attributes_request.go @@ -0,0 +1,289 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentCreateOnCallPageDataAttributesRequest Attributes for creating an on-call page from an incident. +type IncidentCreateOnCallPageDataAttributesRequest struct { + // The description of the page. + Description *string `json:"description,omitempty"` + // A reference to an incident role for a page. + Role *IncidentPageRoleReference `json:"role,omitempty"` + // List of affected services. + Services []string `json:"services,omitempty"` + // List of tags for the page. + Tags []string `json:"tags,omitempty"` + // The target recipient for a page. + Target *IncidentPageTarget `json:"target,omitempty"` + // The title of the page. + 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{} `json:"-"` +} + +// NewIncidentCreateOnCallPageDataAttributesRequest instantiates a new IncidentCreateOnCallPageDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentCreateOnCallPageDataAttributesRequest() *IncidentCreateOnCallPageDataAttributesRequest { + this := IncidentCreateOnCallPageDataAttributesRequest{} + return &this +} + +// NewIncidentCreateOnCallPageDataAttributesRequestWithDefaults instantiates a new IncidentCreateOnCallPageDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentCreateOnCallPageDataAttributesRequestWithDefaults() *IncidentCreateOnCallPageDataAttributesRequest { + this := IncidentCreateOnCallPageDataAttributesRequest{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *IncidentCreateOnCallPageDataAttributesRequest) 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 *IncidentCreateOnCallPageDataAttributesRequest) 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 *IncidentCreateOnCallPageDataAttributesRequest) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *IncidentCreateOnCallPageDataAttributesRequest) SetDescription(v string) { + o.Description = &v +} + +// GetRole returns the Role field value if set, zero value otherwise. +func (o *IncidentCreateOnCallPageDataAttributesRequest) GetRole() IncidentPageRoleReference { + if o == nil || o.Role == nil { + var ret IncidentPageRoleReference + 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 *IncidentCreateOnCallPageDataAttributesRequest) GetRoleOk() (*IncidentPageRoleReference, 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 *IncidentCreateOnCallPageDataAttributesRequest) HasRole() bool { + return o != nil && o.Role != nil +} + +// SetRole gets a reference to the given IncidentPageRoleReference and assigns it to the Role field. +func (o *IncidentCreateOnCallPageDataAttributesRequest) SetRole(v IncidentPageRoleReference) { + o.Role = &v +} + +// GetServices returns the Services field value if set, zero value otherwise. +func (o *IncidentCreateOnCallPageDataAttributesRequest) 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 *IncidentCreateOnCallPageDataAttributesRequest) 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 *IncidentCreateOnCallPageDataAttributesRequest) HasServices() bool { + return o != nil && o.Services != nil +} + +// SetServices gets a reference to the given []string and assigns it to the Services field. +func (o *IncidentCreateOnCallPageDataAttributesRequest) SetServices(v []string) { + o.Services = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *IncidentCreateOnCallPageDataAttributesRequest) 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 *IncidentCreateOnCallPageDataAttributesRequest) 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 *IncidentCreateOnCallPageDataAttributesRequest) HasTags() bool { + return o != nil && o.Tags != nil +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *IncidentCreateOnCallPageDataAttributesRequest) SetTags(v []string) { + o.Tags = v +} + +// GetTarget returns the Target field value if set, zero value otherwise. +func (o *IncidentCreateOnCallPageDataAttributesRequest) GetTarget() IncidentPageTarget { + if o == nil || o.Target == nil { + var ret IncidentPageTarget + 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 *IncidentCreateOnCallPageDataAttributesRequest) GetTargetOk() (*IncidentPageTarget, 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 *IncidentCreateOnCallPageDataAttributesRequest) HasTarget() bool { + return o != nil && o.Target != nil +} + +// SetTarget gets a reference to the given IncidentPageTarget and assigns it to the Target field. +func (o *IncidentCreateOnCallPageDataAttributesRequest) SetTarget(v IncidentPageTarget) { + o.Target = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *IncidentCreateOnCallPageDataAttributesRequest) 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 *IncidentCreateOnCallPageDataAttributesRequest) 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 *IncidentCreateOnCallPageDataAttributesRequest) HasTitle() bool { + return o != nil && o.Title != nil +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *IncidentCreateOnCallPageDataAttributesRequest) SetTitle(v string) { + o.Title = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentCreateOnCallPageDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Role != nil { + toSerialize["role"] = o.Role + } + if o.Services != nil { + toSerialize["services"] = o.Services + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Target != nil { + toSerialize["target"] = o.Target + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentCreateOnCallPageDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Description *string `json:"description,omitempty"` + Role *IncidentPageRoleReference `json:"role,omitempty"` + Services []string `json:"services,omitempty"` + Tags []string `json:"tags,omitempty"` + Target *IncidentPageTarget `json:"target,omitempty"` + Title *string `json:"title,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"description", "role", "services", "tags", "target", "title"}) + } else { + return err + } + + hasInvalidField := false + o.Description = all.Description + if all.Role != nil && all.Role.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Role = all.Role + o.Services = all.Services + o.Tags = all.Tags + if all.Target != nil && all.Target.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Target = all.Target + o.Title = all.Title + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_create_on_call_page_data_request.go b/api/datadogV2/model_incident_create_on_call_page_data_request.go new file mode 100644 index 00000000000..a6c8a6ced4d --- /dev/null +++ b/api/datadogV2/model_incident_create_on_call_page_data_request.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentCreateOnCallPageDataRequest On-call page data in a create request. +type IncidentCreateOnCallPageDataRequest struct { + // Attributes for creating an on-call page from an incident. + Attributes IncidentCreateOnCallPageDataAttributesRequest `json:"attributes"` + // Resource type for a page creation request. + Type IncidentCreatePageFromIncidentType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentCreateOnCallPageDataRequest instantiates a new IncidentCreateOnCallPageDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentCreateOnCallPageDataRequest(attributes IncidentCreateOnCallPageDataAttributesRequest, typeVar IncidentCreatePageFromIncidentType) *IncidentCreateOnCallPageDataRequest { + this := IncidentCreateOnCallPageDataRequest{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewIncidentCreateOnCallPageDataRequestWithDefaults instantiates a new IncidentCreateOnCallPageDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentCreateOnCallPageDataRequestWithDefaults() *IncidentCreateOnCallPageDataRequest { + this := IncidentCreateOnCallPageDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentCreateOnCallPageDataRequest) GetAttributes() IncidentCreateOnCallPageDataAttributesRequest { + if o == nil { + var ret IncidentCreateOnCallPageDataAttributesRequest + 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 *IncidentCreateOnCallPageDataRequest) GetAttributesOk() (*IncidentCreateOnCallPageDataAttributesRequest, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentCreateOnCallPageDataRequest) SetAttributes(v IncidentCreateOnCallPageDataAttributesRequest) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *IncidentCreateOnCallPageDataRequest) GetType() IncidentCreatePageFromIncidentType { + if o == nil { + var ret IncidentCreatePageFromIncidentType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentCreateOnCallPageDataRequest) GetTypeOk() (*IncidentCreatePageFromIncidentType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentCreateOnCallPageDataRequest) SetType(v IncidentCreatePageFromIncidentType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentCreateOnCallPageDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentCreateOnCallPageDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentCreateOnCallPageDataAttributesRequest `json:"attributes"` + Type *IncidentCreatePageFromIncidentType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_create_on_call_page_request.go b/api/datadogV2/model_incident_create_on_call_page_request.go new file mode 100644 index 00000000000..456f0ae48c9 --- /dev/null +++ b/api/datadogV2/model_incident_create_on_call_page_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentCreateOnCallPageRequest Request payload for creating an on-call page from an incident. +type IncidentCreateOnCallPageRequest struct { + // On-call page data in a create request. + Data IncidentCreateOnCallPageDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentCreateOnCallPageRequest instantiates a new IncidentCreateOnCallPageRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentCreateOnCallPageRequest(data IncidentCreateOnCallPageDataRequest) *IncidentCreateOnCallPageRequest { + this := IncidentCreateOnCallPageRequest{} + this.Data = data + return &this +} + +// NewIncidentCreateOnCallPageRequestWithDefaults instantiates a new IncidentCreateOnCallPageRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentCreateOnCallPageRequestWithDefaults() *IncidentCreateOnCallPageRequest { + this := IncidentCreateOnCallPageRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentCreateOnCallPageRequest) GetData() IncidentCreateOnCallPageDataRequest { + if o == nil { + var ret IncidentCreateOnCallPageDataRequest + 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 *IncidentCreateOnCallPageRequest) GetDataOk() (*IncidentCreateOnCallPageDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentCreateOnCallPageRequest) SetData(v IncidentCreateOnCallPageDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentCreateOnCallPageRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentCreateOnCallPageRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentCreateOnCallPageDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_create_page_from_incident_data_attributes_request.go b/api/datadogV2/model_incident_create_page_from_incident_data_attributes_request.go new file mode 100644 index 00000000000..acfa227e570 --- /dev/null +++ b/api/datadogV2/model_incident_create_page_from_incident_data_attributes_request.go @@ -0,0 +1,324 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentCreatePageFromIncidentDataAttributesRequest Attributes for creating a page from an incident. +type IncidentCreatePageFromIncidentDataAttributesRequest struct { + // The description of the page. + Description *string `json:"description,omitempty"` + // The public ID of the incident. + IncidentPublicId *string `json:"incident_public_id,omitempty"` + // A reference to an incident role for a page. + Role *IncidentPageRoleReference `json:"role,omitempty"` + // List of affected services. + Services []string `json:"services,omitempty"` + // List of tags for the page. + Tags []string `json:"tags,omitempty"` + // The target recipient for a page. + Target *IncidentPageTarget `json:"target,omitempty"` + // The title of the page. + 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{} `json:"-"` +} + +// NewIncidentCreatePageFromIncidentDataAttributesRequest instantiates a new IncidentCreatePageFromIncidentDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentCreatePageFromIncidentDataAttributesRequest() *IncidentCreatePageFromIncidentDataAttributesRequest { + this := IncidentCreatePageFromIncidentDataAttributesRequest{} + return &this +} + +// NewIncidentCreatePageFromIncidentDataAttributesRequestWithDefaults instantiates a new IncidentCreatePageFromIncidentDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentCreatePageFromIncidentDataAttributesRequestWithDefaults() *IncidentCreatePageFromIncidentDataAttributesRequest { + this := IncidentCreatePageFromIncidentDataAttributesRequest{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) 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 *IncidentCreatePageFromIncidentDataAttributesRequest) 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 *IncidentCreatePageFromIncidentDataAttributesRequest) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) SetDescription(v string) { + o.Description = &v +} + +// GetIncidentPublicId returns the IncidentPublicId field value if set, zero value otherwise. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) GetIncidentPublicId() string { + if o == nil || o.IncidentPublicId == nil { + var ret string + return ret + } + return *o.IncidentPublicId +} + +// GetIncidentPublicIdOk returns a tuple with the IncidentPublicId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) GetIncidentPublicIdOk() (*string, bool) { + if o == nil || o.IncidentPublicId == nil { + return nil, false + } + return o.IncidentPublicId, true +} + +// HasIncidentPublicId returns a boolean if a field has been set. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) HasIncidentPublicId() bool { + return o != nil && o.IncidentPublicId != nil +} + +// SetIncidentPublicId gets a reference to the given string and assigns it to the IncidentPublicId field. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) SetIncidentPublicId(v string) { + o.IncidentPublicId = &v +} + +// GetRole returns the Role field value if set, zero value otherwise. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) GetRole() IncidentPageRoleReference { + if o == nil || o.Role == nil { + var ret IncidentPageRoleReference + 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 *IncidentCreatePageFromIncidentDataAttributesRequest) GetRoleOk() (*IncidentPageRoleReference, 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 *IncidentCreatePageFromIncidentDataAttributesRequest) HasRole() bool { + return o != nil && o.Role != nil +} + +// SetRole gets a reference to the given IncidentPageRoleReference and assigns it to the Role field. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) SetRole(v IncidentPageRoleReference) { + o.Role = &v +} + +// GetServices returns the Services field value if set, zero value otherwise. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) 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 *IncidentCreatePageFromIncidentDataAttributesRequest) 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 *IncidentCreatePageFromIncidentDataAttributesRequest) HasServices() bool { + return o != nil && o.Services != nil +} + +// SetServices gets a reference to the given []string and assigns it to the Services field. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) SetServices(v []string) { + o.Services = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) 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 *IncidentCreatePageFromIncidentDataAttributesRequest) 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 *IncidentCreatePageFromIncidentDataAttributesRequest) HasTags() bool { + return o != nil && o.Tags != nil +} + +// SetTags gets a reference to the given []string and assigns it to the Tags field. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) SetTags(v []string) { + o.Tags = v +} + +// GetTarget returns the Target field value if set, zero value otherwise. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) GetTarget() IncidentPageTarget { + if o == nil || o.Target == nil { + var ret IncidentPageTarget + 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 *IncidentCreatePageFromIncidentDataAttributesRequest) GetTargetOk() (*IncidentPageTarget, 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 *IncidentCreatePageFromIncidentDataAttributesRequest) HasTarget() bool { + return o != nil && o.Target != nil +} + +// SetTarget gets a reference to the given IncidentPageTarget and assigns it to the Target field. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) SetTarget(v IncidentPageTarget) { + o.Target = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) 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 *IncidentCreatePageFromIncidentDataAttributesRequest) 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 *IncidentCreatePageFromIncidentDataAttributesRequest) HasTitle() bool { + return o != nil && o.Title != nil +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) SetTitle(v string) { + o.Title = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentCreatePageFromIncidentDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.IncidentPublicId != nil { + toSerialize["incident_public_id"] = o.IncidentPublicId + } + if o.Role != nil { + toSerialize["role"] = o.Role + } + if o.Services != nil { + toSerialize["services"] = o.Services + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Target != nil { + toSerialize["target"] = o.Target + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentCreatePageFromIncidentDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Description *string `json:"description,omitempty"` + IncidentPublicId *string `json:"incident_public_id,omitempty"` + Role *IncidentPageRoleReference `json:"role,omitempty"` + Services []string `json:"services,omitempty"` + Tags []string `json:"tags,omitempty"` + Target *IncidentPageTarget `json:"target,omitempty"` + Title *string `json:"title,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"description", "incident_public_id", "role", "services", "tags", "target", "title"}) + } else { + return err + } + + hasInvalidField := false + o.Description = all.Description + o.IncidentPublicId = all.IncidentPublicId + if all.Role != nil && all.Role.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Role = all.Role + o.Services = all.Services + o.Tags = all.Tags + if all.Target != nil && all.Target.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Target = all.Target + o.Title = all.Title + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_create_page_from_incident_data_request.go b/api/datadogV2/model_incident_create_page_from_incident_data_request.go new file mode 100644 index 00000000000..c670eba80bd --- /dev/null +++ b/api/datadogV2/model_incident_create_page_from_incident_data_request.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentCreatePageFromIncidentDataRequest Page data in a create request. +type IncidentCreatePageFromIncidentDataRequest struct { + // Attributes for creating a page from an incident. + Attributes IncidentCreatePageFromIncidentDataAttributesRequest `json:"attributes"` + // Resource type for a page creation request. + Type IncidentCreatePageFromIncidentType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentCreatePageFromIncidentDataRequest instantiates a new IncidentCreatePageFromIncidentDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentCreatePageFromIncidentDataRequest(attributes IncidentCreatePageFromIncidentDataAttributesRequest, typeVar IncidentCreatePageFromIncidentType) *IncidentCreatePageFromIncidentDataRequest { + this := IncidentCreatePageFromIncidentDataRequest{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewIncidentCreatePageFromIncidentDataRequestWithDefaults instantiates a new IncidentCreatePageFromIncidentDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentCreatePageFromIncidentDataRequestWithDefaults() *IncidentCreatePageFromIncidentDataRequest { + this := IncidentCreatePageFromIncidentDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentCreatePageFromIncidentDataRequest) GetAttributes() IncidentCreatePageFromIncidentDataAttributesRequest { + if o == nil { + var ret IncidentCreatePageFromIncidentDataAttributesRequest + 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 *IncidentCreatePageFromIncidentDataRequest) GetAttributesOk() (*IncidentCreatePageFromIncidentDataAttributesRequest, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentCreatePageFromIncidentDataRequest) SetAttributes(v IncidentCreatePageFromIncidentDataAttributesRequest) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *IncidentCreatePageFromIncidentDataRequest) GetType() IncidentCreatePageFromIncidentType { + if o == nil { + var ret IncidentCreatePageFromIncidentType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentCreatePageFromIncidentDataRequest) GetTypeOk() (*IncidentCreatePageFromIncidentType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentCreatePageFromIncidentDataRequest) SetType(v IncidentCreatePageFromIncidentType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentCreatePageFromIncidentDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentCreatePageFromIncidentDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentCreatePageFromIncidentDataAttributesRequest `json:"attributes"` + Type *IncidentCreatePageFromIncidentType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_create_page_from_incident_request.go b/api/datadogV2/model_incident_create_page_from_incident_request.go new file mode 100644 index 00000000000..f9f8914b765 --- /dev/null +++ b/api/datadogV2/model_incident_create_page_from_incident_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentCreatePageFromIncidentRequest Request payload for creating a page from an incident. +type IncidentCreatePageFromIncidentRequest struct { + // Page data in a create request. + Data IncidentCreatePageFromIncidentDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentCreatePageFromIncidentRequest instantiates a new IncidentCreatePageFromIncidentRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentCreatePageFromIncidentRequest(data IncidentCreatePageFromIncidentDataRequest) *IncidentCreatePageFromIncidentRequest { + this := IncidentCreatePageFromIncidentRequest{} + this.Data = data + return &this +} + +// NewIncidentCreatePageFromIncidentRequestWithDefaults instantiates a new IncidentCreatePageFromIncidentRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentCreatePageFromIncidentRequestWithDefaults() *IncidentCreatePageFromIncidentRequest { + this := IncidentCreatePageFromIncidentRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentCreatePageFromIncidentRequest) GetData() IncidentCreatePageFromIncidentDataRequest { + if o == nil { + var ret IncidentCreatePageFromIncidentDataRequest + 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 *IncidentCreatePageFromIncidentRequest) GetDataOk() (*IncidentCreatePageFromIncidentDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentCreatePageFromIncidentRequest) SetData(v IncidentCreatePageFromIncidentDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentCreatePageFromIncidentRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentCreatePageFromIncidentRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentCreatePageFromIncidentDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_create_page_from_incident_type.go b/api/datadogV2/model_incident_create_page_from_incident_type.go new file mode 100644 index 00000000000..3772bd2d59a --- /dev/null +++ b/api/datadogV2/model_incident_create_page_from_incident_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentCreatePageFromIncidentType Resource type for a page creation request. +type IncidentCreatePageFromIncidentType string + +// List of IncidentCreatePageFromIncidentType. +const ( + INCIDENTCREATEPAGEFROMINCIDENTTYPE_PAGE IncidentCreatePageFromIncidentType = "page" +) + +var allowedIncidentCreatePageFromIncidentTypeEnumValues = []IncidentCreatePageFromIncidentType{ + INCIDENTCREATEPAGEFROMINCIDENTTYPE_PAGE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentCreatePageFromIncidentType) GetAllowedValues() []IncidentCreatePageFromIncidentType { + return allowedIncidentCreatePageFromIncidentTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentCreatePageFromIncidentType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentCreatePageFromIncidentType(value) + return nil +} + +// NewIncidentCreatePageFromIncidentTypeFromValue returns a pointer to a valid IncidentCreatePageFromIncidentType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentCreatePageFromIncidentTypeFromValue(v string) (*IncidentCreatePageFromIncidentType, error) { + ev := IncidentCreatePageFromIncidentType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentCreatePageFromIncidentType: valid values are %v", v, allowedIncidentCreatePageFromIncidentTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentCreatePageFromIncidentType) IsValid() bool { + for _, existing := range allowedIncidentCreatePageFromIncidentTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentCreatePageFromIncidentType value. +func (v IncidentCreatePageFromIncidentType) Ptr() *IncidentCreatePageFromIncidentType { + return &v +} diff --git a/api/datadogV2/model_incident_google_chat_configuration_data_attributes_request.go b/api/datadogV2/model_incident_google_chat_configuration_data_attributes_request.go new file mode 100644 index 00000000000..72f246c393d --- /dev/null +++ b/api/datadogV2/model_incident_google_chat_configuration_data_attributes_request.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleChatConfigurationDataAttributesRequest Attributes for creating a Google Chat configuration. +type IncidentGoogleChatConfigurationDataAttributesRequest struct { + // The Google Chat domain ID. + DomainId string `json:"domain_id"` + // The template for the Google Chat space name. + SpaceNameTemplate string `json:"space_name_template"` + // The target audience ID for the Google Chat space. + SpaceTargetAudienceId string `json:"space_target_audience_id"` + // The time zone for the Google Chat space. + SpaceTimeZone string `json:"space_time_zone"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleChatConfigurationDataAttributesRequest instantiates a new IncidentGoogleChatConfigurationDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleChatConfigurationDataAttributesRequest(domainId string, spaceNameTemplate string, spaceTargetAudienceId string, spaceTimeZone string) *IncidentGoogleChatConfigurationDataAttributesRequest { + this := IncidentGoogleChatConfigurationDataAttributesRequest{} + this.DomainId = domainId + this.SpaceNameTemplate = spaceNameTemplate + this.SpaceTargetAudienceId = spaceTargetAudienceId + this.SpaceTimeZone = spaceTimeZone + return &this +} + +// NewIncidentGoogleChatConfigurationDataAttributesRequestWithDefaults instantiates a new IncidentGoogleChatConfigurationDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleChatConfigurationDataAttributesRequestWithDefaults() *IncidentGoogleChatConfigurationDataAttributesRequest { + this := IncidentGoogleChatConfigurationDataAttributesRequest{} + return &this +} + +// GetDomainId returns the DomainId field value. +func (o *IncidentGoogleChatConfigurationDataAttributesRequest) GetDomainId() string { + if o == nil { + var ret string + return ret + } + return o.DomainId +} + +// GetDomainIdOk returns a tuple with the DomainId field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationDataAttributesRequest) GetDomainIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DomainId, true +} + +// SetDomainId sets field value. +func (o *IncidentGoogleChatConfigurationDataAttributesRequest) SetDomainId(v string) { + o.DomainId = v +} + +// GetSpaceNameTemplate returns the SpaceNameTemplate field value. +func (o *IncidentGoogleChatConfigurationDataAttributesRequest) GetSpaceNameTemplate() string { + if o == nil { + var ret string + return ret + } + return o.SpaceNameTemplate +} + +// GetSpaceNameTemplateOk returns a tuple with the SpaceNameTemplate field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationDataAttributesRequest) GetSpaceNameTemplateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SpaceNameTemplate, true +} + +// SetSpaceNameTemplate sets field value. +func (o *IncidentGoogleChatConfigurationDataAttributesRequest) SetSpaceNameTemplate(v string) { + o.SpaceNameTemplate = v +} + +// GetSpaceTargetAudienceId returns the SpaceTargetAudienceId field value. +func (o *IncidentGoogleChatConfigurationDataAttributesRequest) GetSpaceTargetAudienceId() string { + if o == nil { + var ret string + return ret + } + return o.SpaceTargetAudienceId +} + +// GetSpaceTargetAudienceIdOk returns a tuple with the SpaceTargetAudienceId field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationDataAttributesRequest) GetSpaceTargetAudienceIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SpaceTargetAudienceId, true +} + +// SetSpaceTargetAudienceId sets field value. +func (o *IncidentGoogleChatConfigurationDataAttributesRequest) SetSpaceTargetAudienceId(v string) { + o.SpaceTargetAudienceId = v +} + +// GetSpaceTimeZone returns the SpaceTimeZone field value. +func (o *IncidentGoogleChatConfigurationDataAttributesRequest) GetSpaceTimeZone() string { + if o == nil { + var ret string + return ret + } + return o.SpaceTimeZone +} + +// GetSpaceTimeZoneOk returns a tuple with the SpaceTimeZone field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationDataAttributesRequest) GetSpaceTimeZoneOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SpaceTimeZone, true +} + +// SetSpaceTimeZone sets field value. +func (o *IncidentGoogleChatConfigurationDataAttributesRequest) SetSpaceTimeZone(v string) { + o.SpaceTimeZone = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleChatConfigurationDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["domain_id"] = o.DomainId + toSerialize["space_name_template"] = o.SpaceNameTemplate + toSerialize["space_target_audience_id"] = o.SpaceTargetAudienceId + toSerialize["space_time_zone"] = o.SpaceTimeZone + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleChatConfigurationDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DomainId *string `json:"domain_id"` + SpaceNameTemplate *string `json:"space_name_template"` + SpaceTargetAudienceId *string `json:"space_target_audience_id"` + SpaceTimeZone *string `json:"space_time_zone"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.DomainId == nil { + return fmt.Errorf("required field domain_id missing") + } + if all.SpaceNameTemplate == nil { + return fmt.Errorf("required field space_name_template missing") + } + if all.SpaceTargetAudienceId == nil { + return fmt.Errorf("required field space_target_audience_id missing") + } + if all.SpaceTimeZone == nil { + return fmt.Errorf("required field space_time_zone missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"domain_id", "space_name_template", "space_target_audience_id", "space_time_zone"}) + } else { + return err + } + o.DomainId = *all.DomainId + o.SpaceNameTemplate = *all.SpaceNameTemplate + o.SpaceTargetAudienceId = *all.SpaceTargetAudienceId + o.SpaceTimeZone = *all.SpaceTimeZone + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_chat_configuration_data_attributes_response.go b/api/datadogV2/model_incident_google_chat_configuration_data_attributes_response.go new file mode 100644 index 00000000000..6db50eb8a51 --- /dev/null +++ b/api/datadogV2/model_incident_google_chat_configuration_data_attributes_response.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 datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleChatConfigurationDataAttributesResponse Attributes of a Google Chat configuration. +type IncidentGoogleChatConfigurationDataAttributesResponse struct { + // Timestamp when the configuration was created. + CreatedAt time.Time `json:"created_at"` + // The Google Chat domain ID. + DomainId string `json:"domain_id"` + // Timestamp when the configuration was last modified. + ModifiedAt time.Time `json:"modified_at"` + // The template for the Google Chat space name. + SpaceNameTemplate string `json:"space_name_template"` + // The target audience ID for the Google Chat space. + SpaceTargetAudienceId string `json:"space_target_audience_id"` + // The time zone for the Google Chat space. + SpaceTimeZone string `json:"space_time_zone"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleChatConfigurationDataAttributesResponse instantiates a new IncidentGoogleChatConfigurationDataAttributesResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleChatConfigurationDataAttributesResponse(createdAt time.Time, domainId string, modifiedAt time.Time, spaceNameTemplate string, spaceTargetAudienceId string, spaceTimeZone string) *IncidentGoogleChatConfigurationDataAttributesResponse { + this := IncidentGoogleChatConfigurationDataAttributesResponse{} + this.CreatedAt = createdAt + this.DomainId = domainId + this.ModifiedAt = modifiedAt + this.SpaceNameTemplate = spaceNameTemplate + this.SpaceTargetAudienceId = spaceTargetAudienceId + this.SpaceTimeZone = spaceTimeZone + return &this +} + +// NewIncidentGoogleChatConfigurationDataAttributesResponseWithDefaults instantiates a new IncidentGoogleChatConfigurationDataAttributesResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleChatConfigurationDataAttributesResponseWithDefaults() *IncidentGoogleChatConfigurationDataAttributesResponse { + this := IncidentGoogleChatConfigurationDataAttributesResponse{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetDomainId returns the DomainId field value. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) GetDomainId() string { + if o == nil { + var ret string + return ret + } + return o.DomainId +} + +// GetDomainIdOk returns a tuple with the DomainId field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) GetDomainIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DomainId, true +} + +// SetDomainId sets field value. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) SetDomainId(v string) { + o.DomainId = v +} + +// GetModifiedAt returns the ModifiedAt field value. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) GetModifiedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) GetModifiedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.ModifiedAt, true +} + +// SetModifiedAt sets field value. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) SetModifiedAt(v time.Time) { + o.ModifiedAt = v +} + +// GetSpaceNameTemplate returns the SpaceNameTemplate field value. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) GetSpaceNameTemplate() string { + if o == nil { + var ret string + return ret + } + return o.SpaceNameTemplate +} + +// GetSpaceNameTemplateOk returns a tuple with the SpaceNameTemplate field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) GetSpaceNameTemplateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SpaceNameTemplate, true +} + +// SetSpaceNameTemplate sets field value. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) SetSpaceNameTemplate(v string) { + o.SpaceNameTemplate = v +} + +// GetSpaceTargetAudienceId returns the SpaceTargetAudienceId field value. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) GetSpaceTargetAudienceId() string { + if o == nil { + var ret string + return ret + } + return o.SpaceTargetAudienceId +} + +// GetSpaceTargetAudienceIdOk returns a tuple with the SpaceTargetAudienceId field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) GetSpaceTargetAudienceIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SpaceTargetAudienceId, true +} + +// SetSpaceTargetAudienceId sets field value. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) SetSpaceTargetAudienceId(v string) { + o.SpaceTargetAudienceId = v +} + +// GetSpaceTimeZone returns the SpaceTimeZone field value. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) GetSpaceTimeZone() string { + if o == nil { + var ret string + return ret + } + return o.SpaceTimeZone +} + +// GetSpaceTimeZoneOk returns a tuple with the SpaceTimeZone field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) GetSpaceTimeZoneOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SpaceTimeZone, true +} + +// SetSpaceTimeZone sets field value. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) SetSpaceTimeZone(v string) { + o.SpaceTimeZone = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleChatConfigurationDataAttributesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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") + } + toSerialize["domain_id"] = o.DomainId + 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["space_name_template"] = o.SpaceNameTemplate + toSerialize["space_target_audience_id"] = o.SpaceTargetAudienceId + toSerialize["space_time_zone"] = o.SpaceTimeZone + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleChatConfigurationDataAttributesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedAt *time.Time `json:"created_at"` + DomainId *string `json:"domain_id"` + ModifiedAt *time.Time `json:"modified_at"` + SpaceNameTemplate *string `json:"space_name_template"` + SpaceTargetAudienceId *string `json:"space_target_audience_id"` + SpaceTimeZone *string `json:"space_time_zone"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.CreatedAt == nil { + return fmt.Errorf("required field created_at missing") + } + if all.DomainId == nil { + return fmt.Errorf("required field domain_id missing") + } + if all.ModifiedAt == nil { + return fmt.Errorf("required field modified_at missing") + } + if all.SpaceNameTemplate == nil { + return fmt.Errorf("required field space_name_template missing") + } + if all.SpaceTargetAudienceId == nil { + return fmt.Errorf("required field space_target_audience_id missing") + } + if all.SpaceTimeZone == nil { + return fmt.Errorf("required field space_time_zone missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "domain_id", "modified_at", "space_name_template", "space_target_audience_id", "space_time_zone"}) + } else { + return err + } + o.CreatedAt = *all.CreatedAt + o.DomainId = *all.DomainId + o.ModifiedAt = *all.ModifiedAt + o.SpaceNameTemplate = *all.SpaceNameTemplate + o.SpaceTargetAudienceId = *all.SpaceTargetAudienceId + o.SpaceTimeZone = *all.SpaceTimeZone + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_chat_configuration_data_request.go b/api/datadogV2/model_incident_google_chat_configuration_data_request.go new file mode 100644 index 00000000000..4ff4f88f6c5 --- /dev/null +++ b/api/datadogV2/model_incident_google_chat_configuration_data_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleChatConfigurationDataRequest Google Chat configuration data in a create request. +type IncidentGoogleChatConfigurationDataRequest struct { + // Attributes for creating a Google Chat configuration. + Attributes IncidentGoogleChatConfigurationDataAttributesRequest `json:"attributes"` + // Relationships for a Google Chat configuration create request. + Relationships IncidentGoogleChatConfigurationRelationshipsRequest `json:"relationships"` + // Google Chat configuration resource type. + Type IncidentGoogleChatConfigurationType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleChatConfigurationDataRequest instantiates a new IncidentGoogleChatConfigurationDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleChatConfigurationDataRequest(attributes IncidentGoogleChatConfigurationDataAttributesRequest, relationships IncidentGoogleChatConfigurationRelationshipsRequest, typeVar IncidentGoogleChatConfigurationType) *IncidentGoogleChatConfigurationDataRequest { + this := IncidentGoogleChatConfigurationDataRequest{} + this.Attributes = attributes + this.Relationships = relationships + this.Type = typeVar + return &this +} + +// NewIncidentGoogleChatConfigurationDataRequestWithDefaults instantiates a new IncidentGoogleChatConfigurationDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleChatConfigurationDataRequestWithDefaults() *IncidentGoogleChatConfigurationDataRequest { + this := IncidentGoogleChatConfigurationDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentGoogleChatConfigurationDataRequest) GetAttributes() IncidentGoogleChatConfigurationDataAttributesRequest { + if o == nil { + var ret IncidentGoogleChatConfigurationDataAttributesRequest + 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 *IncidentGoogleChatConfigurationDataRequest) GetAttributesOk() (*IncidentGoogleChatConfigurationDataAttributesRequest, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentGoogleChatConfigurationDataRequest) SetAttributes(v IncidentGoogleChatConfigurationDataAttributesRequest) { + o.Attributes = v +} + +// GetRelationships returns the Relationships field value. +func (o *IncidentGoogleChatConfigurationDataRequest) GetRelationships() IncidentGoogleChatConfigurationRelationshipsRequest { + if o == nil { + var ret IncidentGoogleChatConfigurationRelationshipsRequest + 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 *IncidentGoogleChatConfigurationDataRequest) GetRelationshipsOk() (*IncidentGoogleChatConfigurationRelationshipsRequest, bool) { + if o == nil { + return nil, false + } + return &o.Relationships, true +} + +// SetRelationships sets field value. +func (o *IncidentGoogleChatConfigurationDataRequest) SetRelationships(v IncidentGoogleChatConfigurationRelationshipsRequest) { + o.Relationships = v +} + +// GetType returns the Type field value. +func (o *IncidentGoogleChatConfigurationDataRequest) GetType() IncidentGoogleChatConfigurationType { + if o == nil { + var ret IncidentGoogleChatConfigurationType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationDataRequest) GetTypeOk() (*IncidentGoogleChatConfigurationType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentGoogleChatConfigurationDataRequest) SetType(v IncidentGoogleChatConfigurationType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleChatConfigurationDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["relationships"] = o.Relationships + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleChatConfigurationDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentGoogleChatConfigurationDataAttributesRequest `json:"attributes"` + Relationships *IncidentGoogleChatConfigurationRelationshipsRequest `json:"relationships"` + Type *IncidentGoogleChatConfigurationType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Relationships == nil { + return fmt.Errorf("required field relationships missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = *all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_chat_configuration_data_response.go b/api/datadogV2/model_incident_google_chat_configuration_data_response.go new file mode 100644 index 00000000000..69b4f971208 --- /dev/null +++ b/api/datadogV2/model_incident_google_chat_configuration_data_response.go @@ -0,0 +1,218 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleChatConfigurationDataResponse Google Chat configuration data in a response. +type IncidentGoogleChatConfigurationDataResponse struct { + // Attributes of a Google Chat configuration. + Attributes IncidentGoogleChatConfigurationDataAttributesResponse `json:"attributes"` + // The configuration identifier. + Id uuid.UUID `json:"id"` + // Relationships for a Google Chat configuration. + Relationships *IncidentGoogleChatConfigurationRelationships `json:"relationships,omitempty"` + // Google Chat configuration resource type. + Type IncidentGoogleChatConfigurationType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleChatConfigurationDataResponse instantiates a new IncidentGoogleChatConfigurationDataResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleChatConfigurationDataResponse(attributes IncidentGoogleChatConfigurationDataAttributesResponse, id uuid.UUID, typeVar IncidentGoogleChatConfigurationType) *IncidentGoogleChatConfigurationDataResponse { + this := IncidentGoogleChatConfigurationDataResponse{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentGoogleChatConfigurationDataResponseWithDefaults instantiates a new IncidentGoogleChatConfigurationDataResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleChatConfigurationDataResponseWithDefaults() *IncidentGoogleChatConfigurationDataResponse { + this := IncidentGoogleChatConfigurationDataResponse{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentGoogleChatConfigurationDataResponse) GetAttributes() IncidentGoogleChatConfigurationDataAttributesResponse { + if o == nil { + var ret IncidentGoogleChatConfigurationDataAttributesResponse + 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 *IncidentGoogleChatConfigurationDataResponse) GetAttributesOk() (*IncidentGoogleChatConfigurationDataAttributesResponse, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentGoogleChatConfigurationDataResponse) SetAttributes(v IncidentGoogleChatConfigurationDataAttributesResponse) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *IncidentGoogleChatConfigurationDataResponse) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentGoogleChatConfigurationDataResponse) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentGoogleChatConfigurationDataResponse) SetId(v uuid.UUID) { + o.Id = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentGoogleChatConfigurationDataResponse) GetRelationships() IncidentGoogleChatConfigurationRelationships { + if o == nil || o.Relationships == nil { + var ret IncidentGoogleChatConfigurationRelationships + 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 *IncidentGoogleChatConfigurationDataResponse) GetRelationshipsOk() (*IncidentGoogleChatConfigurationRelationships, 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 *IncidentGoogleChatConfigurationDataResponse) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given IncidentGoogleChatConfigurationRelationships and assigns it to the Relationships field. +func (o *IncidentGoogleChatConfigurationDataResponse) SetRelationships(v IncidentGoogleChatConfigurationRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *IncidentGoogleChatConfigurationDataResponse) GetType() IncidentGoogleChatConfigurationType { + if o == nil { + var ret IncidentGoogleChatConfigurationType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationDataResponse) GetTypeOk() (*IncidentGoogleChatConfigurationType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentGoogleChatConfigurationDataResponse) SetType(v IncidentGoogleChatConfigurationType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleChatConfigurationDataResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleChatConfigurationDataResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentGoogleChatConfigurationDataAttributesResponse `json:"attributes"` + Id *uuid.UUID `json:"id"` + Relationships *IncidentGoogleChatConfigurationRelationships `json:"relationships,omitempty"` + Type *IncidentGoogleChatConfigurationType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_chat_configuration_patch_data_attributes_request.go b/api/datadogV2/model_incident_google_chat_configuration_patch_data_attributes_request.go new file mode 100644 index 00000000000..f1d765d5245 --- /dev/null +++ b/api/datadogV2/model_incident_google_chat_configuration_patch_data_attributes_request.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleChatConfigurationPatchDataAttributesRequest Attributes for patching a Google Chat configuration. All fields are optional. +type IncidentGoogleChatConfigurationPatchDataAttributesRequest struct { + // The Google Chat domain ID. + DomainId *string `json:"domain_id,omitempty"` + // The template for the Google Chat space name. + SpaceNameTemplate *string `json:"space_name_template,omitempty"` + // The target audience ID for the Google Chat space. + SpaceTargetAudienceId *string `json:"space_target_audience_id,omitempty"` + // The time zone for the Google Chat space. + SpaceTimeZone *string `json:"space_time_zone,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleChatConfigurationPatchDataAttributesRequest instantiates a new IncidentGoogleChatConfigurationPatchDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleChatConfigurationPatchDataAttributesRequest() *IncidentGoogleChatConfigurationPatchDataAttributesRequest { + this := IncidentGoogleChatConfigurationPatchDataAttributesRequest{} + return &this +} + +// NewIncidentGoogleChatConfigurationPatchDataAttributesRequestWithDefaults instantiates a new IncidentGoogleChatConfigurationPatchDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleChatConfigurationPatchDataAttributesRequestWithDefaults() *IncidentGoogleChatConfigurationPatchDataAttributesRequest { + this := IncidentGoogleChatConfigurationPatchDataAttributesRequest{} + return &this +} + +// GetDomainId returns the DomainId field value if set, zero value otherwise. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) GetDomainId() string { + if o == nil || o.DomainId == nil { + var ret string + return ret + } + return *o.DomainId +} + +// GetDomainIdOk returns a tuple with the DomainId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) GetDomainIdOk() (*string, bool) { + if o == nil || o.DomainId == nil { + return nil, false + } + return o.DomainId, true +} + +// HasDomainId returns a boolean if a field has been set. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) HasDomainId() bool { + return o != nil && o.DomainId != nil +} + +// SetDomainId gets a reference to the given string and assigns it to the DomainId field. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) SetDomainId(v string) { + o.DomainId = &v +} + +// GetSpaceNameTemplate returns the SpaceNameTemplate field value if set, zero value otherwise. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) GetSpaceNameTemplate() string { + if o == nil || o.SpaceNameTemplate == nil { + var ret string + return ret + } + return *o.SpaceNameTemplate +} + +// GetSpaceNameTemplateOk returns a tuple with the SpaceNameTemplate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) GetSpaceNameTemplateOk() (*string, bool) { + if o == nil || o.SpaceNameTemplate == nil { + return nil, false + } + return o.SpaceNameTemplate, true +} + +// HasSpaceNameTemplate returns a boolean if a field has been set. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) HasSpaceNameTemplate() bool { + return o != nil && o.SpaceNameTemplate != nil +} + +// SetSpaceNameTemplate gets a reference to the given string and assigns it to the SpaceNameTemplate field. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) SetSpaceNameTemplate(v string) { + o.SpaceNameTemplate = &v +} + +// GetSpaceTargetAudienceId returns the SpaceTargetAudienceId field value if set, zero value otherwise. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) GetSpaceTargetAudienceId() string { + if o == nil || o.SpaceTargetAudienceId == nil { + var ret string + return ret + } + return *o.SpaceTargetAudienceId +} + +// GetSpaceTargetAudienceIdOk returns a tuple with the SpaceTargetAudienceId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) GetSpaceTargetAudienceIdOk() (*string, bool) { + if o == nil || o.SpaceTargetAudienceId == nil { + return nil, false + } + return o.SpaceTargetAudienceId, true +} + +// HasSpaceTargetAudienceId returns a boolean if a field has been set. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) HasSpaceTargetAudienceId() bool { + return o != nil && o.SpaceTargetAudienceId != nil +} + +// SetSpaceTargetAudienceId gets a reference to the given string and assigns it to the SpaceTargetAudienceId field. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) SetSpaceTargetAudienceId(v string) { + o.SpaceTargetAudienceId = &v +} + +// GetSpaceTimeZone returns the SpaceTimeZone field value if set, zero value otherwise. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) GetSpaceTimeZone() string { + if o == nil || o.SpaceTimeZone == nil { + var ret string + return ret + } + return *o.SpaceTimeZone +} + +// GetSpaceTimeZoneOk returns a tuple with the SpaceTimeZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) GetSpaceTimeZoneOk() (*string, bool) { + if o == nil || o.SpaceTimeZone == nil { + return nil, false + } + return o.SpaceTimeZone, true +} + +// HasSpaceTimeZone returns a boolean if a field has been set. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) HasSpaceTimeZone() bool { + return o != nil && o.SpaceTimeZone != nil +} + +// SetSpaceTimeZone gets a reference to the given string and assigns it to the SpaceTimeZone field. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) SetSpaceTimeZone(v string) { + o.SpaceTimeZone = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleChatConfigurationPatchDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.DomainId != nil { + toSerialize["domain_id"] = o.DomainId + } + if o.SpaceNameTemplate != nil { + toSerialize["space_name_template"] = o.SpaceNameTemplate + } + if o.SpaceTargetAudienceId != nil { + toSerialize["space_target_audience_id"] = o.SpaceTargetAudienceId + } + if o.SpaceTimeZone != nil { + toSerialize["space_time_zone"] = o.SpaceTimeZone + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleChatConfigurationPatchDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DomainId *string `json:"domain_id,omitempty"` + SpaceNameTemplate *string `json:"space_name_template,omitempty"` + SpaceTargetAudienceId *string `json:"space_target_audience_id,omitempty"` + SpaceTimeZone *string `json:"space_time_zone,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"domain_id", "space_name_template", "space_target_audience_id", "space_time_zone"}) + } else { + return err + } + o.DomainId = all.DomainId + o.SpaceNameTemplate = all.SpaceNameTemplate + o.SpaceTargetAudienceId = all.SpaceTargetAudienceId + o.SpaceTimeZone = all.SpaceTimeZone + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_chat_configuration_patch_data_request.go b/api/datadogV2/model_incident_google_chat_configuration_patch_data_request.go new file mode 100644 index 00000000000..13ca2a17595 --- /dev/null +++ b/api/datadogV2/model_incident_google_chat_configuration_patch_data_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 datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleChatConfigurationPatchDataRequest Google Chat configuration data in a patch request. +type IncidentGoogleChatConfigurationPatchDataRequest struct { + // Attributes for patching a Google Chat configuration. All fields are optional. + Attributes *IncidentGoogleChatConfigurationPatchDataAttributesRequest `json:"attributes,omitempty"` + // The configuration identifier. + Id uuid.UUID `json:"id"` + // Google Chat configuration resource type. + Type IncidentGoogleChatConfigurationType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleChatConfigurationPatchDataRequest instantiates a new IncidentGoogleChatConfigurationPatchDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleChatConfigurationPatchDataRequest(id uuid.UUID, typeVar IncidentGoogleChatConfigurationType) *IncidentGoogleChatConfigurationPatchDataRequest { + this := IncidentGoogleChatConfigurationPatchDataRequest{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentGoogleChatConfigurationPatchDataRequestWithDefaults instantiates a new IncidentGoogleChatConfigurationPatchDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleChatConfigurationPatchDataRequestWithDefaults() *IncidentGoogleChatConfigurationPatchDataRequest { + this := IncidentGoogleChatConfigurationPatchDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *IncidentGoogleChatConfigurationPatchDataRequest) GetAttributes() IncidentGoogleChatConfigurationPatchDataAttributesRequest { + if o == nil || o.Attributes == nil { + var ret IncidentGoogleChatConfigurationPatchDataAttributesRequest + 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 *IncidentGoogleChatConfigurationPatchDataRequest) GetAttributesOk() (*IncidentGoogleChatConfigurationPatchDataAttributesRequest, 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 *IncidentGoogleChatConfigurationPatchDataRequest) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given IncidentGoogleChatConfigurationPatchDataAttributesRequest and assigns it to the Attributes field. +func (o *IncidentGoogleChatConfigurationPatchDataRequest) SetAttributes(v IncidentGoogleChatConfigurationPatchDataAttributesRequest) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *IncidentGoogleChatConfigurationPatchDataRequest) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentGoogleChatConfigurationPatchDataRequest) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentGoogleChatConfigurationPatchDataRequest) SetId(v uuid.UUID) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *IncidentGoogleChatConfigurationPatchDataRequest) GetType() IncidentGoogleChatConfigurationType { + if o == nil { + var ret IncidentGoogleChatConfigurationType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationPatchDataRequest) GetTypeOk() (*IncidentGoogleChatConfigurationType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentGoogleChatConfigurationPatchDataRequest) SetType(v IncidentGoogleChatConfigurationType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleChatConfigurationPatchDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleChatConfigurationPatchDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentGoogleChatConfigurationPatchDataAttributesRequest `json:"attributes,omitempty"` + Id *uuid.UUID `json:"id"` + Type *IncidentGoogleChatConfigurationType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_chat_configuration_patch_request.go b/api/datadogV2/model_incident_google_chat_configuration_patch_request.go new file mode 100644 index 00000000000..d14456c0f35 --- /dev/null +++ b/api/datadogV2/model_incident_google_chat_configuration_patch_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleChatConfigurationPatchRequest Request payload for patching a Google Chat configuration. +type IncidentGoogleChatConfigurationPatchRequest struct { + // Google Chat configuration data in a patch request. + Data IncidentGoogleChatConfigurationPatchDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleChatConfigurationPatchRequest instantiates a new IncidentGoogleChatConfigurationPatchRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleChatConfigurationPatchRequest(data IncidentGoogleChatConfigurationPatchDataRequest) *IncidentGoogleChatConfigurationPatchRequest { + this := IncidentGoogleChatConfigurationPatchRequest{} + this.Data = data + return &this +} + +// NewIncidentGoogleChatConfigurationPatchRequestWithDefaults instantiates a new IncidentGoogleChatConfigurationPatchRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleChatConfigurationPatchRequestWithDefaults() *IncidentGoogleChatConfigurationPatchRequest { + this := IncidentGoogleChatConfigurationPatchRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentGoogleChatConfigurationPatchRequest) GetData() IncidentGoogleChatConfigurationPatchDataRequest { + if o == nil { + var ret IncidentGoogleChatConfigurationPatchDataRequest + 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 *IncidentGoogleChatConfigurationPatchRequest) GetDataOk() (*IncidentGoogleChatConfigurationPatchDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentGoogleChatConfigurationPatchRequest) SetData(v IncidentGoogleChatConfigurationPatchDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleChatConfigurationPatchRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleChatConfigurationPatchRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentGoogleChatConfigurationPatchDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_chat_configuration_relationships.go b/api/datadogV2/model_incident_google_chat_configuration_relationships.go new file mode 100644 index 00000000000..9746cda22eb --- /dev/null +++ b/api/datadogV2/model_incident_google_chat_configuration_relationships.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleChatConfigurationRelationships Relationships for a Google Chat configuration. +type IncidentGoogleChatConfigurationRelationships struct { + // Relationship to user. + CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"` + // Relationship to an incident type. + IncidentType *RelationshipToIncidentType `json:"incident_type,omitempty"` + // Relationship to user. + LastModifiedByUser *RelationshipToUser `json:"last_modified_by_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{} `json:"-"` +} + +// NewIncidentGoogleChatConfigurationRelationships instantiates a new IncidentGoogleChatConfigurationRelationships object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleChatConfigurationRelationships() *IncidentGoogleChatConfigurationRelationships { + this := IncidentGoogleChatConfigurationRelationships{} + return &this +} + +// NewIncidentGoogleChatConfigurationRelationshipsWithDefaults instantiates a new IncidentGoogleChatConfigurationRelationships object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleChatConfigurationRelationshipsWithDefaults() *IncidentGoogleChatConfigurationRelationships { + this := IncidentGoogleChatConfigurationRelationships{} + return &this +} + +// GetCreatedByUser returns the CreatedByUser field value if set, zero value otherwise. +func (o *IncidentGoogleChatConfigurationRelationships) 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 *IncidentGoogleChatConfigurationRelationships) 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 *IncidentGoogleChatConfigurationRelationships) HasCreatedByUser() bool { + return o != nil && o.CreatedByUser != nil +} + +// SetCreatedByUser gets a reference to the given RelationshipToUser and assigns it to the CreatedByUser field. +func (o *IncidentGoogleChatConfigurationRelationships) SetCreatedByUser(v RelationshipToUser) { + o.CreatedByUser = &v +} + +// GetIncidentType returns the IncidentType field value if set, zero value otherwise. +func (o *IncidentGoogleChatConfigurationRelationships) GetIncidentType() RelationshipToIncidentType { + if o == nil || o.IncidentType == nil { + var ret RelationshipToIncidentType + return ret + } + return *o.IncidentType +} + +// GetIncidentTypeOk returns a tuple with the IncidentType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationRelationships) GetIncidentTypeOk() (*RelationshipToIncidentType, bool) { + if o == nil || o.IncidentType == nil { + return nil, false + } + return o.IncidentType, true +} + +// HasIncidentType returns a boolean if a field has been set. +func (o *IncidentGoogleChatConfigurationRelationships) HasIncidentType() bool { + return o != nil && o.IncidentType != nil +} + +// SetIncidentType gets a reference to the given RelationshipToIncidentType and assigns it to the IncidentType field. +func (o *IncidentGoogleChatConfigurationRelationships) SetIncidentType(v RelationshipToIncidentType) { + o.IncidentType = &v +} + +// GetLastModifiedByUser returns the LastModifiedByUser field value if set, zero value otherwise. +func (o *IncidentGoogleChatConfigurationRelationships) 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 *IncidentGoogleChatConfigurationRelationships) 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 *IncidentGoogleChatConfigurationRelationships) HasLastModifiedByUser() bool { + return o != nil && o.LastModifiedByUser != nil +} + +// SetLastModifiedByUser gets a reference to the given RelationshipToUser and assigns it to the LastModifiedByUser field. +func (o *IncidentGoogleChatConfigurationRelationships) SetLastModifiedByUser(v RelationshipToUser) { + o.LastModifiedByUser = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleChatConfigurationRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CreatedByUser != nil { + toSerialize["created_by_user"] = o.CreatedByUser + } + if o.IncidentType != nil { + toSerialize["incident_type"] = o.IncidentType + } + if o.LastModifiedByUser != nil { + toSerialize["last_modified_by_user"] = o.LastModifiedByUser + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleChatConfigurationRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"` + IncidentType *RelationshipToIncidentType `json:"incident_type,omitempty"` + LastModifiedByUser *RelationshipToUser `json:"last_modified_by_user,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_by_user", "incident_type", "last_modified_by_user"}) + } else { + return err + } + + hasInvalidField := false + if all.CreatedByUser != nil && all.CreatedByUser.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CreatedByUser = all.CreatedByUser + if all.IncidentType != nil && all.IncidentType.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IncidentType = all.IncidentType + if all.LastModifiedByUser != nil && all.LastModifiedByUser.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LastModifiedByUser = all.LastModifiedByUser + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_chat_configuration_relationships_request.go b/api/datadogV2/model_incident_google_chat_configuration_relationships_request.go new file mode 100644 index 00000000000..73a449a4d49 --- /dev/null +++ b/api/datadogV2/model_incident_google_chat_configuration_relationships_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleChatConfigurationRelationshipsRequest Relationships for a Google Chat configuration create request. +type IncidentGoogleChatConfigurationRelationshipsRequest struct { + // Relationship to an incident type. + IncidentType RelationshipToIncidentType `json:"incident_type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleChatConfigurationRelationshipsRequest instantiates a new IncidentGoogleChatConfigurationRelationshipsRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleChatConfigurationRelationshipsRequest(incidentType RelationshipToIncidentType) *IncidentGoogleChatConfigurationRelationshipsRequest { + this := IncidentGoogleChatConfigurationRelationshipsRequest{} + this.IncidentType = incidentType + return &this +} + +// NewIncidentGoogleChatConfigurationRelationshipsRequestWithDefaults instantiates a new IncidentGoogleChatConfigurationRelationshipsRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleChatConfigurationRelationshipsRequestWithDefaults() *IncidentGoogleChatConfigurationRelationshipsRequest { + this := IncidentGoogleChatConfigurationRelationshipsRequest{} + return &this +} + +// GetIncidentType returns the IncidentType field value. +func (o *IncidentGoogleChatConfigurationRelationshipsRequest) GetIncidentType() RelationshipToIncidentType { + if o == nil { + var ret RelationshipToIncidentType + return ret + } + return o.IncidentType +} + +// GetIncidentTypeOk returns a tuple with the IncidentType field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleChatConfigurationRelationshipsRequest) GetIncidentTypeOk() (*RelationshipToIncidentType, bool) { + if o == nil { + return nil, false + } + return &o.IncidentType, true +} + +// SetIncidentType sets field value. +func (o *IncidentGoogleChatConfigurationRelationshipsRequest) SetIncidentType(v RelationshipToIncidentType) { + o.IncidentType = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleChatConfigurationRelationshipsRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["incident_type"] = o.IncidentType + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleChatConfigurationRelationshipsRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncidentType *RelationshipToIncidentType `json:"incident_type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncidentType == nil { + return fmt.Errorf("required field incident_type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"incident_type"}) + } else { + return err + } + + hasInvalidField := false + if all.IncidentType.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IncidentType = *all.IncidentType + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_chat_configuration_request.go b/api/datadogV2/model_incident_google_chat_configuration_request.go new file mode 100644 index 00000000000..49cb8a54639 --- /dev/null +++ b/api/datadogV2/model_incident_google_chat_configuration_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleChatConfigurationRequest Request payload for creating a Google Chat configuration. +type IncidentGoogleChatConfigurationRequest struct { + // Google Chat configuration data in a create request. + Data IncidentGoogleChatConfigurationDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleChatConfigurationRequest instantiates a new IncidentGoogleChatConfigurationRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleChatConfigurationRequest(data IncidentGoogleChatConfigurationDataRequest) *IncidentGoogleChatConfigurationRequest { + this := IncidentGoogleChatConfigurationRequest{} + this.Data = data + return &this +} + +// NewIncidentGoogleChatConfigurationRequestWithDefaults instantiates a new IncidentGoogleChatConfigurationRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleChatConfigurationRequestWithDefaults() *IncidentGoogleChatConfigurationRequest { + this := IncidentGoogleChatConfigurationRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentGoogleChatConfigurationRequest) GetData() IncidentGoogleChatConfigurationDataRequest { + if o == nil { + var ret IncidentGoogleChatConfigurationDataRequest + 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 *IncidentGoogleChatConfigurationRequest) GetDataOk() (*IncidentGoogleChatConfigurationDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentGoogleChatConfigurationRequest) SetData(v IncidentGoogleChatConfigurationDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleChatConfigurationRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleChatConfigurationRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentGoogleChatConfigurationDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_chat_configuration_response.go b/api/datadogV2/model_incident_google_chat_configuration_response.go new file mode 100644 index 00000000000..87f667f95ea --- /dev/null +++ b/api/datadogV2/model_incident_google_chat_configuration_response.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleChatConfigurationResponse Response with a Google Chat configuration. +type IncidentGoogleChatConfigurationResponse struct { + // Google Chat configuration data in a response. + Data IncidentGoogleChatConfigurationDataResponse `json:"data"` + // Included related resources. + Included []IncidentUserData `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{} `json:"-"` +} + +// NewIncidentGoogleChatConfigurationResponse instantiates a new IncidentGoogleChatConfigurationResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleChatConfigurationResponse(data IncidentGoogleChatConfigurationDataResponse) *IncidentGoogleChatConfigurationResponse { + this := IncidentGoogleChatConfigurationResponse{} + this.Data = data + return &this +} + +// NewIncidentGoogleChatConfigurationResponseWithDefaults instantiates a new IncidentGoogleChatConfigurationResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleChatConfigurationResponseWithDefaults() *IncidentGoogleChatConfigurationResponse { + this := IncidentGoogleChatConfigurationResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentGoogleChatConfigurationResponse) GetData() IncidentGoogleChatConfigurationDataResponse { + if o == nil { + var ret IncidentGoogleChatConfigurationDataResponse + 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 *IncidentGoogleChatConfigurationResponse) GetDataOk() (*IncidentGoogleChatConfigurationDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentGoogleChatConfigurationResponse) SetData(v IncidentGoogleChatConfigurationDataResponse) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentGoogleChatConfigurationResponse) GetIncluded() []IncidentUserData { + if o == nil || o.Included == nil { + var ret []IncidentUserData + 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 *IncidentGoogleChatConfigurationResponse) GetIncludedOk() (*[]IncidentUserData, 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 *IncidentGoogleChatConfigurationResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []IncidentUserData and assigns it to the Included field. +func (o *IncidentGoogleChatConfigurationResponse) SetIncluded(v []IncidentUserData) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleChatConfigurationResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleChatConfigurationResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentGoogleChatConfigurationDataResponse `json:"data"` + Included []IncidentUserData `json:"included,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + o.Included = all.Included + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_chat_configuration_type.go b/api/datadogV2/model_incident_google_chat_configuration_type.go new file mode 100644 index 00000000000..1f2788cc575 --- /dev/null +++ b/api/datadogV2/model_incident_google_chat_configuration_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleChatConfigurationType Google Chat configuration resource type. +type IncidentGoogleChatConfigurationType string + +// List of IncidentGoogleChatConfigurationType. +const ( + INCIDENTGOOGLECHATCONFIGURATIONTYPE_GOOGLE_CHAT_CONFIGURATIONS IncidentGoogleChatConfigurationType = "google_chat_configurations" +) + +var allowedIncidentGoogleChatConfigurationTypeEnumValues = []IncidentGoogleChatConfigurationType{ + INCIDENTGOOGLECHATCONFIGURATIONTYPE_GOOGLE_CHAT_CONFIGURATIONS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentGoogleChatConfigurationType) GetAllowedValues() []IncidentGoogleChatConfigurationType { + return allowedIncidentGoogleChatConfigurationTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentGoogleChatConfigurationType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentGoogleChatConfigurationType(value) + return nil +} + +// NewIncidentGoogleChatConfigurationTypeFromValue returns a pointer to a valid IncidentGoogleChatConfigurationType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentGoogleChatConfigurationTypeFromValue(v string) (*IncidentGoogleChatConfigurationType, error) { + ev := IncidentGoogleChatConfigurationType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentGoogleChatConfigurationType: valid values are %v", v, allowedIncidentGoogleChatConfigurationTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentGoogleChatConfigurationType) IsValid() bool { + for _, existing := range allowedIncidentGoogleChatConfigurationTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentGoogleChatConfigurationType value. +func (v IncidentGoogleChatConfigurationType) Ptr() *IncidentGoogleChatConfigurationType { + return &v +} diff --git a/api/datadogV2/model_incident_google_meet_configuration_data_attributes_request.go b/api/datadogV2/model_incident_google_meet_configuration_data_attributes_request.go new file mode 100644 index 00000000000..ca1a9c3d859 --- /dev/null +++ b/api/datadogV2/model_incident_google_meet_configuration_data_attributes_request.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleMeetConfigurationDataAttributesRequest Attributes for creating a Google Meet configuration. +type IncidentGoogleMeetConfigurationDataAttributesRequest struct { + // Whether to allow manual meeting creation. + AllowManualMeetingCreation bool `json:"allow_manual_meeting_creation"` + // Whether to auto-summarize meetings. + AutoSummarize bool `json:"auto_summarize"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleMeetConfigurationDataAttributesRequest instantiates a new IncidentGoogleMeetConfigurationDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleMeetConfigurationDataAttributesRequest(allowManualMeetingCreation bool, autoSummarize bool) *IncidentGoogleMeetConfigurationDataAttributesRequest { + this := IncidentGoogleMeetConfigurationDataAttributesRequest{} + this.AllowManualMeetingCreation = allowManualMeetingCreation + this.AutoSummarize = autoSummarize + return &this +} + +// NewIncidentGoogleMeetConfigurationDataAttributesRequestWithDefaults instantiates a new IncidentGoogleMeetConfigurationDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleMeetConfigurationDataAttributesRequestWithDefaults() *IncidentGoogleMeetConfigurationDataAttributesRequest { + this := IncidentGoogleMeetConfigurationDataAttributesRequest{} + return &this +} + +// GetAllowManualMeetingCreation returns the AllowManualMeetingCreation field value. +func (o *IncidentGoogleMeetConfigurationDataAttributesRequest) GetAllowManualMeetingCreation() bool { + if o == nil { + var ret bool + return ret + } + return o.AllowManualMeetingCreation +} + +// GetAllowManualMeetingCreationOk returns a tuple with the AllowManualMeetingCreation field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleMeetConfigurationDataAttributesRequest) GetAllowManualMeetingCreationOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.AllowManualMeetingCreation, true +} + +// SetAllowManualMeetingCreation sets field value. +func (o *IncidentGoogleMeetConfigurationDataAttributesRequest) SetAllowManualMeetingCreation(v bool) { + o.AllowManualMeetingCreation = v +} + +// GetAutoSummarize returns the AutoSummarize field value. +func (o *IncidentGoogleMeetConfigurationDataAttributesRequest) GetAutoSummarize() bool { + if o == nil { + var ret bool + return ret + } + return o.AutoSummarize +} + +// GetAutoSummarizeOk returns a tuple with the AutoSummarize field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleMeetConfigurationDataAttributesRequest) GetAutoSummarizeOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.AutoSummarize, true +} + +// SetAutoSummarize sets field value. +func (o *IncidentGoogleMeetConfigurationDataAttributesRequest) SetAutoSummarize(v bool) { + o.AutoSummarize = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleMeetConfigurationDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["allow_manual_meeting_creation"] = o.AllowManualMeetingCreation + toSerialize["auto_summarize"] = o.AutoSummarize + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleMeetConfigurationDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AllowManualMeetingCreation *bool `json:"allow_manual_meeting_creation"` + AutoSummarize *bool `json:"auto_summarize"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AllowManualMeetingCreation == nil { + return fmt.Errorf("required field allow_manual_meeting_creation missing") + } + if all.AutoSummarize == nil { + return fmt.Errorf("required field auto_summarize missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"allow_manual_meeting_creation", "auto_summarize"}) + } else { + return err + } + o.AllowManualMeetingCreation = *all.AllowManualMeetingCreation + o.AutoSummarize = *all.AutoSummarize + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_meet_configuration_data_attributes_response.go b/api/datadogV2/model_incident_google_meet_configuration_data_attributes_response.go new file mode 100644 index 00000000000..2a8c4963ba9 --- /dev/null +++ b/api/datadogV2/model_incident_google_meet_configuration_data_attributes_response.go @@ -0,0 +1,209 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleMeetConfigurationDataAttributesResponse Attributes of a Google Meet configuration. +type IncidentGoogleMeetConfigurationDataAttributesResponse struct { + // Whether manual meeting creation is allowed. + AllowManualMeetingCreation bool `json:"allow_manual_meeting_creation"` + // Whether meetings are auto-summarized. + AutoSummarize bool `json:"auto_summarize"` + // Timestamp when the configuration was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Timestamp when the configuration was last modified. + ModifiedAt time.Time `json:"modified_at"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleMeetConfigurationDataAttributesResponse instantiates a new IncidentGoogleMeetConfigurationDataAttributesResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleMeetConfigurationDataAttributesResponse(allowManualMeetingCreation bool, autoSummarize bool, modifiedAt time.Time) *IncidentGoogleMeetConfigurationDataAttributesResponse { + this := IncidentGoogleMeetConfigurationDataAttributesResponse{} + this.AllowManualMeetingCreation = allowManualMeetingCreation + this.AutoSummarize = autoSummarize + this.ModifiedAt = modifiedAt + return &this +} + +// NewIncidentGoogleMeetConfigurationDataAttributesResponseWithDefaults instantiates a new IncidentGoogleMeetConfigurationDataAttributesResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleMeetConfigurationDataAttributesResponseWithDefaults() *IncidentGoogleMeetConfigurationDataAttributesResponse { + this := IncidentGoogleMeetConfigurationDataAttributesResponse{} + return &this +} + +// GetAllowManualMeetingCreation returns the AllowManualMeetingCreation field value. +func (o *IncidentGoogleMeetConfigurationDataAttributesResponse) GetAllowManualMeetingCreation() bool { + if o == nil { + var ret bool + return ret + } + return o.AllowManualMeetingCreation +} + +// GetAllowManualMeetingCreationOk returns a tuple with the AllowManualMeetingCreation field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleMeetConfigurationDataAttributesResponse) GetAllowManualMeetingCreationOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.AllowManualMeetingCreation, true +} + +// SetAllowManualMeetingCreation sets field value. +func (o *IncidentGoogleMeetConfigurationDataAttributesResponse) SetAllowManualMeetingCreation(v bool) { + o.AllowManualMeetingCreation = v +} + +// GetAutoSummarize returns the AutoSummarize field value. +func (o *IncidentGoogleMeetConfigurationDataAttributesResponse) GetAutoSummarize() bool { + if o == nil { + var ret bool + return ret + } + return o.AutoSummarize +} + +// GetAutoSummarizeOk returns a tuple with the AutoSummarize field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleMeetConfigurationDataAttributesResponse) GetAutoSummarizeOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.AutoSummarize, true +} + +// SetAutoSummarize sets field value. +func (o *IncidentGoogleMeetConfigurationDataAttributesResponse) SetAutoSummarize(v bool) { + o.AutoSummarize = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *IncidentGoogleMeetConfigurationDataAttributesResponse) 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 *IncidentGoogleMeetConfigurationDataAttributesResponse) 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 *IncidentGoogleMeetConfigurationDataAttributesResponse) HasCreatedAt() bool { + return o != nil && o.CreatedAt != nil +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *IncidentGoogleMeetConfigurationDataAttributesResponse) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetModifiedAt returns the ModifiedAt field value. +func (o *IncidentGoogleMeetConfigurationDataAttributesResponse) GetModifiedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleMeetConfigurationDataAttributesResponse) GetModifiedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.ModifiedAt, true +} + +// SetModifiedAt sets field value. +func (o *IncidentGoogleMeetConfigurationDataAttributesResponse) SetModifiedAt(v time.Time) { + o.ModifiedAt = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleMeetConfigurationDataAttributesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["allow_manual_meeting_creation"] = o.AllowManualMeetingCreation + toSerialize["auto_summarize"] = o.AutoSummarize + 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.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") + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleMeetConfigurationDataAttributesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AllowManualMeetingCreation *bool `json:"allow_manual_meeting_creation"` + AutoSummarize *bool `json:"auto_summarize"` + CreatedAt *time.Time `json:"created_at,omitempty"` + ModifiedAt *time.Time `json:"modified_at"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AllowManualMeetingCreation == nil { + return fmt.Errorf("required field allow_manual_meeting_creation missing") + } + if all.AutoSummarize == nil { + return fmt.Errorf("required field auto_summarize missing") + } + if all.ModifiedAt == nil { + return fmt.Errorf("required field modified_at missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"allow_manual_meeting_creation", "auto_summarize", "created_at", "modified_at"}) + } else { + return err + } + o.AllowManualMeetingCreation = *all.AllowManualMeetingCreation + o.AutoSummarize = *all.AutoSummarize + o.CreatedAt = all.CreatedAt + o.ModifiedAt = *all.ModifiedAt + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_meet_configuration_data_request.go b/api/datadogV2/model_incident_google_meet_configuration_data_request.go new file mode 100644 index 00000000000..91d0d18b7fd --- /dev/null +++ b/api/datadogV2/model_incident_google_meet_configuration_data_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleMeetConfigurationDataRequest Google Meet configuration data in a create request. +type IncidentGoogleMeetConfigurationDataRequest struct { + // Attributes for creating a Google Meet configuration. + Attributes IncidentGoogleMeetConfigurationDataAttributesRequest `json:"attributes"` + // Relationships for a Google Meet configuration create request. + Relationships IncidentGoogleMeetConfigurationRelationshipsRequest `json:"relationships"` + // Google Meet configuration resource type. + Type IncidentGoogleMeetConfigurationType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleMeetConfigurationDataRequest instantiates a new IncidentGoogleMeetConfigurationDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleMeetConfigurationDataRequest(attributes IncidentGoogleMeetConfigurationDataAttributesRequest, relationships IncidentGoogleMeetConfigurationRelationshipsRequest, typeVar IncidentGoogleMeetConfigurationType) *IncidentGoogleMeetConfigurationDataRequest { + this := IncidentGoogleMeetConfigurationDataRequest{} + this.Attributes = attributes + this.Relationships = relationships + this.Type = typeVar + return &this +} + +// NewIncidentGoogleMeetConfigurationDataRequestWithDefaults instantiates a new IncidentGoogleMeetConfigurationDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleMeetConfigurationDataRequestWithDefaults() *IncidentGoogleMeetConfigurationDataRequest { + this := IncidentGoogleMeetConfigurationDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentGoogleMeetConfigurationDataRequest) GetAttributes() IncidentGoogleMeetConfigurationDataAttributesRequest { + if o == nil { + var ret IncidentGoogleMeetConfigurationDataAttributesRequest + 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 *IncidentGoogleMeetConfigurationDataRequest) GetAttributesOk() (*IncidentGoogleMeetConfigurationDataAttributesRequest, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentGoogleMeetConfigurationDataRequest) SetAttributes(v IncidentGoogleMeetConfigurationDataAttributesRequest) { + o.Attributes = v +} + +// GetRelationships returns the Relationships field value. +func (o *IncidentGoogleMeetConfigurationDataRequest) GetRelationships() IncidentGoogleMeetConfigurationRelationshipsRequest { + if o == nil { + var ret IncidentGoogleMeetConfigurationRelationshipsRequest + 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 *IncidentGoogleMeetConfigurationDataRequest) GetRelationshipsOk() (*IncidentGoogleMeetConfigurationRelationshipsRequest, bool) { + if o == nil { + return nil, false + } + return &o.Relationships, true +} + +// SetRelationships sets field value. +func (o *IncidentGoogleMeetConfigurationDataRequest) SetRelationships(v IncidentGoogleMeetConfigurationRelationshipsRequest) { + o.Relationships = v +} + +// GetType returns the Type field value. +func (o *IncidentGoogleMeetConfigurationDataRequest) GetType() IncidentGoogleMeetConfigurationType { + if o == nil { + var ret IncidentGoogleMeetConfigurationType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleMeetConfigurationDataRequest) GetTypeOk() (*IncidentGoogleMeetConfigurationType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentGoogleMeetConfigurationDataRequest) SetType(v IncidentGoogleMeetConfigurationType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleMeetConfigurationDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["relationships"] = o.Relationships + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleMeetConfigurationDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentGoogleMeetConfigurationDataAttributesRequest `json:"attributes"` + Relationships *IncidentGoogleMeetConfigurationRelationshipsRequest `json:"relationships"` + Type *IncidentGoogleMeetConfigurationType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Relationships == nil { + return fmt.Errorf("required field relationships missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = *all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_meet_configuration_data_response.go b/api/datadogV2/model_incident_google_meet_configuration_data_response.go new file mode 100644 index 00000000000..65f78a6f6c9 --- /dev/null +++ b/api/datadogV2/model_incident_google_meet_configuration_data_response.go @@ -0,0 +1,218 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleMeetConfigurationDataResponse Google Meet configuration data in a response. +type IncidentGoogleMeetConfigurationDataResponse struct { + // Attributes of a Google Meet configuration. + Attributes IncidentGoogleMeetConfigurationDataAttributesResponse `json:"attributes"` + // The configuration identifier. + Id uuid.UUID `json:"id"` + // Relationships for a Google Meet configuration. + Relationships *IncidentGoogleMeetConfigurationRelationships `json:"relationships,omitempty"` + // Google Meet configuration resource type. + Type IncidentGoogleMeetConfigurationType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleMeetConfigurationDataResponse instantiates a new IncidentGoogleMeetConfigurationDataResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleMeetConfigurationDataResponse(attributes IncidentGoogleMeetConfigurationDataAttributesResponse, id uuid.UUID, typeVar IncidentGoogleMeetConfigurationType) *IncidentGoogleMeetConfigurationDataResponse { + this := IncidentGoogleMeetConfigurationDataResponse{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentGoogleMeetConfigurationDataResponseWithDefaults instantiates a new IncidentGoogleMeetConfigurationDataResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleMeetConfigurationDataResponseWithDefaults() *IncidentGoogleMeetConfigurationDataResponse { + this := IncidentGoogleMeetConfigurationDataResponse{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentGoogleMeetConfigurationDataResponse) GetAttributes() IncidentGoogleMeetConfigurationDataAttributesResponse { + if o == nil { + var ret IncidentGoogleMeetConfigurationDataAttributesResponse + 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 *IncidentGoogleMeetConfigurationDataResponse) GetAttributesOk() (*IncidentGoogleMeetConfigurationDataAttributesResponse, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentGoogleMeetConfigurationDataResponse) SetAttributes(v IncidentGoogleMeetConfigurationDataAttributesResponse) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *IncidentGoogleMeetConfigurationDataResponse) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentGoogleMeetConfigurationDataResponse) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentGoogleMeetConfigurationDataResponse) SetId(v uuid.UUID) { + o.Id = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentGoogleMeetConfigurationDataResponse) GetRelationships() IncidentGoogleMeetConfigurationRelationships { + if o == nil || o.Relationships == nil { + var ret IncidentGoogleMeetConfigurationRelationships + 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 *IncidentGoogleMeetConfigurationDataResponse) GetRelationshipsOk() (*IncidentGoogleMeetConfigurationRelationships, 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 *IncidentGoogleMeetConfigurationDataResponse) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given IncidentGoogleMeetConfigurationRelationships and assigns it to the Relationships field. +func (o *IncidentGoogleMeetConfigurationDataResponse) SetRelationships(v IncidentGoogleMeetConfigurationRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *IncidentGoogleMeetConfigurationDataResponse) GetType() IncidentGoogleMeetConfigurationType { + if o == nil { + var ret IncidentGoogleMeetConfigurationType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleMeetConfigurationDataResponse) GetTypeOk() (*IncidentGoogleMeetConfigurationType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentGoogleMeetConfigurationDataResponse) SetType(v IncidentGoogleMeetConfigurationType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleMeetConfigurationDataResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleMeetConfigurationDataResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentGoogleMeetConfigurationDataAttributesResponse `json:"attributes"` + Id *uuid.UUID `json:"id"` + Relationships *IncidentGoogleMeetConfigurationRelationships `json:"relationships,omitempty"` + Type *IncidentGoogleMeetConfigurationType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_meet_configuration_patch_data_attributes_request.go b/api/datadogV2/model_incident_google_meet_configuration_patch_data_attributes_request.go new file mode 100644 index 00000000000..a2c12c0654c --- /dev/null +++ b/api/datadogV2/model_incident_google_meet_configuration_patch_data_attributes_request.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleMeetConfigurationPatchDataAttributesRequest Attributes for patching a Google Meet configuration. All fields are optional. +type IncidentGoogleMeetConfigurationPatchDataAttributesRequest struct { + // Whether to allow manual meeting creation. + AllowManualMeetingCreation *bool `json:"allow_manual_meeting_creation,omitempty"` + // Whether to auto-summarize meetings. + AutoSummarize *bool `json:"auto_summarize,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleMeetConfigurationPatchDataAttributesRequest instantiates a new IncidentGoogleMeetConfigurationPatchDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleMeetConfigurationPatchDataAttributesRequest() *IncidentGoogleMeetConfigurationPatchDataAttributesRequest { + this := IncidentGoogleMeetConfigurationPatchDataAttributesRequest{} + return &this +} + +// NewIncidentGoogleMeetConfigurationPatchDataAttributesRequestWithDefaults instantiates a new IncidentGoogleMeetConfigurationPatchDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleMeetConfigurationPatchDataAttributesRequestWithDefaults() *IncidentGoogleMeetConfigurationPatchDataAttributesRequest { + this := IncidentGoogleMeetConfigurationPatchDataAttributesRequest{} + return &this +} + +// GetAllowManualMeetingCreation returns the AllowManualMeetingCreation field value if set, zero value otherwise. +func (o *IncidentGoogleMeetConfigurationPatchDataAttributesRequest) GetAllowManualMeetingCreation() bool { + if o == nil || o.AllowManualMeetingCreation == nil { + var ret bool + return ret + } + return *o.AllowManualMeetingCreation +} + +// GetAllowManualMeetingCreationOk returns a tuple with the AllowManualMeetingCreation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentGoogleMeetConfigurationPatchDataAttributesRequest) GetAllowManualMeetingCreationOk() (*bool, bool) { + if o == nil || o.AllowManualMeetingCreation == nil { + return nil, false + } + return o.AllowManualMeetingCreation, true +} + +// HasAllowManualMeetingCreation returns a boolean if a field has been set. +func (o *IncidentGoogleMeetConfigurationPatchDataAttributesRequest) HasAllowManualMeetingCreation() bool { + return o != nil && o.AllowManualMeetingCreation != nil +} + +// SetAllowManualMeetingCreation gets a reference to the given bool and assigns it to the AllowManualMeetingCreation field. +func (o *IncidentGoogleMeetConfigurationPatchDataAttributesRequest) SetAllowManualMeetingCreation(v bool) { + o.AllowManualMeetingCreation = &v +} + +// GetAutoSummarize returns the AutoSummarize field value if set, zero value otherwise. +func (o *IncidentGoogleMeetConfigurationPatchDataAttributesRequest) GetAutoSummarize() bool { + if o == nil || o.AutoSummarize == nil { + var ret bool + return ret + } + return *o.AutoSummarize +} + +// GetAutoSummarizeOk returns a tuple with the AutoSummarize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentGoogleMeetConfigurationPatchDataAttributesRequest) GetAutoSummarizeOk() (*bool, bool) { + if o == nil || o.AutoSummarize == nil { + return nil, false + } + return o.AutoSummarize, true +} + +// HasAutoSummarize returns a boolean if a field has been set. +func (o *IncidentGoogleMeetConfigurationPatchDataAttributesRequest) HasAutoSummarize() bool { + return o != nil && o.AutoSummarize != nil +} + +// SetAutoSummarize gets a reference to the given bool and assigns it to the AutoSummarize field. +func (o *IncidentGoogleMeetConfigurationPatchDataAttributesRequest) SetAutoSummarize(v bool) { + o.AutoSummarize = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleMeetConfigurationPatchDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AllowManualMeetingCreation != nil { + toSerialize["allow_manual_meeting_creation"] = o.AllowManualMeetingCreation + } + if o.AutoSummarize != nil { + toSerialize["auto_summarize"] = o.AutoSummarize + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleMeetConfigurationPatchDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AllowManualMeetingCreation *bool `json:"allow_manual_meeting_creation,omitempty"` + AutoSummarize *bool `json:"auto_summarize,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"allow_manual_meeting_creation", "auto_summarize"}) + } else { + return err + } + o.AllowManualMeetingCreation = all.AllowManualMeetingCreation + o.AutoSummarize = all.AutoSummarize + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_meet_configuration_patch_data_request.go b/api/datadogV2/model_incident_google_meet_configuration_patch_data_request.go new file mode 100644 index 00000000000..1dde5189fa9 --- /dev/null +++ b/api/datadogV2/model_incident_google_meet_configuration_patch_data_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 datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleMeetConfigurationPatchDataRequest Google Meet configuration data in a patch request. +type IncidentGoogleMeetConfigurationPatchDataRequest struct { + // Attributes for patching a Google Meet configuration. All fields are optional. + Attributes *IncidentGoogleMeetConfigurationPatchDataAttributesRequest `json:"attributes,omitempty"` + // The configuration identifier. + Id uuid.UUID `json:"id"` + // Google Meet configuration resource type. + Type IncidentGoogleMeetConfigurationType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleMeetConfigurationPatchDataRequest instantiates a new IncidentGoogleMeetConfigurationPatchDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleMeetConfigurationPatchDataRequest(id uuid.UUID, typeVar IncidentGoogleMeetConfigurationType) *IncidentGoogleMeetConfigurationPatchDataRequest { + this := IncidentGoogleMeetConfigurationPatchDataRequest{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentGoogleMeetConfigurationPatchDataRequestWithDefaults instantiates a new IncidentGoogleMeetConfigurationPatchDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleMeetConfigurationPatchDataRequestWithDefaults() *IncidentGoogleMeetConfigurationPatchDataRequest { + this := IncidentGoogleMeetConfigurationPatchDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *IncidentGoogleMeetConfigurationPatchDataRequest) GetAttributes() IncidentGoogleMeetConfigurationPatchDataAttributesRequest { + if o == nil || o.Attributes == nil { + var ret IncidentGoogleMeetConfigurationPatchDataAttributesRequest + 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 *IncidentGoogleMeetConfigurationPatchDataRequest) GetAttributesOk() (*IncidentGoogleMeetConfigurationPatchDataAttributesRequest, 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 *IncidentGoogleMeetConfigurationPatchDataRequest) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given IncidentGoogleMeetConfigurationPatchDataAttributesRequest and assigns it to the Attributes field. +func (o *IncidentGoogleMeetConfigurationPatchDataRequest) SetAttributes(v IncidentGoogleMeetConfigurationPatchDataAttributesRequest) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *IncidentGoogleMeetConfigurationPatchDataRequest) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentGoogleMeetConfigurationPatchDataRequest) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentGoogleMeetConfigurationPatchDataRequest) SetId(v uuid.UUID) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *IncidentGoogleMeetConfigurationPatchDataRequest) GetType() IncidentGoogleMeetConfigurationType { + if o == nil { + var ret IncidentGoogleMeetConfigurationType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleMeetConfigurationPatchDataRequest) GetTypeOk() (*IncidentGoogleMeetConfigurationType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentGoogleMeetConfigurationPatchDataRequest) SetType(v IncidentGoogleMeetConfigurationType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleMeetConfigurationPatchDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleMeetConfigurationPatchDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentGoogleMeetConfigurationPatchDataAttributesRequest `json:"attributes,omitempty"` + Id *uuid.UUID `json:"id"` + Type *IncidentGoogleMeetConfigurationType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_meet_configuration_patch_request.go b/api/datadogV2/model_incident_google_meet_configuration_patch_request.go new file mode 100644 index 00000000000..c026478c45b --- /dev/null +++ b/api/datadogV2/model_incident_google_meet_configuration_patch_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleMeetConfigurationPatchRequest Request payload for patching a Google Meet configuration. +type IncidentGoogleMeetConfigurationPatchRequest struct { + // Google Meet configuration data in a patch request. + Data IncidentGoogleMeetConfigurationPatchDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleMeetConfigurationPatchRequest instantiates a new IncidentGoogleMeetConfigurationPatchRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleMeetConfigurationPatchRequest(data IncidentGoogleMeetConfigurationPatchDataRequest) *IncidentGoogleMeetConfigurationPatchRequest { + this := IncidentGoogleMeetConfigurationPatchRequest{} + this.Data = data + return &this +} + +// NewIncidentGoogleMeetConfigurationPatchRequestWithDefaults instantiates a new IncidentGoogleMeetConfigurationPatchRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleMeetConfigurationPatchRequestWithDefaults() *IncidentGoogleMeetConfigurationPatchRequest { + this := IncidentGoogleMeetConfigurationPatchRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentGoogleMeetConfigurationPatchRequest) GetData() IncidentGoogleMeetConfigurationPatchDataRequest { + if o == nil { + var ret IncidentGoogleMeetConfigurationPatchDataRequest + 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 *IncidentGoogleMeetConfigurationPatchRequest) GetDataOk() (*IncidentGoogleMeetConfigurationPatchDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentGoogleMeetConfigurationPatchRequest) SetData(v IncidentGoogleMeetConfigurationPatchDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleMeetConfigurationPatchRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleMeetConfigurationPatchRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentGoogleMeetConfigurationPatchDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_meet_configuration_relationships.go b/api/datadogV2/model_incident_google_meet_configuration_relationships.go new file mode 100644 index 00000000000..eabffdf3137 --- /dev/null +++ b/api/datadogV2/model_incident_google_meet_configuration_relationships.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleMeetConfigurationRelationships Relationships for a Google Meet configuration. +type IncidentGoogleMeetConfigurationRelationships struct { + // Relationship to user. + CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"` + // Relationship to an incident type. + IncidentType *RelationshipToIncidentType `json:"incident_type,omitempty"` + // Relationship to user. + LastModifiedByUser *RelationshipToUser `json:"last_modified_by_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{} `json:"-"` +} + +// NewIncidentGoogleMeetConfigurationRelationships instantiates a new IncidentGoogleMeetConfigurationRelationships object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleMeetConfigurationRelationships() *IncidentGoogleMeetConfigurationRelationships { + this := IncidentGoogleMeetConfigurationRelationships{} + return &this +} + +// NewIncidentGoogleMeetConfigurationRelationshipsWithDefaults instantiates a new IncidentGoogleMeetConfigurationRelationships object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleMeetConfigurationRelationshipsWithDefaults() *IncidentGoogleMeetConfigurationRelationships { + this := IncidentGoogleMeetConfigurationRelationships{} + return &this +} + +// GetCreatedByUser returns the CreatedByUser field value if set, zero value otherwise. +func (o *IncidentGoogleMeetConfigurationRelationships) 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 *IncidentGoogleMeetConfigurationRelationships) 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 *IncidentGoogleMeetConfigurationRelationships) HasCreatedByUser() bool { + return o != nil && o.CreatedByUser != nil +} + +// SetCreatedByUser gets a reference to the given RelationshipToUser and assigns it to the CreatedByUser field. +func (o *IncidentGoogleMeetConfigurationRelationships) SetCreatedByUser(v RelationshipToUser) { + o.CreatedByUser = &v +} + +// GetIncidentType returns the IncidentType field value if set, zero value otherwise. +func (o *IncidentGoogleMeetConfigurationRelationships) GetIncidentType() RelationshipToIncidentType { + if o == nil || o.IncidentType == nil { + var ret RelationshipToIncidentType + return ret + } + return *o.IncidentType +} + +// GetIncidentTypeOk returns a tuple with the IncidentType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentGoogleMeetConfigurationRelationships) GetIncidentTypeOk() (*RelationshipToIncidentType, bool) { + if o == nil || o.IncidentType == nil { + return nil, false + } + return o.IncidentType, true +} + +// HasIncidentType returns a boolean if a field has been set. +func (o *IncidentGoogleMeetConfigurationRelationships) HasIncidentType() bool { + return o != nil && o.IncidentType != nil +} + +// SetIncidentType gets a reference to the given RelationshipToIncidentType and assigns it to the IncidentType field. +func (o *IncidentGoogleMeetConfigurationRelationships) SetIncidentType(v RelationshipToIncidentType) { + o.IncidentType = &v +} + +// GetLastModifiedByUser returns the LastModifiedByUser field value if set, zero value otherwise. +func (o *IncidentGoogleMeetConfigurationRelationships) 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 *IncidentGoogleMeetConfigurationRelationships) 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 *IncidentGoogleMeetConfigurationRelationships) HasLastModifiedByUser() bool { + return o != nil && o.LastModifiedByUser != nil +} + +// SetLastModifiedByUser gets a reference to the given RelationshipToUser and assigns it to the LastModifiedByUser field. +func (o *IncidentGoogleMeetConfigurationRelationships) SetLastModifiedByUser(v RelationshipToUser) { + o.LastModifiedByUser = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleMeetConfigurationRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CreatedByUser != nil { + toSerialize["created_by_user"] = o.CreatedByUser + } + if o.IncidentType != nil { + toSerialize["incident_type"] = o.IncidentType + } + if o.LastModifiedByUser != nil { + toSerialize["last_modified_by_user"] = o.LastModifiedByUser + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleMeetConfigurationRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"` + IncidentType *RelationshipToIncidentType `json:"incident_type,omitempty"` + LastModifiedByUser *RelationshipToUser `json:"last_modified_by_user,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_by_user", "incident_type", "last_modified_by_user"}) + } else { + return err + } + + hasInvalidField := false + if all.CreatedByUser != nil && all.CreatedByUser.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CreatedByUser = all.CreatedByUser + if all.IncidentType != nil && all.IncidentType.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IncidentType = all.IncidentType + if all.LastModifiedByUser != nil && all.LastModifiedByUser.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LastModifiedByUser = all.LastModifiedByUser + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_meet_configuration_relationships_request.go b/api/datadogV2/model_incident_google_meet_configuration_relationships_request.go new file mode 100644 index 00000000000..c5c75aba999 --- /dev/null +++ b/api/datadogV2/model_incident_google_meet_configuration_relationships_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleMeetConfigurationRelationshipsRequest Relationships for a Google Meet configuration create request. +type IncidentGoogleMeetConfigurationRelationshipsRequest struct { + // Relationship to an incident type. + IncidentType RelationshipToIncidentType `json:"incident_type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleMeetConfigurationRelationshipsRequest instantiates a new IncidentGoogleMeetConfigurationRelationshipsRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleMeetConfigurationRelationshipsRequest(incidentType RelationshipToIncidentType) *IncidentGoogleMeetConfigurationRelationshipsRequest { + this := IncidentGoogleMeetConfigurationRelationshipsRequest{} + this.IncidentType = incidentType + return &this +} + +// NewIncidentGoogleMeetConfigurationRelationshipsRequestWithDefaults instantiates a new IncidentGoogleMeetConfigurationRelationshipsRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleMeetConfigurationRelationshipsRequestWithDefaults() *IncidentGoogleMeetConfigurationRelationshipsRequest { + this := IncidentGoogleMeetConfigurationRelationshipsRequest{} + return &this +} + +// GetIncidentType returns the IncidentType field value. +func (o *IncidentGoogleMeetConfigurationRelationshipsRequest) GetIncidentType() RelationshipToIncidentType { + if o == nil { + var ret RelationshipToIncidentType + return ret + } + return o.IncidentType +} + +// GetIncidentTypeOk returns a tuple with the IncidentType field value +// and a boolean to check if the value has been set. +func (o *IncidentGoogleMeetConfigurationRelationshipsRequest) GetIncidentTypeOk() (*RelationshipToIncidentType, bool) { + if o == nil { + return nil, false + } + return &o.IncidentType, true +} + +// SetIncidentType sets field value. +func (o *IncidentGoogleMeetConfigurationRelationshipsRequest) SetIncidentType(v RelationshipToIncidentType) { + o.IncidentType = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleMeetConfigurationRelationshipsRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["incident_type"] = o.IncidentType + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleMeetConfigurationRelationshipsRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncidentType *RelationshipToIncidentType `json:"incident_type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncidentType == nil { + return fmt.Errorf("required field incident_type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"incident_type"}) + } else { + return err + } + + hasInvalidField := false + if all.IncidentType.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IncidentType = *all.IncidentType + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_meet_configuration_request.go b/api/datadogV2/model_incident_google_meet_configuration_request.go new file mode 100644 index 00000000000..4660e9cdaa1 --- /dev/null +++ b/api/datadogV2/model_incident_google_meet_configuration_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleMeetConfigurationRequest Request payload for creating a Google Meet configuration. +type IncidentGoogleMeetConfigurationRequest struct { + // Google Meet configuration data in a create request. + Data IncidentGoogleMeetConfigurationDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentGoogleMeetConfigurationRequest instantiates a new IncidentGoogleMeetConfigurationRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleMeetConfigurationRequest(data IncidentGoogleMeetConfigurationDataRequest) *IncidentGoogleMeetConfigurationRequest { + this := IncidentGoogleMeetConfigurationRequest{} + this.Data = data + return &this +} + +// NewIncidentGoogleMeetConfigurationRequestWithDefaults instantiates a new IncidentGoogleMeetConfigurationRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleMeetConfigurationRequestWithDefaults() *IncidentGoogleMeetConfigurationRequest { + this := IncidentGoogleMeetConfigurationRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentGoogleMeetConfigurationRequest) GetData() IncidentGoogleMeetConfigurationDataRequest { + if o == nil { + var ret IncidentGoogleMeetConfigurationDataRequest + 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 *IncidentGoogleMeetConfigurationRequest) GetDataOk() (*IncidentGoogleMeetConfigurationDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentGoogleMeetConfigurationRequest) SetData(v IncidentGoogleMeetConfigurationDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleMeetConfigurationRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleMeetConfigurationRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentGoogleMeetConfigurationDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_meet_configuration_response.go b/api/datadogV2/model_incident_google_meet_configuration_response.go new file mode 100644 index 00000000000..b40d116ed05 --- /dev/null +++ b/api/datadogV2/model_incident_google_meet_configuration_response.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleMeetConfigurationResponse Response with a Google Meet configuration. +type IncidentGoogleMeetConfigurationResponse struct { + // Google Meet configuration data in a response. + Data IncidentGoogleMeetConfigurationDataResponse `json:"data"` + // Included related resources. + Included []IncidentUserData `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{} `json:"-"` +} + +// NewIncidentGoogleMeetConfigurationResponse instantiates a new IncidentGoogleMeetConfigurationResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentGoogleMeetConfigurationResponse(data IncidentGoogleMeetConfigurationDataResponse) *IncidentGoogleMeetConfigurationResponse { + this := IncidentGoogleMeetConfigurationResponse{} + this.Data = data + return &this +} + +// NewIncidentGoogleMeetConfigurationResponseWithDefaults instantiates a new IncidentGoogleMeetConfigurationResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentGoogleMeetConfigurationResponseWithDefaults() *IncidentGoogleMeetConfigurationResponse { + this := IncidentGoogleMeetConfigurationResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentGoogleMeetConfigurationResponse) GetData() IncidentGoogleMeetConfigurationDataResponse { + if o == nil { + var ret IncidentGoogleMeetConfigurationDataResponse + 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 *IncidentGoogleMeetConfigurationResponse) GetDataOk() (*IncidentGoogleMeetConfigurationDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentGoogleMeetConfigurationResponse) SetData(v IncidentGoogleMeetConfigurationDataResponse) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentGoogleMeetConfigurationResponse) GetIncluded() []IncidentUserData { + if o == nil || o.Included == nil { + var ret []IncidentUserData + 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 *IncidentGoogleMeetConfigurationResponse) GetIncludedOk() (*[]IncidentUserData, 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 *IncidentGoogleMeetConfigurationResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []IncidentUserData and assigns it to the Included field. +func (o *IncidentGoogleMeetConfigurationResponse) SetIncluded(v []IncidentUserData) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentGoogleMeetConfigurationResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentGoogleMeetConfigurationResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentGoogleMeetConfigurationDataResponse `json:"data"` + Included []IncidentUserData `json:"included,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + o.Included = all.Included + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_google_meet_configuration_type.go b/api/datadogV2/model_incident_google_meet_configuration_type.go new file mode 100644 index 00000000000..a924afe9d9c --- /dev/null +++ b/api/datadogV2/model_incident_google_meet_configuration_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentGoogleMeetConfigurationType Google Meet configuration resource type. +type IncidentGoogleMeetConfigurationType string + +// List of IncidentGoogleMeetConfigurationType. +const ( + INCIDENTGOOGLEMEETCONFIGURATIONTYPE_GOOGLE_MEET_CONFIGURATIONS IncidentGoogleMeetConfigurationType = "google_meet_configurations" +) + +var allowedIncidentGoogleMeetConfigurationTypeEnumValues = []IncidentGoogleMeetConfigurationType{ + INCIDENTGOOGLEMEETCONFIGURATIONTYPE_GOOGLE_MEET_CONFIGURATIONS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentGoogleMeetConfigurationType) GetAllowedValues() []IncidentGoogleMeetConfigurationType { + return allowedIncidentGoogleMeetConfigurationTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentGoogleMeetConfigurationType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentGoogleMeetConfigurationType(value) + return nil +} + +// NewIncidentGoogleMeetConfigurationTypeFromValue returns a pointer to a valid IncidentGoogleMeetConfigurationType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentGoogleMeetConfigurationTypeFromValue(v string) (*IncidentGoogleMeetConfigurationType, error) { + ev := IncidentGoogleMeetConfigurationType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentGoogleMeetConfigurationType: valid values are %v", v, allowedIncidentGoogleMeetConfigurationTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentGoogleMeetConfigurationType) IsValid() bool { + for _, existing := range allowedIncidentGoogleMeetConfigurationTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentGoogleMeetConfigurationType value. +func (v IncidentGoogleMeetConfigurationType) Ptr() *IncidentGoogleMeetConfigurationType { + return &v +} diff --git a/api/datadogV2/model_incident_impact_field_choice.go b/api/datadogV2/model_incident_impact_field_choice.go new file mode 100644 index 00000000000..6f2a59bd81f --- /dev/null +++ b/api/datadogV2/model_incident_impact_field_choice.go @@ -0,0 +1,168 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentImpactFieldChoice A choice option for a dropdown or multiselect impact field. +type IncidentImpactFieldChoice struct { + // The description of the choice. + Description *string `json:"description,omitempty"` + // The display name of the choice. + DisplayName string `json:"display_name"` + // The value of the choice. + 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{} `json:"-"` +} + +// NewIncidentImpactFieldChoice instantiates a new IncidentImpactFieldChoice object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentImpactFieldChoice(displayName string, value string) *IncidentImpactFieldChoice { + this := IncidentImpactFieldChoice{} + this.DisplayName = displayName + this.Value = value + return &this +} + +// NewIncidentImpactFieldChoiceWithDefaults instantiates a new IncidentImpactFieldChoice object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentImpactFieldChoiceWithDefaults() *IncidentImpactFieldChoice { + this := IncidentImpactFieldChoice{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *IncidentImpactFieldChoice) 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 *IncidentImpactFieldChoice) 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 *IncidentImpactFieldChoice) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *IncidentImpactFieldChoice) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value. +func (o *IncidentImpactFieldChoice) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *IncidentImpactFieldChoice) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value. +func (o *IncidentImpactFieldChoice) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetValue returns the Value field value. +func (o *IncidentImpactFieldChoice) 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 *IncidentImpactFieldChoice) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value. +func (o *IncidentImpactFieldChoice) SetValue(v string) { + o.Value = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentImpactFieldChoice) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + toSerialize["display_name"] = o.DisplayName + toSerialize["value"] = o.Value + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentImpactFieldChoice) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Description *string `json:"description,omitempty"` + DisplayName *string `json:"display_name"` + Value *string `json:"value"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.DisplayName == nil { + return fmt.Errorf("required field display_name missing") + } + if all.Value == nil { + return fmt.Errorf("required field value missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"description", "display_name", "value"}) + } else { + return err + } + o.Description = all.Description + o.DisplayName = *all.DisplayName + o.Value = *all.Value + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_impact_field_data_attributes_request.go b/api/datadogV2/model_incident_impact_field_data_attributes_request.go new file mode 100644 index 00000000000..c5309d9a24d --- /dev/null +++ b/api/datadogV2/model_incident_impact_field_data_attributes_request.go @@ -0,0 +1,256 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentImpactFieldDataAttributesRequest Attributes for creating an impact field. +type IncidentImpactFieldDataAttributesRequest struct { + // The display name of the impact field. + DisplayName string `json:"display_name"` + // The choices for dropdown or multiselect fields. + FieldChoices []IncidentImpactFieldChoice `json:"field_choices,omitempty"` + // The type of an impact field. + FieldType IncidentImpactFieldValueType `json:"field_type"` + // The normalized name of the impact field (used as identifier). + Name string `json:"name"` + // The tag key associated with the field (for metrictag type). + TagKey datadog.NullableString `json:"tag_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{} `json:"-"` +} + +// NewIncidentImpactFieldDataAttributesRequest instantiates a new IncidentImpactFieldDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentImpactFieldDataAttributesRequest(displayName string, fieldType IncidentImpactFieldValueType, name string) *IncidentImpactFieldDataAttributesRequest { + this := IncidentImpactFieldDataAttributesRequest{} + this.DisplayName = displayName + this.FieldType = fieldType + this.Name = name + return &this +} + +// NewIncidentImpactFieldDataAttributesRequestWithDefaults instantiates a new IncidentImpactFieldDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentImpactFieldDataAttributesRequestWithDefaults() *IncidentImpactFieldDataAttributesRequest { + this := IncidentImpactFieldDataAttributesRequest{} + return &this +} + +// GetDisplayName returns the DisplayName field value. +func (o *IncidentImpactFieldDataAttributesRequest) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *IncidentImpactFieldDataAttributesRequest) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value. +func (o *IncidentImpactFieldDataAttributesRequest) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetFieldChoices returns the FieldChoices field value if set, zero value otherwise. +func (o *IncidentImpactFieldDataAttributesRequest) GetFieldChoices() []IncidentImpactFieldChoice { + if o == nil || o.FieldChoices == nil { + var ret []IncidentImpactFieldChoice + return ret + } + return o.FieldChoices +} + +// GetFieldChoicesOk returns a tuple with the FieldChoices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentImpactFieldDataAttributesRequest) GetFieldChoicesOk() (*[]IncidentImpactFieldChoice, bool) { + if o == nil || o.FieldChoices == nil { + return nil, false + } + return &o.FieldChoices, true +} + +// HasFieldChoices returns a boolean if a field has been set. +func (o *IncidentImpactFieldDataAttributesRequest) HasFieldChoices() bool { + return o != nil && o.FieldChoices != nil +} + +// SetFieldChoices gets a reference to the given []IncidentImpactFieldChoice and assigns it to the FieldChoices field. +func (o *IncidentImpactFieldDataAttributesRequest) SetFieldChoices(v []IncidentImpactFieldChoice) { + o.FieldChoices = v +} + +// GetFieldType returns the FieldType field value. +func (o *IncidentImpactFieldDataAttributesRequest) GetFieldType() IncidentImpactFieldValueType { + if o == nil { + var ret IncidentImpactFieldValueType + return ret + } + return o.FieldType +} + +// GetFieldTypeOk returns a tuple with the FieldType field value +// and a boolean to check if the value has been set. +func (o *IncidentImpactFieldDataAttributesRequest) GetFieldTypeOk() (*IncidentImpactFieldValueType, bool) { + if o == nil { + return nil, false + } + return &o.FieldType, true +} + +// SetFieldType sets field value. +func (o *IncidentImpactFieldDataAttributesRequest) SetFieldType(v IncidentImpactFieldValueType) { + o.FieldType = v +} + +// GetName returns the Name field value. +func (o *IncidentImpactFieldDataAttributesRequest) 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 *IncidentImpactFieldDataAttributesRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *IncidentImpactFieldDataAttributesRequest) SetName(v string) { + o.Name = v +} + +// GetTagKey returns the TagKey field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentImpactFieldDataAttributesRequest) GetTagKey() string { + if o == nil || o.TagKey.Get() == nil { + var ret string + return ret + } + return *o.TagKey.Get() +} + +// GetTagKeyOk returns a tuple with the TagKey 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 *IncidentImpactFieldDataAttributesRequest) GetTagKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.TagKey.Get(), o.TagKey.IsSet() +} + +// HasTagKey returns a boolean if a field has been set. +func (o *IncidentImpactFieldDataAttributesRequest) HasTagKey() bool { + return o != nil && o.TagKey.IsSet() +} + +// SetTagKey gets a reference to the given datadog.NullableString and assigns it to the TagKey field. +func (o *IncidentImpactFieldDataAttributesRequest) SetTagKey(v string) { + o.TagKey.Set(&v) +} + +// SetTagKeyNil sets the value for TagKey to be an explicit nil. +func (o *IncidentImpactFieldDataAttributesRequest) SetTagKeyNil() { + o.TagKey.Set(nil) +} + +// UnsetTagKey ensures that no value is present for TagKey, not even an explicit nil. +func (o *IncidentImpactFieldDataAttributesRequest) UnsetTagKey() { + o.TagKey.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentImpactFieldDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["display_name"] = o.DisplayName + if o.FieldChoices != nil { + toSerialize["field_choices"] = o.FieldChoices + } + toSerialize["field_type"] = o.FieldType + toSerialize["name"] = o.Name + if o.TagKey.IsSet() { + toSerialize["tag_key"] = o.TagKey.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentImpactFieldDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DisplayName *string `json:"display_name"` + FieldChoices []IncidentImpactFieldChoice `json:"field_choices,omitempty"` + FieldType *IncidentImpactFieldValueType `json:"field_type"` + Name *string `json:"name"` + TagKey datadog.NullableString `json:"tag_key,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.DisplayName == nil { + return fmt.Errorf("required field display_name missing") + } + if all.FieldType == nil { + return fmt.Errorf("required field field_type missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"display_name", "field_choices", "field_type", "name", "tag_key"}) + } else { + return err + } + + hasInvalidField := false + o.DisplayName = *all.DisplayName + o.FieldChoices = all.FieldChoices + if !all.FieldType.IsValid() { + hasInvalidField = true + } else { + o.FieldType = *all.FieldType + } + o.Name = *all.Name + o.TagKey = all.TagKey + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_impact_field_data_attributes_response.go b/api/datadogV2/model_incident_impact_field_data_attributes_response.go new file mode 100644 index 00000000000..e1b0d9823d9 --- /dev/null +++ b/api/datadogV2/model_incident_impact_field_data_attributes_response.go @@ -0,0 +1,256 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentImpactFieldDataAttributesResponse Attributes of an impact field in a response. +type IncidentImpactFieldDataAttributesResponse struct { + // The display name of the impact field. + DisplayName string `json:"display_name"` + // The choices for dropdown or multiselect fields. + FieldChoices []IncidentImpactFieldChoice `json:"field_choices,omitempty"` + // The type of an impact field. + FieldType IncidentImpactFieldValueType `json:"field_type"` + // The normalized name of the impact field. + Name string `json:"name"` + // The tag key associated with the field. + TagKey datadog.NullableString `json:"tag_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{} `json:"-"` +} + +// NewIncidentImpactFieldDataAttributesResponse instantiates a new IncidentImpactFieldDataAttributesResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentImpactFieldDataAttributesResponse(displayName string, fieldType IncidentImpactFieldValueType, name string) *IncidentImpactFieldDataAttributesResponse { + this := IncidentImpactFieldDataAttributesResponse{} + this.DisplayName = displayName + this.FieldType = fieldType + this.Name = name + return &this +} + +// NewIncidentImpactFieldDataAttributesResponseWithDefaults instantiates a new IncidentImpactFieldDataAttributesResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentImpactFieldDataAttributesResponseWithDefaults() *IncidentImpactFieldDataAttributesResponse { + this := IncidentImpactFieldDataAttributesResponse{} + return &this +} + +// GetDisplayName returns the DisplayName field value. +func (o *IncidentImpactFieldDataAttributesResponse) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *IncidentImpactFieldDataAttributesResponse) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value. +func (o *IncidentImpactFieldDataAttributesResponse) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetFieldChoices returns the FieldChoices field value if set, zero value otherwise. +func (o *IncidentImpactFieldDataAttributesResponse) GetFieldChoices() []IncidentImpactFieldChoice { + if o == nil || o.FieldChoices == nil { + var ret []IncidentImpactFieldChoice + return ret + } + return o.FieldChoices +} + +// GetFieldChoicesOk returns a tuple with the FieldChoices field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentImpactFieldDataAttributesResponse) GetFieldChoicesOk() (*[]IncidentImpactFieldChoice, bool) { + if o == nil || o.FieldChoices == nil { + return nil, false + } + return &o.FieldChoices, true +} + +// HasFieldChoices returns a boolean if a field has been set. +func (o *IncidentImpactFieldDataAttributesResponse) HasFieldChoices() bool { + return o != nil && o.FieldChoices != nil +} + +// SetFieldChoices gets a reference to the given []IncidentImpactFieldChoice and assigns it to the FieldChoices field. +func (o *IncidentImpactFieldDataAttributesResponse) SetFieldChoices(v []IncidentImpactFieldChoice) { + o.FieldChoices = v +} + +// GetFieldType returns the FieldType field value. +func (o *IncidentImpactFieldDataAttributesResponse) GetFieldType() IncidentImpactFieldValueType { + if o == nil { + var ret IncidentImpactFieldValueType + return ret + } + return o.FieldType +} + +// GetFieldTypeOk returns a tuple with the FieldType field value +// and a boolean to check if the value has been set. +func (o *IncidentImpactFieldDataAttributesResponse) GetFieldTypeOk() (*IncidentImpactFieldValueType, bool) { + if o == nil { + return nil, false + } + return &o.FieldType, true +} + +// SetFieldType sets field value. +func (o *IncidentImpactFieldDataAttributesResponse) SetFieldType(v IncidentImpactFieldValueType) { + o.FieldType = v +} + +// GetName returns the Name field value. +func (o *IncidentImpactFieldDataAttributesResponse) 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 *IncidentImpactFieldDataAttributesResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *IncidentImpactFieldDataAttributesResponse) SetName(v string) { + o.Name = v +} + +// GetTagKey returns the TagKey field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentImpactFieldDataAttributesResponse) GetTagKey() string { + if o == nil || o.TagKey.Get() == nil { + var ret string + return ret + } + return *o.TagKey.Get() +} + +// GetTagKeyOk returns a tuple with the TagKey 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 *IncidentImpactFieldDataAttributesResponse) GetTagKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.TagKey.Get(), o.TagKey.IsSet() +} + +// HasTagKey returns a boolean if a field has been set. +func (o *IncidentImpactFieldDataAttributesResponse) HasTagKey() bool { + return o != nil && o.TagKey.IsSet() +} + +// SetTagKey gets a reference to the given datadog.NullableString and assigns it to the TagKey field. +func (o *IncidentImpactFieldDataAttributesResponse) SetTagKey(v string) { + o.TagKey.Set(&v) +} + +// SetTagKeyNil sets the value for TagKey to be an explicit nil. +func (o *IncidentImpactFieldDataAttributesResponse) SetTagKeyNil() { + o.TagKey.Set(nil) +} + +// UnsetTagKey ensures that no value is present for TagKey, not even an explicit nil. +func (o *IncidentImpactFieldDataAttributesResponse) UnsetTagKey() { + o.TagKey.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentImpactFieldDataAttributesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["display_name"] = o.DisplayName + if o.FieldChoices != nil { + toSerialize["field_choices"] = o.FieldChoices + } + toSerialize["field_type"] = o.FieldType + toSerialize["name"] = o.Name + if o.TagKey.IsSet() { + toSerialize["tag_key"] = o.TagKey.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentImpactFieldDataAttributesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + DisplayName *string `json:"display_name"` + FieldChoices []IncidentImpactFieldChoice `json:"field_choices,omitempty"` + FieldType *IncidentImpactFieldValueType `json:"field_type"` + Name *string `json:"name"` + TagKey datadog.NullableString `json:"tag_key,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.DisplayName == nil { + return fmt.Errorf("required field display_name missing") + } + if all.FieldType == nil { + return fmt.Errorf("required field field_type missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"display_name", "field_choices", "field_type", "name", "tag_key"}) + } else { + return err + } + + hasInvalidField := false + o.DisplayName = *all.DisplayName + o.FieldChoices = all.FieldChoices + if !all.FieldType.IsValid() { + hasInvalidField = true + } else { + o.FieldType = *all.FieldType + } + o.Name = *all.Name + o.TagKey = all.TagKey + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_impact_field_data_request.go b/api/datadogV2/model_incident_impact_field_data_request.go new file mode 100644 index 00000000000..e2e1e098708 --- /dev/null +++ b/api/datadogV2/model_incident_impact_field_data_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentImpactFieldDataRequest Impact field data in a create request. +type IncidentImpactFieldDataRequest struct { + // Attributes for creating an impact field. + Attributes IncidentImpactFieldDataAttributesRequest `json:"attributes"` + // Relationships for an impact field create request. + Relationships IncidentImpactFieldRelationshipsRequest `json:"relationships"` + // Impact field resource type. + Type IncidentImpactFieldType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentImpactFieldDataRequest instantiates a new IncidentImpactFieldDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentImpactFieldDataRequest(attributes IncidentImpactFieldDataAttributesRequest, relationships IncidentImpactFieldRelationshipsRequest, typeVar IncidentImpactFieldType) *IncidentImpactFieldDataRequest { + this := IncidentImpactFieldDataRequest{} + this.Attributes = attributes + this.Relationships = relationships + this.Type = typeVar + return &this +} + +// NewIncidentImpactFieldDataRequestWithDefaults instantiates a new IncidentImpactFieldDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentImpactFieldDataRequestWithDefaults() *IncidentImpactFieldDataRequest { + this := IncidentImpactFieldDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentImpactFieldDataRequest) GetAttributes() IncidentImpactFieldDataAttributesRequest { + if o == nil { + var ret IncidentImpactFieldDataAttributesRequest + 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 *IncidentImpactFieldDataRequest) GetAttributesOk() (*IncidentImpactFieldDataAttributesRequest, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentImpactFieldDataRequest) SetAttributes(v IncidentImpactFieldDataAttributesRequest) { + o.Attributes = v +} + +// GetRelationships returns the Relationships field value. +func (o *IncidentImpactFieldDataRequest) GetRelationships() IncidentImpactFieldRelationshipsRequest { + if o == nil { + var ret IncidentImpactFieldRelationshipsRequest + 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 *IncidentImpactFieldDataRequest) GetRelationshipsOk() (*IncidentImpactFieldRelationshipsRequest, bool) { + if o == nil { + return nil, false + } + return &o.Relationships, true +} + +// SetRelationships sets field value. +func (o *IncidentImpactFieldDataRequest) SetRelationships(v IncidentImpactFieldRelationshipsRequest) { + o.Relationships = v +} + +// GetType returns the Type field value. +func (o *IncidentImpactFieldDataRequest) GetType() IncidentImpactFieldType { + if o == nil { + var ret IncidentImpactFieldType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentImpactFieldDataRequest) GetTypeOk() (*IncidentImpactFieldType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentImpactFieldDataRequest) SetType(v IncidentImpactFieldType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentImpactFieldDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["relationships"] = o.Relationships + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentImpactFieldDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentImpactFieldDataAttributesRequest `json:"attributes"` + Relationships *IncidentImpactFieldRelationshipsRequest `json:"relationships"` + Type *IncidentImpactFieldType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Relationships == nil { + return fmt.Errorf("required field relationships missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = *all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_impact_field_data_response.go b/api/datadogV2/model_incident_impact_field_data_response.go new file mode 100644 index 00000000000..71642b5a28e --- /dev/null +++ b/api/datadogV2/model_incident_impact_field_data_response.go @@ -0,0 +1,218 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentImpactFieldDataResponse Impact field data in a response. +type IncidentImpactFieldDataResponse struct { + // Attributes of an impact field in a response. + Attributes IncidentImpactFieldDataAttributesResponse `json:"attributes"` + // The impact field identifier. + Id uuid.UUID `json:"id"` + // Relationships for an impact field. + Relationships *IncidentImpactFieldRelationships `json:"relationships,omitempty"` + // Impact field resource type. + Type IncidentImpactFieldType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentImpactFieldDataResponse instantiates a new IncidentImpactFieldDataResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentImpactFieldDataResponse(attributes IncidentImpactFieldDataAttributesResponse, id uuid.UUID, typeVar IncidentImpactFieldType) *IncidentImpactFieldDataResponse { + this := IncidentImpactFieldDataResponse{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentImpactFieldDataResponseWithDefaults instantiates a new IncidentImpactFieldDataResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentImpactFieldDataResponseWithDefaults() *IncidentImpactFieldDataResponse { + this := IncidentImpactFieldDataResponse{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentImpactFieldDataResponse) GetAttributes() IncidentImpactFieldDataAttributesResponse { + if o == nil { + var ret IncidentImpactFieldDataAttributesResponse + 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 *IncidentImpactFieldDataResponse) GetAttributesOk() (*IncidentImpactFieldDataAttributesResponse, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentImpactFieldDataResponse) SetAttributes(v IncidentImpactFieldDataAttributesResponse) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *IncidentImpactFieldDataResponse) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentImpactFieldDataResponse) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentImpactFieldDataResponse) SetId(v uuid.UUID) { + o.Id = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentImpactFieldDataResponse) GetRelationships() IncidentImpactFieldRelationships { + if o == nil || o.Relationships == nil { + var ret IncidentImpactFieldRelationships + 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 *IncidentImpactFieldDataResponse) GetRelationshipsOk() (*IncidentImpactFieldRelationships, 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 *IncidentImpactFieldDataResponse) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given IncidentImpactFieldRelationships and assigns it to the Relationships field. +func (o *IncidentImpactFieldDataResponse) SetRelationships(v IncidentImpactFieldRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *IncidentImpactFieldDataResponse) GetType() IncidentImpactFieldType { + if o == nil { + var ret IncidentImpactFieldType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentImpactFieldDataResponse) GetTypeOk() (*IncidentImpactFieldType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentImpactFieldDataResponse) SetType(v IncidentImpactFieldType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentImpactFieldDataResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentImpactFieldDataResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentImpactFieldDataAttributesResponse `json:"attributes"` + Id *uuid.UUID `json:"id"` + Relationships *IncidentImpactFieldRelationships `json:"relationships,omitempty"` + Type *IncidentImpactFieldType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_impact_field_relationships.go b/api/datadogV2/model_incident_impact_field_relationships.go new file mode 100644 index 00000000000..c699d4e86be --- /dev/null +++ b/api/datadogV2/model_incident_impact_field_relationships.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentImpactFieldRelationships Relationships for an impact field. +type IncidentImpactFieldRelationships struct { + // Relationship to user. + CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"` + // Relationship to an incident type. + IncidentType *RelationshipToIncidentType `json:"incident_type,omitempty"` + // Relationship to user. + LastModifiedByUser *RelationshipToUser `json:"last_modified_by_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{} `json:"-"` +} + +// NewIncidentImpactFieldRelationships instantiates a new IncidentImpactFieldRelationships object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentImpactFieldRelationships() *IncidentImpactFieldRelationships { + this := IncidentImpactFieldRelationships{} + return &this +} + +// NewIncidentImpactFieldRelationshipsWithDefaults instantiates a new IncidentImpactFieldRelationships object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentImpactFieldRelationshipsWithDefaults() *IncidentImpactFieldRelationships { + this := IncidentImpactFieldRelationships{} + return &this +} + +// GetCreatedByUser returns the CreatedByUser field value if set, zero value otherwise. +func (o *IncidentImpactFieldRelationships) 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 *IncidentImpactFieldRelationships) 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 *IncidentImpactFieldRelationships) HasCreatedByUser() bool { + return o != nil && o.CreatedByUser != nil +} + +// SetCreatedByUser gets a reference to the given RelationshipToUser and assigns it to the CreatedByUser field. +func (o *IncidentImpactFieldRelationships) SetCreatedByUser(v RelationshipToUser) { + o.CreatedByUser = &v +} + +// GetIncidentType returns the IncidentType field value if set, zero value otherwise. +func (o *IncidentImpactFieldRelationships) GetIncidentType() RelationshipToIncidentType { + if o == nil || o.IncidentType == nil { + var ret RelationshipToIncidentType + return ret + } + return *o.IncidentType +} + +// GetIncidentTypeOk returns a tuple with the IncidentType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentImpactFieldRelationships) GetIncidentTypeOk() (*RelationshipToIncidentType, bool) { + if o == nil || o.IncidentType == nil { + return nil, false + } + return o.IncidentType, true +} + +// HasIncidentType returns a boolean if a field has been set. +func (o *IncidentImpactFieldRelationships) HasIncidentType() bool { + return o != nil && o.IncidentType != nil +} + +// SetIncidentType gets a reference to the given RelationshipToIncidentType and assigns it to the IncidentType field. +func (o *IncidentImpactFieldRelationships) SetIncidentType(v RelationshipToIncidentType) { + o.IncidentType = &v +} + +// GetLastModifiedByUser returns the LastModifiedByUser field value if set, zero value otherwise. +func (o *IncidentImpactFieldRelationships) 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 *IncidentImpactFieldRelationships) 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 *IncidentImpactFieldRelationships) HasLastModifiedByUser() bool { + return o != nil && o.LastModifiedByUser != nil +} + +// SetLastModifiedByUser gets a reference to the given RelationshipToUser and assigns it to the LastModifiedByUser field. +func (o *IncidentImpactFieldRelationships) SetLastModifiedByUser(v RelationshipToUser) { + o.LastModifiedByUser = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentImpactFieldRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CreatedByUser != nil { + toSerialize["created_by_user"] = o.CreatedByUser + } + if o.IncidentType != nil { + toSerialize["incident_type"] = o.IncidentType + } + if o.LastModifiedByUser != nil { + toSerialize["last_modified_by_user"] = o.LastModifiedByUser + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentImpactFieldRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"` + IncidentType *RelationshipToIncidentType `json:"incident_type,omitempty"` + LastModifiedByUser *RelationshipToUser `json:"last_modified_by_user,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_by_user", "incident_type", "last_modified_by_user"}) + } else { + return err + } + + hasInvalidField := false + if all.CreatedByUser != nil && all.CreatedByUser.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CreatedByUser = all.CreatedByUser + if all.IncidentType != nil && all.IncidentType.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IncidentType = all.IncidentType + if all.LastModifiedByUser != nil && all.LastModifiedByUser.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LastModifiedByUser = all.LastModifiedByUser + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_impact_field_relationships_request.go b/api/datadogV2/model_incident_impact_field_relationships_request.go new file mode 100644 index 00000000000..cc94974ed35 --- /dev/null +++ b/api/datadogV2/model_incident_impact_field_relationships_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentImpactFieldRelationshipsRequest Relationships for an impact field create request. +type IncidentImpactFieldRelationshipsRequest struct { + // Relationship to an incident type. + IncidentType RelationshipToIncidentType `json:"incident_type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentImpactFieldRelationshipsRequest instantiates a new IncidentImpactFieldRelationshipsRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentImpactFieldRelationshipsRequest(incidentType RelationshipToIncidentType) *IncidentImpactFieldRelationshipsRequest { + this := IncidentImpactFieldRelationshipsRequest{} + this.IncidentType = incidentType + return &this +} + +// NewIncidentImpactFieldRelationshipsRequestWithDefaults instantiates a new IncidentImpactFieldRelationshipsRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentImpactFieldRelationshipsRequestWithDefaults() *IncidentImpactFieldRelationshipsRequest { + this := IncidentImpactFieldRelationshipsRequest{} + return &this +} + +// GetIncidentType returns the IncidentType field value. +func (o *IncidentImpactFieldRelationshipsRequest) GetIncidentType() RelationshipToIncidentType { + if o == nil { + var ret RelationshipToIncidentType + return ret + } + return o.IncidentType +} + +// GetIncidentTypeOk returns a tuple with the IncidentType field value +// and a boolean to check if the value has been set. +func (o *IncidentImpactFieldRelationshipsRequest) GetIncidentTypeOk() (*RelationshipToIncidentType, bool) { + if o == nil { + return nil, false + } + return &o.IncidentType, true +} + +// SetIncidentType sets field value. +func (o *IncidentImpactFieldRelationshipsRequest) SetIncidentType(v RelationshipToIncidentType) { + o.IncidentType = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentImpactFieldRelationshipsRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["incident_type"] = o.IncidentType + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentImpactFieldRelationshipsRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncidentType *RelationshipToIncidentType `json:"incident_type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncidentType == nil { + return fmt.Errorf("required field incident_type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"incident_type"}) + } else { + return err + } + + hasInvalidField := false + if all.IncidentType.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IncidentType = *all.IncidentType + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_impact_field_request.go b/api/datadogV2/model_incident_impact_field_request.go new file mode 100644 index 00000000000..85002e58513 --- /dev/null +++ b/api/datadogV2/model_incident_impact_field_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentImpactFieldRequest Request payload for creating an impact field. +type IncidentImpactFieldRequest struct { + // Impact field data in a create request. + Data IncidentImpactFieldDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentImpactFieldRequest instantiates a new IncidentImpactFieldRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentImpactFieldRequest(data IncidentImpactFieldDataRequest) *IncidentImpactFieldRequest { + this := IncidentImpactFieldRequest{} + this.Data = data + return &this +} + +// NewIncidentImpactFieldRequestWithDefaults instantiates a new IncidentImpactFieldRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentImpactFieldRequestWithDefaults() *IncidentImpactFieldRequest { + this := IncidentImpactFieldRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentImpactFieldRequest) GetData() IncidentImpactFieldDataRequest { + if o == nil { + var ret IncidentImpactFieldDataRequest + 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 *IncidentImpactFieldRequest) GetDataOk() (*IncidentImpactFieldDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentImpactFieldRequest) SetData(v IncidentImpactFieldDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentImpactFieldRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentImpactFieldRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentImpactFieldDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_impact_field_response.go b/api/datadogV2/model_incident_impact_field_response.go new file mode 100644 index 00000000000..acf7764475f --- /dev/null +++ b/api/datadogV2/model_incident_impact_field_response.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentImpactFieldResponse Response with a single impact field. +type IncidentImpactFieldResponse struct { + // Impact field data in a response. + Data IncidentImpactFieldDataResponse `json:"data"` + // Included related resources. + Included []IncidentUserData `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{} `json:"-"` +} + +// NewIncidentImpactFieldResponse instantiates a new IncidentImpactFieldResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentImpactFieldResponse(data IncidentImpactFieldDataResponse) *IncidentImpactFieldResponse { + this := IncidentImpactFieldResponse{} + this.Data = data + return &this +} + +// NewIncidentImpactFieldResponseWithDefaults instantiates a new IncidentImpactFieldResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentImpactFieldResponseWithDefaults() *IncidentImpactFieldResponse { + this := IncidentImpactFieldResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentImpactFieldResponse) GetData() IncidentImpactFieldDataResponse { + if o == nil { + var ret IncidentImpactFieldDataResponse + 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 *IncidentImpactFieldResponse) GetDataOk() (*IncidentImpactFieldDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentImpactFieldResponse) SetData(v IncidentImpactFieldDataResponse) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentImpactFieldResponse) GetIncluded() []IncidentUserData { + if o == nil || o.Included == nil { + var ret []IncidentUserData + 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 *IncidentImpactFieldResponse) GetIncludedOk() (*[]IncidentUserData, 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 *IncidentImpactFieldResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []IncidentUserData and assigns it to the Included field. +func (o *IncidentImpactFieldResponse) SetIncluded(v []IncidentUserData) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentImpactFieldResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentImpactFieldResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentImpactFieldDataResponse `json:"data"` + Included []IncidentUserData `json:"included,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + o.Included = all.Included + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_impact_field_type.go b/api/datadogV2/model_incident_impact_field_type.go new file mode 100644 index 00000000000..0c9e8f24b13 --- /dev/null +++ b/api/datadogV2/model_incident_impact_field_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentImpactFieldType Impact field resource type. +type IncidentImpactFieldType string + +// List of IncidentImpactFieldType. +const ( + INCIDENTIMPACTFIELDTYPE_IMPACT_FIELDS IncidentImpactFieldType = "impact_fields" +) + +var allowedIncidentImpactFieldTypeEnumValues = []IncidentImpactFieldType{ + INCIDENTIMPACTFIELDTYPE_IMPACT_FIELDS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentImpactFieldType) GetAllowedValues() []IncidentImpactFieldType { + return allowedIncidentImpactFieldTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentImpactFieldType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentImpactFieldType(value) + return nil +} + +// NewIncidentImpactFieldTypeFromValue returns a pointer to a valid IncidentImpactFieldType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentImpactFieldTypeFromValue(v string) (*IncidentImpactFieldType, error) { + ev := IncidentImpactFieldType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentImpactFieldType: valid values are %v", v, allowedIncidentImpactFieldTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentImpactFieldType) IsValid() bool { + for _, existing := range allowedIncidentImpactFieldTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentImpactFieldType value. +func (v IncidentImpactFieldType) Ptr() *IncidentImpactFieldType { + return &v +} diff --git a/api/datadogV2/model_incident_impact_field_value_type.go b/api/datadogV2/model_incident_impact_field_value_type.go new file mode 100644 index 00000000000..492c1991d0d --- /dev/null +++ b/api/datadogV2/model_incident_impact_field_value_type.go @@ -0,0 +1,76 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentImpactFieldValueType The type of an impact field. +type IncidentImpactFieldValueType string + +// List of IncidentImpactFieldValueType. +const ( + INCIDENTIMPACTFIELDVALUETYPE_DROPDOWN IncidentImpactFieldValueType = "dropdown" + INCIDENTIMPACTFIELDVALUETYPE_TEXT IncidentImpactFieldValueType = "text" + INCIDENTIMPACTFIELDVALUETYPE_TEXTARRAY IncidentImpactFieldValueType = "textarray" + INCIDENTIMPACTFIELDVALUETYPE_METRICTAG IncidentImpactFieldValueType = "metrictag" + INCIDENTIMPACTFIELDVALUETYPE_NUMBER IncidentImpactFieldValueType = "number" + INCIDENTIMPACTFIELDVALUETYPE_DATETIME IncidentImpactFieldValueType = "datetime" + INCIDENTIMPACTFIELDVALUETYPE_MULTISELECT IncidentImpactFieldValueType = "multiselect" +) + +var allowedIncidentImpactFieldValueTypeEnumValues = []IncidentImpactFieldValueType{ + INCIDENTIMPACTFIELDVALUETYPE_DROPDOWN, + INCIDENTIMPACTFIELDVALUETYPE_TEXT, + INCIDENTIMPACTFIELDVALUETYPE_TEXTARRAY, + INCIDENTIMPACTFIELDVALUETYPE_METRICTAG, + INCIDENTIMPACTFIELDVALUETYPE_NUMBER, + INCIDENTIMPACTFIELDVALUETYPE_DATETIME, + INCIDENTIMPACTFIELDVALUETYPE_MULTISELECT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentImpactFieldValueType) GetAllowedValues() []IncidentImpactFieldValueType { + return allowedIncidentImpactFieldValueTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentImpactFieldValueType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentImpactFieldValueType(value) + return nil +} + +// NewIncidentImpactFieldValueTypeFromValue returns a pointer to a valid IncidentImpactFieldValueType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentImpactFieldValueTypeFromValue(v string) (*IncidentImpactFieldValueType, error) { + ev := IncidentImpactFieldValueType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentImpactFieldValueType: valid values are %v", v, allowedIncidentImpactFieldValueTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentImpactFieldValueType) IsValid() bool { + for _, existing := range allowedIncidentImpactFieldValueTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentImpactFieldValueType value. +func (v IncidentImpactFieldValueType) Ptr() *IncidentImpactFieldValueType { + return &v +} diff --git a/api/datadogV2/model_incident_impact_fields_response.go b/api/datadogV2/model_incident_impact_fields_response.go new file mode 100644 index 00000000000..a60cc34c50a --- /dev/null +++ b/api/datadogV2/model_incident_impact_fields_response.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentImpactFieldsResponse Response with a list of impact fields. +type IncidentImpactFieldsResponse struct { + // List of impact fields. + Data []IncidentImpactFieldDataResponse `json:"data"` + // Included related resources. + Included []IncidentUserData `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{} `json:"-"` +} + +// NewIncidentImpactFieldsResponse instantiates a new IncidentImpactFieldsResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentImpactFieldsResponse(data []IncidentImpactFieldDataResponse) *IncidentImpactFieldsResponse { + this := IncidentImpactFieldsResponse{} + this.Data = data + return &this +} + +// NewIncidentImpactFieldsResponseWithDefaults instantiates a new IncidentImpactFieldsResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentImpactFieldsResponseWithDefaults() *IncidentImpactFieldsResponse { + this := IncidentImpactFieldsResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentImpactFieldsResponse) GetData() []IncidentImpactFieldDataResponse { + if o == nil { + var ret []IncidentImpactFieldDataResponse + 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 *IncidentImpactFieldsResponse) GetDataOk() (*[]IncidentImpactFieldDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentImpactFieldsResponse) SetData(v []IncidentImpactFieldDataResponse) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentImpactFieldsResponse) GetIncluded() []IncidentUserData { + if o == nil || o.Included == nil { + var ret []IncidentUserData + 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 *IncidentImpactFieldsResponse) GetIncludedOk() (*[]IncidentUserData, 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 *IncidentImpactFieldsResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []IncidentUserData and assigns it to the Included field. +func (o *IncidentImpactFieldsResponse) SetIncluded(v []IncidentUserData) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentImpactFieldsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentImpactFieldsResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]IncidentImpactFieldDataResponse `json:"data"` + Included []IncidentUserData `json:"included,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) + } else { + return err + } + o.Data = *all.Data + o.Included = all.Included + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_on_call_page_data_attributes_request.go b/api/datadogV2/model_incident_on_call_page_data_attributes_request.go new file mode 100644 index 00000000000..5b2d903c81a --- /dev/null +++ b/api/datadogV2/model_incident_on_call_page_data_attributes_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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentOnCallPageDataAttributesRequest Attributes for linking a page to an incident. +type IncidentOnCallPageDataAttributesRequest struct { + // The key of the on-call page. + Key *string `json:"key,omitempty"` + // The target of an on-call page. + PageTarget *IncidentOnCallPageTarget `json:"page_target,omitempty"` + // The team ID associated with the page (deprecated, use page_target instead). + TeamId *string `json:"team_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{} `json:"-"` +} + +// NewIncidentOnCallPageDataAttributesRequest instantiates a new IncidentOnCallPageDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentOnCallPageDataAttributesRequest() *IncidentOnCallPageDataAttributesRequest { + this := IncidentOnCallPageDataAttributesRequest{} + return &this +} + +// NewIncidentOnCallPageDataAttributesRequestWithDefaults instantiates a new IncidentOnCallPageDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentOnCallPageDataAttributesRequestWithDefaults() *IncidentOnCallPageDataAttributesRequest { + this := IncidentOnCallPageDataAttributesRequest{} + return &this +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *IncidentOnCallPageDataAttributesRequest) 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 *IncidentOnCallPageDataAttributesRequest) 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 *IncidentOnCallPageDataAttributesRequest) HasKey() bool { + return o != nil && o.Key != nil +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *IncidentOnCallPageDataAttributesRequest) SetKey(v string) { + o.Key = &v +} + +// GetPageTarget returns the PageTarget field value if set, zero value otherwise. +func (o *IncidentOnCallPageDataAttributesRequest) GetPageTarget() IncidentOnCallPageTarget { + if o == nil || o.PageTarget == nil { + var ret IncidentOnCallPageTarget + return ret + } + return *o.PageTarget +} + +// GetPageTargetOk returns a tuple with the PageTarget field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentOnCallPageDataAttributesRequest) GetPageTargetOk() (*IncidentOnCallPageTarget, bool) { + if o == nil || o.PageTarget == nil { + return nil, false + } + return o.PageTarget, true +} + +// HasPageTarget returns a boolean if a field has been set. +func (o *IncidentOnCallPageDataAttributesRequest) HasPageTarget() bool { + return o != nil && o.PageTarget != nil +} + +// SetPageTarget gets a reference to the given IncidentOnCallPageTarget and assigns it to the PageTarget field. +func (o *IncidentOnCallPageDataAttributesRequest) SetPageTarget(v IncidentOnCallPageTarget) { + o.PageTarget = &v +} + +// GetTeamId returns the TeamId field value if set, zero value otherwise. +func (o *IncidentOnCallPageDataAttributesRequest) GetTeamId() string { + if o == nil || o.TeamId == nil { + var ret string + return ret + } + return *o.TeamId +} + +// GetTeamIdOk returns a tuple with the TeamId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentOnCallPageDataAttributesRequest) GetTeamIdOk() (*string, bool) { + if o == nil || o.TeamId == nil { + return nil, false + } + return o.TeamId, true +} + +// HasTeamId returns a boolean if a field has been set. +func (o *IncidentOnCallPageDataAttributesRequest) HasTeamId() bool { + return o != nil && o.TeamId != nil +} + +// SetTeamId gets a reference to the given string and assigns it to the TeamId field. +func (o *IncidentOnCallPageDataAttributesRequest) SetTeamId(v string) { + o.TeamId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentOnCallPageDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Key != nil { + toSerialize["key"] = o.Key + } + if o.PageTarget != nil { + toSerialize["page_target"] = o.PageTarget + } + if o.TeamId != nil { + toSerialize["team_id"] = o.TeamId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentOnCallPageDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Key *string `json:"key,omitempty"` + PageTarget *IncidentOnCallPageTarget `json:"page_target,omitempty"` + TeamId *string `json:"team_id,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"key", "page_target", "team_id"}) + } else { + return err + } + + hasInvalidField := false + o.Key = all.Key + if all.PageTarget != nil && all.PageTarget.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.PageTarget = all.PageTarget + o.TeamId = all.TeamId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_on_call_page_data_request.go b/api/datadogV2/model_incident_on_call_page_data_request.go new file mode 100644 index 00000000000..c7ed229ee27 --- /dev/null +++ b/api/datadogV2/model_incident_on_call_page_data_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentOnCallPageDataRequest On-call page data in a link request. +type IncidentOnCallPageDataRequest struct { + // Attributes for linking a page to an incident. + Attributes *IncidentOnCallPageDataAttributesRequest `json:"attributes,omitempty"` + // The ID of the on-call page to link. + Id string `json:"id"` + // On-call page resource type. + Type IncidentOnCallPageType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentOnCallPageDataRequest instantiates a new IncidentOnCallPageDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentOnCallPageDataRequest(id string, typeVar IncidentOnCallPageType) *IncidentOnCallPageDataRequest { + this := IncidentOnCallPageDataRequest{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentOnCallPageDataRequestWithDefaults instantiates a new IncidentOnCallPageDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentOnCallPageDataRequestWithDefaults() *IncidentOnCallPageDataRequest { + this := IncidentOnCallPageDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *IncidentOnCallPageDataRequest) GetAttributes() IncidentOnCallPageDataAttributesRequest { + if o == nil || o.Attributes == nil { + var ret IncidentOnCallPageDataAttributesRequest + 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 *IncidentOnCallPageDataRequest) GetAttributesOk() (*IncidentOnCallPageDataAttributesRequest, 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 *IncidentOnCallPageDataRequest) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given IncidentOnCallPageDataAttributesRequest and assigns it to the Attributes field. +func (o *IncidentOnCallPageDataRequest) SetAttributes(v IncidentOnCallPageDataAttributesRequest) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *IncidentOnCallPageDataRequest) 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 *IncidentOnCallPageDataRequest) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentOnCallPageDataRequest) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *IncidentOnCallPageDataRequest) GetType() IncidentOnCallPageType { + if o == nil { + var ret IncidentOnCallPageType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentOnCallPageDataRequest) GetTypeOk() (*IncidentOnCallPageType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentOnCallPageDataRequest) SetType(v IncidentOnCallPageType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentOnCallPageDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentOnCallPageDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentOnCallPageDataAttributesRequest `json:"attributes,omitempty"` + Id *string `json:"id"` + Type *IncidentOnCallPageType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_on_call_page_link_request.go b/api/datadogV2/model_incident_on_call_page_link_request.go new file mode 100644 index 00000000000..613a84154ec --- /dev/null +++ b/api/datadogV2/model_incident_on_call_page_link_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentOnCallPageLinkRequest Request payload for linking an on-call page to an incident. +type IncidentOnCallPageLinkRequest struct { + // On-call page data in a link request. + Data IncidentOnCallPageDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentOnCallPageLinkRequest instantiates a new IncidentOnCallPageLinkRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentOnCallPageLinkRequest(data IncidentOnCallPageDataRequest) *IncidentOnCallPageLinkRequest { + this := IncidentOnCallPageLinkRequest{} + this.Data = data + return &this +} + +// NewIncidentOnCallPageLinkRequestWithDefaults instantiates a new IncidentOnCallPageLinkRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentOnCallPageLinkRequestWithDefaults() *IncidentOnCallPageLinkRequest { + this := IncidentOnCallPageLinkRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentOnCallPageLinkRequest) GetData() IncidentOnCallPageDataRequest { + if o == nil { + var ret IncidentOnCallPageDataRequest + 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 *IncidentOnCallPageLinkRequest) GetDataOk() (*IncidentOnCallPageDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentOnCallPageLinkRequest) SetData(v IncidentOnCallPageDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentOnCallPageLinkRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentOnCallPageLinkRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentOnCallPageDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_on_call_page_target.go b/api/datadogV2/model_incident_on_call_page_target.go new file mode 100644 index 00000000000..a481ca5ab63 --- /dev/null +++ b/api/datadogV2/model_incident_on_call_page_target.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentOnCallPageTarget The target of an on-call page. +type IncidentOnCallPageTarget struct { + // The identifier of the page target. + Identifier string `json:"identifier"` + // The type of the page target. + Type string `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentOnCallPageTarget instantiates a new IncidentOnCallPageTarget object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentOnCallPageTarget(identifier string, typeVar string) *IncidentOnCallPageTarget { + this := IncidentOnCallPageTarget{} + this.Identifier = identifier + this.Type = typeVar + return &this +} + +// NewIncidentOnCallPageTargetWithDefaults instantiates a new IncidentOnCallPageTarget object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentOnCallPageTargetWithDefaults() *IncidentOnCallPageTarget { + this := IncidentOnCallPageTarget{} + return &this +} + +// GetIdentifier returns the Identifier field value. +func (o *IncidentOnCallPageTarget) GetIdentifier() string { + if o == nil { + var ret string + return ret + } + return o.Identifier +} + +// GetIdentifierOk returns a tuple with the Identifier field value +// and a boolean to check if the value has been set. +func (o *IncidentOnCallPageTarget) GetIdentifierOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Identifier, true +} + +// SetIdentifier sets field value. +func (o *IncidentOnCallPageTarget) SetIdentifier(v string) { + o.Identifier = v +} + +// GetType returns the Type field value. +func (o *IncidentOnCallPageTarget) 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 *IncidentOnCallPageTarget) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentOnCallPageTarget) SetType(v string) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentOnCallPageTarget) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["identifier"] = o.Identifier + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentOnCallPageTarget) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Identifier *string `json:"identifier"` + Type *string `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Identifier == nil { + return fmt.Errorf("required field identifier missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"identifier", "type"}) + } else { + return err + } + o.Identifier = *all.Identifier + o.Type = *all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_on_call_page_type.go b/api/datadogV2/model_incident_on_call_page_type.go new file mode 100644 index 00000000000..4bed36dc6f9 --- /dev/null +++ b/api/datadogV2/model_incident_on_call_page_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentOnCallPageType On-call page resource type. +type IncidentOnCallPageType string + +// List of IncidentOnCallPageType. +const ( + INCIDENTONCALLPAGETYPE_PAGE IncidentOnCallPageType = "page" +) + +var allowedIncidentOnCallPageTypeEnumValues = []IncidentOnCallPageType{ + INCIDENTONCALLPAGETYPE_PAGE, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentOnCallPageType) GetAllowedValues() []IncidentOnCallPageType { + return allowedIncidentOnCallPageTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentOnCallPageType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentOnCallPageType(value) + return nil +} + +// NewIncidentOnCallPageTypeFromValue returns a pointer to a valid IncidentOnCallPageType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentOnCallPageTypeFromValue(v string) (*IncidentOnCallPageType, error) { + ev := IncidentOnCallPageType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentOnCallPageType: valid values are %v", v, allowedIncidentOnCallPageTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentOnCallPageType) IsValid() bool { + for _, existing := range allowedIncidentOnCallPageTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentOnCallPageType value. +func (v IncidentOnCallPageType) Ptr() *IncidentOnCallPageType { + return &v +} diff --git a/api/datadogV2/model_incident_org_settings_data_attributes_response.go b/api/datadogV2/model_incident_org_settings_data_attributes_response.go new file mode 100644 index 00000000000..b8bb67a86c4 --- /dev/null +++ b/api/datadogV2/model_incident_org_settings_data_attributes_response.go @@ -0,0 +1,174 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentOrgSettingsDataAttributesResponse Attributes of an incident org settings resource in a response. +type IncidentOrgSettingsDataAttributesResponse struct { + // Timestamp when the settings were created. + Created time.Time `json:"created"` + // Timestamp when the settings were last modified. + Modified time.Time `json:"modified"` + // The settings configuration for an incident org settings resource. + Settings map[string]interface{} `json:"settings"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentOrgSettingsDataAttributesResponse instantiates a new IncidentOrgSettingsDataAttributesResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentOrgSettingsDataAttributesResponse(created time.Time, modified time.Time, settings map[string]interface{}) *IncidentOrgSettingsDataAttributesResponse { + this := IncidentOrgSettingsDataAttributesResponse{} + this.Created = created + this.Modified = modified + this.Settings = settings + return &this +} + +// NewIncidentOrgSettingsDataAttributesResponseWithDefaults instantiates a new IncidentOrgSettingsDataAttributesResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentOrgSettingsDataAttributesResponseWithDefaults() *IncidentOrgSettingsDataAttributesResponse { + this := IncidentOrgSettingsDataAttributesResponse{} + return &this +} + +// GetCreated returns the Created field value. +func (o *IncidentOrgSettingsDataAttributesResponse) GetCreated() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.Created +} + +// GetCreatedOk returns a tuple with the Created field value +// and a boolean to check if the value has been set. +func (o *IncidentOrgSettingsDataAttributesResponse) GetCreatedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Created, true +} + +// SetCreated sets field value. +func (o *IncidentOrgSettingsDataAttributesResponse) SetCreated(v time.Time) { + o.Created = v +} + +// GetModified returns the Modified field value. +func (o *IncidentOrgSettingsDataAttributesResponse) GetModified() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.Modified +} + +// GetModifiedOk returns a tuple with the Modified field value +// and a boolean to check if the value has been set. +func (o *IncidentOrgSettingsDataAttributesResponse) GetModifiedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Modified, true +} + +// SetModified sets field value. +func (o *IncidentOrgSettingsDataAttributesResponse) SetModified(v time.Time) { + o.Modified = v +} + +// GetSettings returns the Settings field value. +func (o *IncidentOrgSettingsDataAttributesResponse) GetSettings() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + return o.Settings +} + +// GetSettingsOk returns a tuple with the Settings field value +// and a boolean to check if the value has been set. +func (o *IncidentOrgSettingsDataAttributesResponse) GetSettingsOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + return &o.Settings, true +} + +// SetSettings sets field value. +func (o *IncidentOrgSettingsDataAttributesResponse) SetSettings(v map[string]interface{}) { + o.Settings = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentOrgSettingsDataAttributesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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.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["settings"] = o.Settings + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentOrgSettingsDataAttributesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Created *time.Time `json:"created"` + Modified *time.Time `json:"modified"` + Settings *map[string]interface{} `json:"settings"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Created == nil { + return fmt.Errorf("required field created missing") + } + if all.Modified == nil { + return fmt.Errorf("required field modified missing") + } + if all.Settings == nil { + return fmt.Errorf("required field settings missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created", "modified", "settings"}) + } else { + return err + } + o.Created = *all.Created + o.Modified = *all.Modified + o.Settings = *all.Settings + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_org_settings_data_response.go b/api/datadogV2/model_incident_org_settings_data_response.go new file mode 100644 index 00000000000..45660a3d176 --- /dev/null +++ b/api/datadogV2/model_incident_org_settings_data_response.go @@ -0,0 +1,218 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentOrgSettingsDataResponse Incident org settings data in a response. +type IncidentOrgSettingsDataResponse struct { + // Attributes of an incident org settings resource in a response. + Attributes IncidentOrgSettingsDataAttributesResponse `json:"attributes"` + // The org settings identifier. + Id uuid.UUID `json:"id"` + // Relationships for an incident org settings resource. + Relationships *IncidentOrgSettingsRelationships `json:"relationships,omitempty"` + // Incident org settings resource type. + Type IncidentOrgSettingsType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentOrgSettingsDataResponse instantiates a new IncidentOrgSettingsDataResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentOrgSettingsDataResponse(attributes IncidentOrgSettingsDataAttributesResponse, id uuid.UUID, typeVar IncidentOrgSettingsType) *IncidentOrgSettingsDataResponse { + this := IncidentOrgSettingsDataResponse{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentOrgSettingsDataResponseWithDefaults instantiates a new IncidentOrgSettingsDataResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentOrgSettingsDataResponseWithDefaults() *IncidentOrgSettingsDataResponse { + this := IncidentOrgSettingsDataResponse{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentOrgSettingsDataResponse) GetAttributes() IncidentOrgSettingsDataAttributesResponse { + if o == nil { + var ret IncidentOrgSettingsDataAttributesResponse + 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 *IncidentOrgSettingsDataResponse) GetAttributesOk() (*IncidentOrgSettingsDataAttributesResponse, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentOrgSettingsDataResponse) SetAttributes(v IncidentOrgSettingsDataAttributesResponse) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *IncidentOrgSettingsDataResponse) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentOrgSettingsDataResponse) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentOrgSettingsDataResponse) SetId(v uuid.UUID) { + o.Id = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentOrgSettingsDataResponse) GetRelationships() IncidentOrgSettingsRelationships { + if o == nil || o.Relationships == nil { + var ret IncidentOrgSettingsRelationships + 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 *IncidentOrgSettingsDataResponse) GetRelationshipsOk() (*IncidentOrgSettingsRelationships, 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 *IncidentOrgSettingsDataResponse) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given IncidentOrgSettingsRelationships and assigns it to the Relationships field. +func (o *IncidentOrgSettingsDataResponse) SetRelationships(v IncidentOrgSettingsRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *IncidentOrgSettingsDataResponse) GetType() IncidentOrgSettingsType { + if o == nil { + var ret IncidentOrgSettingsType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentOrgSettingsDataResponse) GetTypeOk() (*IncidentOrgSettingsType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentOrgSettingsDataResponse) SetType(v IncidentOrgSettingsType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentOrgSettingsDataResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentOrgSettingsDataResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentOrgSettingsDataAttributesResponse `json:"attributes"` + Id *uuid.UUID `json:"id"` + Relationships *IncidentOrgSettingsRelationships `json:"relationships,omitempty"` + Type *IncidentOrgSettingsType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_org_settings_list_response.go b/api/datadogV2/model_incident_org_settings_list_response.go new file mode 100644 index 00000000000..cc13bbb83a6 --- /dev/null +++ b/api/datadogV2/model_incident_org_settings_list_response.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentOrgSettingsListResponse Response with a list of incident org settings resources. +type IncidentOrgSettingsListResponse struct { + // List of incident org settings resources. + Data []IncidentOrgSettingsDataResponse `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentOrgSettingsListResponse instantiates a new IncidentOrgSettingsListResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentOrgSettingsListResponse(data []IncidentOrgSettingsDataResponse) *IncidentOrgSettingsListResponse { + this := IncidentOrgSettingsListResponse{} + this.Data = data + return &this +} + +// NewIncidentOrgSettingsListResponseWithDefaults instantiates a new IncidentOrgSettingsListResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentOrgSettingsListResponseWithDefaults() *IncidentOrgSettingsListResponse { + this := IncidentOrgSettingsListResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentOrgSettingsListResponse) GetData() []IncidentOrgSettingsDataResponse { + if o == nil { + var ret []IncidentOrgSettingsDataResponse + 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 *IncidentOrgSettingsListResponse) GetDataOk() (*[]IncidentOrgSettingsDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentOrgSettingsListResponse) SetData(v []IncidentOrgSettingsDataResponse) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentOrgSettingsListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentOrgSettingsListResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]IncidentOrgSettingsDataResponse `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_org_settings_relationships.go b/api/datadogV2/model_incident_org_settings_relationships.go new file mode 100644 index 00000000000..4cb4037252d --- /dev/null +++ b/api/datadogV2/model_incident_org_settings_relationships.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentOrgSettingsRelationships Relationships for an incident org settings resource. +type IncidentOrgSettingsRelationships struct { + // Relationship to an incident type. + IncidentType *RelationshipToIncidentType `json:"incident_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{} `json:"-"` +} + +// NewIncidentOrgSettingsRelationships instantiates a new IncidentOrgSettingsRelationships object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentOrgSettingsRelationships() *IncidentOrgSettingsRelationships { + this := IncidentOrgSettingsRelationships{} + return &this +} + +// NewIncidentOrgSettingsRelationshipsWithDefaults instantiates a new IncidentOrgSettingsRelationships object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentOrgSettingsRelationshipsWithDefaults() *IncidentOrgSettingsRelationships { + this := IncidentOrgSettingsRelationships{} + return &this +} + +// GetIncidentType returns the IncidentType field value if set, zero value otherwise. +func (o *IncidentOrgSettingsRelationships) GetIncidentType() RelationshipToIncidentType { + if o == nil || o.IncidentType == nil { + var ret RelationshipToIncidentType + return ret + } + return *o.IncidentType +} + +// GetIncidentTypeOk returns a tuple with the IncidentType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentOrgSettingsRelationships) GetIncidentTypeOk() (*RelationshipToIncidentType, bool) { + if o == nil || o.IncidentType == nil { + return nil, false + } + return o.IncidentType, true +} + +// HasIncidentType returns a boolean if a field has been set. +func (o *IncidentOrgSettingsRelationships) HasIncidentType() bool { + return o != nil && o.IncidentType != nil +} + +// SetIncidentType gets a reference to the given RelationshipToIncidentType and assigns it to the IncidentType field. +func (o *IncidentOrgSettingsRelationships) SetIncidentType(v RelationshipToIncidentType) { + o.IncidentType = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentOrgSettingsRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.IncidentType != nil { + toSerialize["incident_type"] = o.IncidentType + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentOrgSettingsRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncidentType *RelationshipToIncidentType `json:"incident_type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"incident_type"}) + } else { + return err + } + + hasInvalidField := false + if all.IncidentType != nil && all.IncidentType.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IncidentType = all.IncidentType + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_org_settings_response.go b/api/datadogV2/model_incident_org_settings_response.go new file mode 100644 index 00000000000..6c3d2f27554 --- /dev/null +++ b/api/datadogV2/model_incident_org_settings_response.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentOrgSettingsResponse Response with a single incident org settings resource. +type IncidentOrgSettingsResponse struct { + // Incident org settings data in a response. + Data IncidentOrgSettingsDataResponse `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentOrgSettingsResponse instantiates a new IncidentOrgSettingsResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentOrgSettingsResponse(data IncidentOrgSettingsDataResponse) *IncidentOrgSettingsResponse { + this := IncidentOrgSettingsResponse{} + this.Data = data + return &this +} + +// NewIncidentOrgSettingsResponseWithDefaults instantiates a new IncidentOrgSettingsResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentOrgSettingsResponseWithDefaults() *IncidentOrgSettingsResponse { + this := IncidentOrgSettingsResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentOrgSettingsResponse) GetData() IncidentOrgSettingsDataResponse { + if o == nil { + var ret IncidentOrgSettingsDataResponse + 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 *IncidentOrgSettingsResponse) GetDataOk() (*IncidentOrgSettingsDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentOrgSettingsResponse) SetData(v IncidentOrgSettingsDataResponse) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentOrgSettingsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentOrgSettingsResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentOrgSettingsDataResponse `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_org_settings_type.go b/api/datadogV2/model_incident_org_settings_type.go new file mode 100644 index 00000000000..05c8181d1eb --- /dev/null +++ b/api/datadogV2/model_incident_org_settings_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentOrgSettingsType Incident org settings resource type. +type IncidentOrgSettingsType string + +// List of IncidentOrgSettingsType. +const ( + INCIDENTORGSETTINGSTYPE_INCIDENT_ORG_SETTINGS IncidentOrgSettingsType = "incident_org_settings" +) + +var allowedIncidentOrgSettingsTypeEnumValues = []IncidentOrgSettingsType{ + INCIDENTORGSETTINGSTYPE_INCIDENT_ORG_SETTINGS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentOrgSettingsType) GetAllowedValues() []IncidentOrgSettingsType { + return allowedIncidentOrgSettingsTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentOrgSettingsType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentOrgSettingsType(value) + return nil +} + +// NewIncidentOrgSettingsTypeFromValue returns a pointer to a valid IncidentOrgSettingsType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentOrgSettingsTypeFromValue(v string) (*IncidentOrgSettingsType, error) { + ev := IncidentOrgSettingsType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentOrgSettingsType: valid values are %v", v, allowedIncidentOrgSettingsTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentOrgSettingsType) IsValid() bool { + for _, existing := range allowedIncidentOrgSettingsTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentOrgSettingsType value. +func (v IncidentOrgSettingsType) Ptr() *IncidentOrgSettingsType { + return &v +} diff --git a/api/datadogV2/model_incident_page_role_reference.go b/api/datadogV2/model_incident_page_role_reference.go new file mode 100644 index 00000000000..4d0170778f5 --- /dev/null +++ b/api/datadogV2/model_incident_page_role_reference.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 datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentPageRoleReference A reference to an incident role for a page. +type IncidentPageRoleReference struct { + // The role identifier. + Id uuid.UUID `json:"id"` + // The type of incident role for a page. + Type IncidentPageRoleType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentPageRoleReference instantiates a new IncidentPageRoleReference object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentPageRoleReference(id uuid.UUID, typeVar IncidentPageRoleType) *IncidentPageRoleReference { + this := IncidentPageRoleReference{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentPageRoleReferenceWithDefaults instantiates a new IncidentPageRoleReference object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentPageRoleReferenceWithDefaults() *IncidentPageRoleReference { + this := IncidentPageRoleReference{} + return &this +} + +// GetId returns the Id field value. +func (o *IncidentPageRoleReference) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentPageRoleReference) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentPageRoleReference) SetId(v uuid.UUID) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *IncidentPageRoleReference) GetType() IncidentPageRoleType { + if o == nil { + var ret IncidentPageRoleType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentPageRoleReference) GetTypeOk() (*IncidentPageRoleType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentPageRoleReference) SetType(v IncidentPageRoleType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentPageRoleReference) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentPageRoleReference) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *uuid.UUID `json:"id"` + Type *IncidentPageRoleType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) + } else { + return err + } + + hasInvalidField := false + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_page_role_type.go b/api/datadogV2/model_incident_page_role_type.go new file mode 100644 index 00000000000..24ed860d93b --- /dev/null +++ b/api/datadogV2/model_incident_page_role_type.go @@ -0,0 +1,66 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentPageRoleType The type of incident role for a page. +type IncidentPageRoleType string + +// List of IncidentPageRoleType. +const ( + INCIDENTPAGEROLETYPE_INCIDENT_USER_DEFINED_ROLES IncidentPageRoleType = "incident_user_defined_roles" + INCIDENTPAGEROLETYPE_INCIDENT_RESERVED_ROLES IncidentPageRoleType = "incident_reserved_roles" +) + +var allowedIncidentPageRoleTypeEnumValues = []IncidentPageRoleType{ + INCIDENTPAGEROLETYPE_INCIDENT_USER_DEFINED_ROLES, + INCIDENTPAGEROLETYPE_INCIDENT_RESERVED_ROLES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentPageRoleType) GetAllowedValues() []IncidentPageRoleType { + return allowedIncidentPageRoleTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentPageRoleType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentPageRoleType(value) + return nil +} + +// NewIncidentPageRoleTypeFromValue returns a pointer to a valid IncidentPageRoleType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentPageRoleTypeFromValue(v string) (*IncidentPageRoleType, error) { + ev := IncidentPageRoleType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentPageRoleType: valid values are %v", v, allowedIncidentPageRoleTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentPageRoleType) IsValid() bool { + for _, existing := range allowedIncidentPageRoleTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentPageRoleType value. +func (v IncidentPageRoleType) Ptr() *IncidentPageRoleType { + return &v +} diff --git a/api/datadogV2/model_incident_page_target.go b/api/datadogV2/model_incident_page_target.go new file mode 100644 index 00000000000..95b7002a868 --- /dev/null +++ b/api/datadogV2/model_incident_page_target.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentPageTarget The target recipient for a page. +type IncidentPageTarget struct { + // The identifier of the target (handle, UUID, or user UUID). + Identifier string `json:"identifier"` + // The type of target for a page request. + Type IncidentPageTargetType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentPageTarget instantiates a new IncidentPageTarget object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentPageTarget(identifier string, typeVar IncidentPageTargetType) *IncidentPageTarget { + this := IncidentPageTarget{} + this.Identifier = identifier + this.Type = typeVar + return &this +} + +// NewIncidentPageTargetWithDefaults instantiates a new IncidentPageTarget object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentPageTargetWithDefaults() *IncidentPageTarget { + this := IncidentPageTarget{} + return &this +} + +// GetIdentifier returns the Identifier field value. +func (o *IncidentPageTarget) GetIdentifier() string { + if o == nil { + var ret string + return ret + } + return o.Identifier +} + +// GetIdentifierOk returns a tuple with the Identifier field value +// and a boolean to check if the value has been set. +func (o *IncidentPageTarget) GetIdentifierOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Identifier, true +} + +// SetIdentifier sets field value. +func (o *IncidentPageTarget) SetIdentifier(v string) { + o.Identifier = v +} + +// GetType returns the Type field value. +func (o *IncidentPageTarget) GetType() IncidentPageTargetType { + if o == nil { + var ret IncidentPageTargetType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentPageTarget) GetTypeOk() (*IncidentPageTargetType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentPageTarget) SetType(v IncidentPageTargetType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentPageTarget) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["identifier"] = o.Identifier + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentPageTarget) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Identifier *string `json:"identifier"` + Type *IncidentPageTargetType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Identifier == nil { + return fmt.Errorf("required field identifier missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"identifier", "type"}) + } else { + return err + } + + hasInvalidField := false + o.Identifier = *all.Identifier + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_page_target_type.go b/api/datadogV2/model_incident_page_target_type.go new file mode 100644 index 00000000000..b45434c2567 --- /dev/null +++ b/api/datadogV2/model_incident_page_target_type.go @@ -0,0 +1,68 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentPageTargetType The type of target for a page request. +type IncidentPageTargetType string + +// List of IncidentPageTargetType. +const ( + INCIDENTPAGETARGETTYPE_TEAM_HANDLE IncidentPageTargetType = "team_handle" + INCIDENTPAGETARGETTYPE_TEAM_UUID IncidentPageTargetType = "team_uuid" + INCIDENTPAGETARGETTYPE_USER_UUID IncidentPageTargetType = "user_uuid" +) + +var allowedIncidentPageTargetTypeEnumValues = []IncidentPageTargetType{ + INCIDENTPAGETARGETTYPE_TEAM_HANDLE, + INCIDENTPAGETARGETTYPE_TEAM_UUID, + INCIDENTPAGETARGETTYPE_USER_UUID, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentPageTargetType) GetAllowedValues() []IncidentPageTargetType { + return allowedIncidentPageTargetTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentPageTargetType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentPageTargetType(value) + return nil +} + +// NewIncidentPageTargetTypeFromValue returns a pointer to a valid IncidentPageTargetType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentPageTargetTypeFromValue(v string) (*IncidentPageTargetType, error) { + ev := IncidentPageTargetType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentPageTargetType: valid values are %v", v, allowedIncidentPageTargetTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentPageTargetType) IsValid() bool { + for _, existing := range allowedIncidentPageTargetTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentPageTargetType value. +func (v IncidentPageTargetType) Ptr() *IncidentPageTargetType { + return &v +} diff --git a/api/datadogV2/model_incident_page_uuid_data_response.go b/api/datadogV2/model_incident_page_uuid_data_response.go new file mode 100644 index 00000000000..749c3e923ed --- /dev/null +++ b/api/datadogV2/model_incident_page_uuid_data_response.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 datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentPageUUIDDataResponse Page UUID data in a response. +type IncidentPageUUIDDataResponse struct { + // The UUID of the created page. + Id uuid.UUID `json:"id"` + // Resource type for a page UUID response. + Type IncidentPageUUIDType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentPageUUIDDataResponse instantiates a new IncidentPageUUIDDataResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentPageUUIDDataResponse(id uuid.UUID, typeVar IncidentPageUUIDType) *IncidentPageUUIDDataResponse { + this := IncidentPageUUIDDataResponse{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentPageUUIDDataResponseWithDefaults instantiates a new IncidentPageUUIDDataResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentPageUUIDDataResponseWithDefaults() *IncidentPageUUIDDataResponse { + this := IncidentPageUUIDDataResponse{} + return &this +} + +// GetId returns the Id field value. +func (o *IncidentPageUUIDDataResponse) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentPageUUIDDataResponse) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentPageUUIDDataResponse) SetId(v uuid.UUID) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *IncidentPageUUIDDataResponse) GetType() IncidentPageUUIDType { + if o == nil { + var ret IncidentPageUUIDType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentPageUUIDDataResponse) GetTypeOk() (*IncidentPageUUIDType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentPageUUIDDataResponse) SetType(v IncidentPageUUIDType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentPageUUIDDataResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentPageUUIDDataResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *uuid.UUID `json:"id"` + Type *IncidentPageUUIDType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) + } else { + return err + } + + hasInvalidField := false + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_page_uuid_response.go b/api/datadogV2/model_incident_page_uuid_response.go new file mode 100644 index 00000000000..04cbd0e9c37 --- /dev/null +++ b/api/datadogV2/model_incident_page_uuid_response.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentPageUUIDResponse Response with a page UUID. +type IncidentPageUUIDResponse struct { + // Page UUID data in a response. + Data IncidentPageUUIDDataResponse `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentPageUUIDResponse instantiates a new IncidentPageUUIDResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentPageUUIDResponse(data IncidentPageUUIDDataResponse) *IncidentPageUUIDResponse { + this := IncidentPageUUIDResponse{} + this.Data = data + return &this +} + +// NewIncidentPageUUIDResponseWithDefaults instantiates a new IncidentPageUUIDResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentPageUUIDResponseWithDefaults() *IncidentPageUUIDResponse { + this := IncidentPageUUIDResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentPageUUIDResponse) GetData() IncidentPageUUIDDataResponse { + if o == nil { + var ret IncidentPageUUIDDataResponse + 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 *IncidentPageUUIDResponse) GetDataOk() (*IncidentPageUUIDDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentPageUUIDResponse) SetData(v IncidentPageUUIDDataResponse) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentPageUUIDResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentPageUUIDResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentPageUUIDDataResponse `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_page_uuid_type.go b/api/datadogV2/model_incident_page_uuid_type.go new file mode 100644 index 00000000000..054d14f47bd --- /dev/null +++ b/api/datadogV2/model_incident_page_uuid_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentPageUUIDType Resource type for a page UUID response. +type IncidentPageUUIDType string + +// List of IncidentPageUUIDType. +const ( + INCIDENTPAGEUUIDTYPE_PAGE_UUID IncidentPageUUIDType = "page_uuid" +) + +var allowedIncidentPageUUIDTypeEnumValues = []IncidentPageUUIDType{ + INCIDENTPAGEUUIDTYPE_PAGE_UUID, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentPageUUIDType) GetAllowedValues() []IncidentPageUUIDType { + return allowedIncidentPageUUIDTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentPageUUIDType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentPageUUIDType(value) + return nil +} + +// NewIncidentPageUUIDTypeFromValue returns a pointer to a valid IncidentPageUUIDType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentPageUUIDTypeFromValue(v string) (*IncidentPageUUIDType, error) { + ev := IncidentPageUUIDType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentPageUUIDType: valid values are %v", v, allowedIncidentPageUUIDTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentPageUUIDType) IsValid() bool { + for _, existing := range allowedIncidentPageUUIDTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentPageUUIDType value. +func (v IncidentPageUUIDType) Ptr() *IncidentPageUUIDType { + return &v +} diff --git a/api/datadogV2/model_incident_responder_data_attributes_response.go b/api/datadogV2/model_incident_responder_data_attributes_response.go new file mode 100644 index 00000000000..9843c816762 --- /dev/null +++ b/api/datadogV2/model_incident_responder_data_attributes_response.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 datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentResponderDataAttributesResponse Attributes of an incident responder in a response. +type IncidentResponderDataAttributesResponse struct { + // Timestamp when the responder was created. + Created time.Time `json:"created"` + // The external ID of the responder. + ExternalId datadog.NullableString `json:"external_id,omitempty"` + // The external source of the responder. + ExternalSource datadog.NullableString `json:"external_source,omitempty"` + // Whether this responder counts toward billing. + IsBillable bool `json:"is_billable"` + // Timestamp when the responder was last active. + LastActive datadog.NullableTime `json:"last_active,omitempty"` + // Additional metadata for the responder. + Meta map[string]interface{} `json:"meta,omitempty"` + // Timestamp when the responder was last modified. + Modified time.Time `json:"modified"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentResponderDataAttributesResponse instantiates a new IncidentResponderDataAttributesResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentResponderDataAttributesResponse(created time.Time, isBillable bool, modified time.Time) *IncidentResponderDataAttributesResponse { + this := IncidentResponderDataAttributesResponse{} + this.Created = created + this.IsBillable = isBillable + this.Modified = modified + return &this +} + +// NewIncidentResponderDataAttributesResponseWithDefaults instantiates a new IncidentResponderDataAttributesResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentResponderDataAttributesResponseWithDefaults() *IncidentResponderDataAttributesResponse { + this := IncidentResponderDataAttributesResponse{} + return &this +} + +// GetCreated returns the Created field value. +func (o *IncidentResponderDataAttributesResponse) GetCreated() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.Created +} + +// GetCreatedOk returns a tuple with the Created field value +// and a boolean to check if the value has been set. +func (o *IncidentResponderDataAttributesResponse) GetCreatedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Created, true +} + +// SetCreated sets field value. +func (o *IncidentResponderDataAttributesResponse) SetCreated(v time.Time) { + o.Created = v +} + +// GetExternalId returns the ExternalId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentResponderDataAttributesResponse) GetExternalId() string { + if o == nil || o.ExternalId.Get() == nil { + var ret string + return ret + } + return *o.ExternalId.Get() +} + +// GetExternalIdOk returns a tuple with the ExternalId 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 *IncidentResponderDataAttributesResponse) GetExternalIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ExternalId.Get(), o.ExternalId.IsSet() +} + +// HasExternalId returns a boolean if a field has been set. +func (o *IncidentResponderDataAttributesResponse) HasExternalId() bool { + return o != nil && o.ExternalId.IsSet() +} + +// SetExternalId gets a reference to the given datadog.NullableString and assigns it to the ExternalId field. +func (o *IncidentResponderDataAttributesResponse) SetExternalId(v string) { + o.ExternalId.Set(&v) +} + +// SetExternalIdNil sets the value for ExternalId to be an explicit nil. +func (o *IncidentResponderDataAttributesResponse) SetExternalIdNil() { + o.ExternalId.Set(nil) +} + +// UnsetExternalId ensures that no value is present for ExternalId, not even an explicit nil. +func (o *IncidentResponderDataAttributesResponse) UnsetExternalId() { + o.ExternalId.Unset() +} + +// GetExternalSource returns the ExternalSource field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentResponderDataAttributesResponse) GetExternalSource() string { + if o == nil || o.ExternalSource.Get() == nil { + var ret string + return ret + } + return *o.ExternalSource.Get() +} + +// GetExternalSourceOk returns a tuple with the ExternalSource 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 *IncidentResponderDataAttributesResponse) GetExternalSourceOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ExternalSource.Get(), o.ExternalSource.IsSet() +} + +// HasExternalSource returns a boolean if a field has been set. +func (o *IncidentResponderDataAttributesResponse) HasExternalSource() bool { + return o != nil && o.ExternalSource.IsSet() +} + +// SetExternalSource gets a reference to the given datadog.NullableString and assigns it to the ExternalSource field. +func (o *IncidentResponderDataAttributesResponse) SetExternalSource(v string) { + o.ExternalSource.Set(&v) +} + +// SetExternalSourceNil sets the value for ExternalSource to be an explicit nil. +func (o *IncidentResponderDataAttributesResponse) SetExternalSourceNil() { + o.ExternalSource.Set(nil) +} + +// UnsetExternalSource ensures that no value is present for ExternalSource, not even an explicit nil. +func (o *IncidentResponderDataAttributesResponse) UnsetExternalSource() { + o.ExternalSource.Unset() +} + +// GetIsBillable returns the IsBillable field value. +func (o *IncidentResponderDataAttributesResponse) GetIsBillable() bool { + if o == nil { + var ret bool + return ret + } + return o.IsBillable +} + +// GetIsBillableOk returns a tuple with the IsBillable field value +// and a boolean to check if the value has been set. +func (o *IncidentResponderDataAttributesResponse) GetIsBillableOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsBillable, true +} + +// SetIsBillable sets field value. +func (o *IncidentResponderDataAttributesResponse) SetIsBillable(v bool) { + o.IsBillable = v +} + +// GetLastActive returns the LastActive field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentResponderDataAttributesResponse) GetLastActive() time.Time { + if o == nil || o.LastActive.Get() == nil { + var ret time.Time + return ret + } + return *o.LastActive.Get() +} + +// GetLastActiveOk returns a tuple with the LastActive 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 *IncidentResponderDataAttributesResponse) GetLastActiveOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.LastActive.Get(), o.LastActive.IsSet() +} + +// HasLastActive returns a boolean if a field has been set. +func (o *IncidentResponderDataAttributesResponse) HasLastActive() bool { + return o != nil && o.LastActive.IsSet() +} + +// SetLastActive gets a reference to the given datadog.NullableTime and assigns it to the LastActive field. +func (o *IncidentResponderDataAttributesResponse) SetLastActive(v time.Time) { + o.LastActive.Set(&v) +} + +// SetLastActiveNil sets the value for LastActive to be an explicit nil. +func (o *IncidentResponderDataAttributesResponse) SetLastActiveNil() { + o.LastActive.Set(nil) +} + +// UnsetLastActive ensures that no value is present for LastActive, not even an explicit nil. +func (o *IncidentResponderDataAttributesResponse) UnsetLastActive() { + o.LastActive.Unset() +} + +// GetMeta returns the Meta field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentResponderDataAttributesResponse) GetMeta() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + 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. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *IncidentResponderDataAttributesResponse) GetMetaOk() (*map[string]interface{}, 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 *IncidentResponderDataAttributesResponse) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given map[string]interface{} and assigns it to the Meta field. +func (o *IncidentResponderDataAttributesResponse) SetMeta(v map[string]interface{}) { + o.Meta = v +} + +// GetModified returns the Modified field value. +func (o *IncidentResponderDataAttributesResponse) GetModified() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.Modified +} + +// GetModifiedOk returns a tuple with the Modified field value +// and a boolean to check if the value has been set. +func (o *IncidentResponderDataAttributesResponse) GetModifiedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Modified, true +} + +// SetModified sets field value. +func (o *IncidentResponderDataAttributesResponse) SetModified(v time.Time) { + o.Modified = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponderDataAttributesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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.ExternalId.IsSet() { + toSerialize["external_id"] = o.ExternalId.Get() + } + if o.ExternalSource.IsSet() { + toSerialize["external_source"] = o.ExternalSource.Get() + } + toSerialize["is_billable"] = o.IsBillable + if o.LastActive.IsSet() { + toSerialize["last_active"] = o.LastActive.Get() + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + 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") + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponderDataAttributesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Created *time.Time `json:"created"` + ExternalId datadog.NullableString `json:"external_id,omitempty"` + ExternalSource datadog.NullableString `json:"external_source,omitempty"` + IsBillable *bool `json:"is_billable"` + LastActive datadog.NullableTime `json:"last_active,omitempty"` + Meta map[string]interface{} `json:"meta,omitempty"` + Modified *time.Time `json:"modified"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Created == nil { + return fmt.Errorf("required field created missing") + } + if all.IsBillable == nil { + return fmt.Errorf("required field is_billable missing") + } + if all.Modified == nil { + return fmt.Errorf("required field modified missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created", "external_id", "external_source", "is_billable", "last_active", "meta", "modified"}) + } else { + return err + } + o.Created = *all.Created + o.ExternalId = all.ExternalId + o.ExternalSource = all.ExternalSource + o.IsBillable = *all.IsBillable + o.LastActive = all.LastActive + o.Meta = all.Meta + o.Modified = *all.Modified + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_responder_data_request.go b/api/datadogV2/model_incident_responder_data_request.go new file mode 100644 index 00000000000..4c331a2eee4 --- /dev/null +++ b/api/datadogV2/model_incident_responder_data_request.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentResponderDataRequest Incident responder data in a create request. +type IncidentResponderDataRequest struct { + // Relationships for creating an incident responder. + Relationships IncidentResponderRelationshipsRequest `json:"relationships"` + // Incident responder resource type. + Type IncidentResponderType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentResponderDataRequest instantiates a new IncidentResponderDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentResponderDataRequest(relationships IncidentResponderRelationshipsRequest, typeVar IncidentResponderType) *IncidentResponderDataRequest { + this := IncidentResponderDataRequest{} + this.Relationships = relationships + this.Type = typeVar + return &this +} + +// NewIncidentResponderDataRequestWithDefaults instantiates a new IncidentResponderDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentResponderDataRequestWithDefaults() *IncidentResponderDataRequest { + this := IncidentResponderDataRequest{} + return &this +} + +// GetRelationships returns the Relationships field value. +func (o *IncidentResponderDataRequest) GetRelationships() IncidentResponderRelationshipsRequest { + if o == nil { + var ret IncidentResponderRelationshipsRequest + 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 *IncidentResponderDataRequest) GetRelationshipsOk() (*IncidentResponderRelationshipsRequest, bool) { + if o == nil { + return nil, false + } + return &o.Relationships, true +} + +// SetRelationships sets field value. +func (o *IncidentResponderDataRequest) SetRelationships(v IncidentResponderRelationshipsRequest) { + o.Relationships = v +} + +// GetType returns the Type field value. +func (o *IncidentResponderDataRequest) GetType() IncidentResponderType { + if o == nil { + var ret IncidentResponderType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentResponderDataRequest) GetTypeOk() (*IncidentResponderType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentResponderDataRequest) SetType(v IncidentResponderType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponderDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["relationships"] = o.Relationships + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponderDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Relationships *IncidentResponderRelationshipsRequest `json:"relationships"` + Type *IncidentResponderType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Relationships == nil { + return fmt.Errorf("required field relationships missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = *all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_responder_data_response.go b/api/datadogV2/model_incident_responder_data_response.go new file mode 100644 index 00000000000..fb0a19371c5 --- /dev/null +++ b/api/datadogV2/model_incident_responder_data_response.go @@ -0,0 +1,218 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentResponderDataResponse Incident responder data in a response. +type IncidentResponderDataResponse struct { + // Attributes of an incident responder in a response. + Attributes IncidentResponderDataAttributesResponse `json:"attributes"` + // The responder identifier. + Id uuid.UUID `json:"id"` + // Relationships for an incident responder. + Relationships *IncidentResponderRelationships `json:"relationships,omitempty"` + // Incident responder resource type. + Type IncidentResponderType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentResponderDataResponse instantiates a new IncidentResponderDataResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentResponderDataResponse(attributes IncidentResponderDataAttributesResponse, id uuid.UUID, typeVar IncidentResponderType) *IncidentResponderDataResponse { + this := IncidentResponderDataResponse{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentResponderDataResponseWithDefaults instantiates a new IncidentResponderDataResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentResponderDataResponseWithDefaults() *IncidentResponderDataResponse { + this := IncidentResponderDataResponse{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentResponderDataResponse) GetAttributes() IncidentResponderDataAttributesResponse { + if o == nil { + var ret IncidentResponderDataAttributesResponse + 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 *IncidentResponderDataResponse) GetAttributesOk() (*IncidentResponderDataAttributesResponse, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentResponderDataResponse) SetAttributes(v IncidentResponderDataAttributesResponse) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *IncidentResponderDataResponse) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentResponderDataResponse) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentResponderDataResponse) SetId(v uuid.UUID) { + o.Id = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentResponderDataResponse) GetRelationships() IncidentResponderRelationships { + if o == nil || o.Relationships == nil { + var ret IncidentResponderRelationships + 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 *IncidentResponderDataResponse) GetRelationshipsOk() (*IncidentResponderRelationships, 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 *IncidentResponderDataResponse) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given IncidentResponderRelationships and assigns it to the Relationships field. +func (o *IncidentResponderDataResponse) SetRelationships(v IncidentResponderRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *IncidentResponderDataResponse) GetType() IncidentResponderType { + if o == nil { + var ret IncidentResponderType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentResponderDataResponse) GetTypeOk() (*IncidentResponderType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentResponderDataResponse) SetType(v IncidentResponderType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponderDataResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponderDataResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentResponderDataAttributesResponse `json:"attributes"` + Id *uuid.UUID `json:"id"` + Relationships *IncidentResponderRelationships `json:"relationships,omitempty"` + Type *IncidentResponderType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_responder_relationships.go b/api/datadogV2/model_incident_responder_relationships.go new file mode 100644 index 00000000000..34344040951 --- /dev/null +++ b/api/datadogV2/model_incident_responder_relationships.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentResponderRelationships Relationships for an incident responder. +type IncidentResponderRelationships struct { + // Relationship to user. + CreatedBy *RelationshipToUser `json:"created_by,omitempty"` + // Relationship to user. + LastModifiedBy *RelationshipToUser `json:"last_modified_by,omitempty"` + // Relationship to role assignments for a responder. + RoleAssignments *IncidentResponderRoleAssignmentsRelationship `json:"role_assignments,omitempty"` + // Relationship to user. + User NullableNullableRelationshipToUser `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{} `json:"-"` +} + +// NewIncidentResponderRelationships instantiates a new IncidentResponderRelationships object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentResponderRelationships() *IncidentResponderRelationships { + this := IncidentResponderRelationships{} + return &this +} + +// NewIncidentResponderRelationshipsWithDefaults instantiates a new IncidentResponderRelationships object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentResponderRelationshipsWithDefaults() *IncidentResponderRelationships { + this := IncidentResponderRelationships{} + return &this +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *IncidentResponderRelationships) 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 *IncidentResponderRelationships) 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 *IncidentResponderRelationships) HasCreatedBy() bool { + return o != nil && o.CreatedBy != nil +} + +// SetCreatedBy gets a reference to the given RelationshipToUser and assigns it to the CreatedBy field. +func (o *IncidentResponderRelationships) SetCreatedBy(v RelationshipToUser) { + o.CreatedBy = &v +} + +// GetLastModifiedBy returns the LastModifiedBy field value if set, zero value otherwise. +func (o *IncidentResponderRelationships) 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 *IncidentResponderRelationships) 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 *IncidentResponderRelationships) HasLastModifiedBy() bool { + return o != nil && o.LastModifiedBy != nil +} + +// SetLastModifiedBy gets a reference to the given RelationshipToUser and assigns it to the LastModifiedBy field. +func (o *IncidentResponderRelationships) SetLastModifiedBy(v RelationshipToUser) { + o.LastModifiedBy = &v +} + +// GetRoleAssignments returns the RoleAssignments field value if set, zero value otherwise. +func (o *IncidentResponderRelationships) GetRoleAssignments() IncidentResponderRoleAssignmentsRelationship { + if o == nil || o.RoleAssignments == nil { + var ret IncidentResponderRoleAssignmentsRelationship + return ret + } + return *o.RoleAssignments +} + +// GetRoleAssignmentsOk returns a tuple with the RoleAssignments field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentResponderRelationships) GetRoleAssignmentsOk() (*IncidentResponderRoleAssignmentsRelationship, bool) { + if o == nil || o.RoleAssignments == nil { + return nil, false + } + return o.RoleAssignments, true +} + +// HasRoleAssignments returns a boolean if a field has been set. +func (o *IncidentResponderRelationships) HasRoleAssignments() bool { + return o != nil && o.RoleAssignments != nil +} + +// SetRoleAssignments gets a reference to the given IncidentResponderRoleAssignmentsRelationship and assigns it to the RoleAssignments field. +func (o *IncidentResponderRelationships) SetRoleAssignments(v IncidentResponderRoleAssignmentsRelationship) { + o.RoleAssignments = &v +} + +// GetUser returns the User field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentResponderRelationships) GetUser() NullableRelationshipToUser { + if o == nil || o.User.Get() == nil { + var ret NullableRelationshipToUser + return ret + } + return *o.User.Get() +} + +// GetUserOk returns a tuple with the User 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 *IncidentResponderRelationships) GetUserOk() (*NullableRelationshipToUser, bool) { + if o == nil { + return nil, false + } + return o.User.Get(), o.User.IsSet() +} + +// HasUser returns a boolean if a field has been set. +func (o *IncidentResponderRelationships) HasUser() bool { + return o != nil && o.User.IsSet() +} + +// SetUser gets a reference to the given NullableNullableRelationshipToUser and assigns it to the User field. +func (o *IncidentResponderRelationships) SetUser(v NullableRelationshipToUser) { + o.User.Set(&v) +} + +// SetUserNil sets the value for User to be an explicit nil. +func (o *IncidentResponderRelationships) SetUserNil() { + o.User.Set(nil) +} + +// UnsetUser ensures that no value is present for User, not even an explicit nil. +func (o *IncidentResponderRelationships) UnsetUser() { + o.User.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponderRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CreatedBy != nil { + toSerialize["created_by"] = o.CreatedBy + } + if o.LastModifiedBy != nil { + toSerialize["last_modified_by"] = o.LastModifiedBy + } + if o.RoleAssignments != nil { + toSerialize["role_assignments"] = o.RoleAssignments + } + if o.User.IsSet() { + toSerialize["user"] = o.User.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponderRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedBy *RelationshipToUser `json:"created_by,omitempty"` + LastModifiedBy *RelationshipToUser `json:"last_modified_by,omitempty"` + RoleAssignments *IncidentResponderRoleAssignmentsRelationship `json:"role_assignments,omitempty"` + User NullableNullableRelationshipToUser `json:"user,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_by", "last_modified_by", "role_assignments", "user"}) + } else { + return err + } + + hasInvalidField := false + if all.CreatedBy != nil && all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CreatedBy = all.CreatedBy + if all.LastModifiedBy != nil && all.LastModifiedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LastModifiedBy = all.LastModifiedBy + if all.RoleAssignments != nil && all.RoleAssignments.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.RoleAssignments = all.RoleAssignments + o.User = all.User + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_responder_relationships_request.go b/api/datadogV2/model_incident_responder_relationships_request.go new file mode 100644 index 00000000000..f94ec6761fa --- /dev/null +++ b/api/datadogV2/model_incident_responder_relationships_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentResponderRelationshipsRequest Relationships for creating an incident responder. +type IncidentResponderRelationshipsRequest struct { + // Relationship to a user for a responder create request. + User IncidentResponderUserRelationship `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{} `json:"-"` +} + +// NewIncidentResponderRelationshipsRequest instantiates a new IncidentResponderRelationshipsRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentResponderRelationshipsRequest(user IncidentResponderUserRelationship) *IncidentResponderRelationshipsRequest { + this := IncidentResponderRelationshipsRequest{} + this.User = user + return &this +} + +// NewIncidentResponderRelationshipsRequestWithDefaults instantiates a new IncidentResponderRelationshipsRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentResponderRelationshipsRequestWithDefaults() *IncidentResponderRelationshipsRequest { + this := IncidentResponderRelationshipsRequest{} + return &this +} + +// GetUser returns the User field value. +func (o *IncidentResponderRelationshipsRequest) GetUser() IncidentResponderUserRelationship { + if o == nil { + var ret IncidentResponderUserRelationship + 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 *IncidentResponderRelationshipsRequest) GetUserOk() (*IncidentResponderUserRelationship, bool) { + if o == nil { + return nil, false + } + return &o.User, true +} + +// SetUser sets field value. +func (o *IncidentResponderRelationshipsRequest) SetUser(v IncidentResponderUserRelationship) { + o.User = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponderRelationshipsRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["user"] = o.User + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponderRelationshipsRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + User *IncidentResponderUserRelationship `json:"user"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.User == nil { + return fmt.Errorf("required field user missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"user"}) + } else { + return err + } + + hasInvalidField := false + if all.User.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.User = *all.User + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_responder_request.go b/api/datadogV2/model_incident_responder_request.go new file mode 100644 index 00000000000..fbe9aee7545 --- /dev/null +++ b/api/datadogV2/model_incident_responder_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentResponderRequest Request payload for creating an incident responder. +type IncidentResponderRequest struct { + // Incident responder data in a create request. + Data IncidentResponderDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentResponderRequest instantiates a new IncidentResponderRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentResponderRequest(data IncidentResponderDataRequest) *IncidentResponderRequest { + this := IncidentResponderRequest{} + this.Data = data + return &this +} + +// NewIncidentResponderRequestWithDefaults instantiates a new IncidentResponderRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentResponderRequestWithDefaults() *IncidentResponderRequest { + this := IncidentResponderRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentResponderRequest) GetData() IncidentResponderDataRequest { + if o == nil { + var ret IncidentResponderDataRequest + 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 *IncidentResponderRequest) GetDataOk() (*IncidentResponderDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentResponderRequest) SetData(v IncidentResponderDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponderRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponderRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentResponderDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_responder_response.go b/api/datadogV2/model_incident_responder_response.go new file mode 100644 index 00000000000..715feea0678 --- /dev/null +++ b/api/datadogV2/model_incident_responder_response.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentResponderResponse Response with a single incident responder. +type IncidentResponderResponse struct { + // Incident responder data in a response. + Data IncidentResponderDataResponse `json:"data"` + // Included related resources. + Included []IncidentUserData `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{} `json:"-"` +} + +// NewIncidentResponderResponse instantiates a new IncidentResponderResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentResponderResponse(data IncidentResponderDataResponse) *IncidentResponderResponse { + this := IncidentResponderResponse{} + this.Data = data + return &this +} + +// NewIncidentResponderResponseWithDefaults instantiates a new IncidentResponderResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentResponderResponseWithDefaults() *IncidentResponderResponse { + this := IncidentResponderResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentResponderResponse) GetData() IncidentResponderDataResponse { + if o == nil { + var ret IncidentResponderDataResponse + 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 *IncidentResponderResponse) GetDataOk() (*IncidentResponderDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentResponderResponse) SetData(v IncidentResponderDataResponse) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentResponderResponse) GetIncluded() []IncidentUserData { + if o == nil || o.Included == nil { + var ret []IncidentUserData + 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 *IncidentResponderResponse) GetIncludedOk() (*[]IncidentUserData, 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 *IncidentResponderResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []IncidentUserData and assigns it to the Included field. +func (o *IncidentResponderResponse) SetIncluded(v []IncidentUserData) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponderResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponderResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentResponderDataResponse `json:"data"` + Included []IncidentUserData `json:"included,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + o.Included = all.Included + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_responder_role_assignment_relationship_data.go b/api/datadogV2/model_incident_responder_role_assignment_relationship_data.go new file mode 100644 index 00000000000..30dcd57aedb --- /dev/null +++ b/api/datadogV2/model_incident_responder_role_assignment_relationship_data.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 datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentResponderRoleAssignmentRelationshipData A single role assignment relationship data object. +type IncidentResponderRoleAssignmentRelationshipData struct { + // The role assignment identifier. + Id uuid.UUID `json:"id"` + // The role assignment resource type. + Type string `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentResponderRoleAssignmentRelationshipData instantiates a new IncidentResponderRoleAssignmentRelationshipData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentResponderRoleAssignmentRelationshipData(id uuid.UUID, typeVar string) *IncidentResponderRoleAssignmentRelationshipData { + this := IncidentResponderRoleAssignmentRelationshipData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentResponderRoleAssignmentRelationshipDataWithDefaults instantiates a new IncidentResponderRoleAssignmentRelationshipData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentResponderRoleAssignmentRelationshipDataWithDefaults() *IncidentResponderRoleAssignmentRelationshipData { + this := IncidentResponderRoleAssignmentRelationshipData{} + return &this +} + +// GetId returns the Id field value. +func (o *IncidentResponderRoleAssignmentRelationshipData) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentResponderRoleAssignmentRelationshipData) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentResponderRoleAssignmentRelationshipData) SetId(v uuid.UUID) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *IncidentResponderRoleAssignmentRelationshipData) 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 *IncidentResponderRoleAssignmentRelationshipData) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentResponderRoleAssignmentRelationshipData) SetType(v string) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponderRoleAssignmentRelationshipData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponderRoleAssignmentRelationshipData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *uuid.UUID `json:"id"` + Type *string `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) + } else { + return err + } + o.Id = *all.Id + o.Type = *all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_responder_role_assignments_relationship.go b/api/datadogV2/model_incident_responder_role_assignments_relationship.go new file mode 100644 index 00000000000..d54f0a89271 --- /dev/null +++ b/api/datadogV2/model_incident_responder_role_assignments_relationship.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentResponderRoleAssignmentsRelationship Relationship to role assignments for a responder. +type IncidentResponderRoleAssignmentsRelationship struct { + // List of role assignment relationship data. + Data []IncidentResponderRoleAssignmentRelationshipData `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{} `json:"-"` +} + +// NewIncidentResponderRoleAssignmentsRelationship instantiates a new IncidentResponderRoleAssignmentsRelationship object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentResponderRoleAssignmentsRelationship() *IncidentResponderRoleAssignmentsRelationship { + this := IncidentResponderRoleAssignmentsRelationship{} + return &this +} + +// NewIncidentResponderRoleAssignmentsRelationshipWithDefaults instantiates a new IncidentResponderRoleAssignmentsRelationship object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentResponderRoleAssignmentsRelationshipWithDefaults() *IncidentResponderRoleAssignmentsRelationship { + this := IncidentResponderRoleAssignmentsRelationship{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *IncidentResponderRoleAssignmentsRelationship) GetData() []IncidentResponderRoleAssignmentRelationshipData { + if o == nil || o.Data == nil { + var ret []IncidentResponderRoleAssignmentRelationshipData + 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 *IncidentResponderRoleAssignmentsRelationship) GetDataOk() (*[]IncidentResponderRoleAssignmentRelationshipData, 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 *IncidentResponderRoleAssignmentsRelationship) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []IncidentResponderRoleAssignmentRelationshipData and assigns it to the Data field. +func (o *IncidentResponderRoleAssignmentsRelationship) SetData(v []IncidentResponderRoleAssignmentRelationshipData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponderRoleAssignmentsRelationship) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponderRoleAssignmentsRelationship) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data []IncidentResponderRoleAssignmentRelationshipData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_responder_type.go b/api/datadogV2/model_incident_responder_type.go new file mode 100644 index 00000000000..4b5868a7f78 --- /dev/null +++ b/api/datadogV2/model_incident_responder_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentResponderType Incident responder resource type. +type IncidentResponderType string + +// List of IncidentResponderType. +const ( + INCIDENTRESPONDERTYPE_INCIDENT_RESPONDERS IncidentResponderType = "incident_responders" +) + +var allowedIncidentResponderTypeEnumValues = []IncidentResponderType{ + INCIDENTRESPONDERTYPE_INCIDENT_RESPONDERS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentResponderType) GetAllowedValues() []IncidentResponderType { + return allowedIncidentResponderTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentResponderType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentResponderType(value) + return nil +} + +// NewIncidentResponderTypeFromValue returns a pointer to a valid IncidentResponderType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentResponderTypeFromValue(v string) (*IncidentResponderType, error) { + ev := IncidentResponderType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentResponderType: valid values are %v", v, allowedIncidentResponderTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentResponderType) IsValid() bool { + for _, existing := range allowedIncidentResponderTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentResponderType value. +func (v IncidentResponderType) Ptr() *IncidentResponderType { + return &v +} diff --git a/api/datadogV2/model_incident_responder_user_relationship.go b/api/datadogV2/model_incident_responder_user_relationship.go new file mode 100644 index 00000000000..319ddaa8b67 --- /dev/null +++ b/api/datadogV2/model_incident_responder_user_relationship.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentResponderUserRelationship Relationship to a user for a responder create request. +type IncidentResponderUserRelationship struct { + // A user relationship data object for creating a responder. + Data IncidentResponderUserRelationshipData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentResponderUserRelationship instantiates a new IncidentResponderUserRelationship object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentResponderUserRelationship(data IncidentResponderUserRelationshipData) *IncidentResponderUserRelationship { + this := IncidentResponderUserRelationship{} + this.Data = data + return &this +} + +// NewIncidentResponderUserRelationshipWithDefaults instantiates a new IncidentResponderUserRelationship object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentResponderUserRelationshipWithDefaults() *IncidentResponderUserRelationship { + this := IncidentResponderUserRelationship{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentResponderUserRelationship) GetData() IncidentResponderUserRelationshipData { + if o == nil { + var ret IncidentResponderUserRelationshipData + 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 *IncidentResponderUserRelationship) GetDataOk() (*IncidentResponderUserRelationshipData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentResponderUserRelationship) SetData(v IncidentResponderUserRelationshipData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponderUserRelationship) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponderUserRelationship) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentResponderUserRelationshipData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_responder_user_relationship_data.go b/api/datadogV2/model_incident_responder_user_relationship_data.go new file mode 100644 index 00000000000..77a8c226403 --- /dev/null +++ b/api/datadogV2/model_incident_responder_user_relationship_data.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 datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentResponderUserRelationshipData A user relationship data object for creating a responder. +type IncidentResponderUserRelationshipData struct { + // The user identifier. + Id uuid.UUID `json:"id"` + // The user resource type. + Type string `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentResponderUserRelationshipData instantiates a new IncidentResponderUserRelationshipData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentResponderUserRelationshipData(id uuid.UUID, typeVar string) *IncidentResponderUserRelationshipData { + this := IncidentResponderUserRelationshipData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentResponderUserRelationshipDataWithDefaults instantiates a new IncidentResponderUserRelationshipData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentResponderUserRelationshipDataWithDefaults() *IncidentResponderUserRelationshipData { + this := IncidentResponderUserRelationshipData{} + return &this +} + +// GetId returns the Id field value. +func (o *IncidentResponderUserRelationshipData) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentResponderUserRelationshipData) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentResponderUserRelationshipData) SetId(v uuid.UUID) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *IncidentResponderUserRelationshipData) 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 *IncidentResponderUserRelationshipData) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentResponderUserRelationshipData) SetType(v string) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentResponderUserRelationshipData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentResponderUserRelationshipData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *uuid.UUID `json:"id"` + Type *string `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) + } else { + return err + } + o.Id = *all.Id + o.Type = *all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_responders_response.go b/api/datadogV2/model_incident_responders_response.go new file mode 100644 index 00000000000..eb2cc39ea9d --- /dev/null +++ b/api/datadogV2/model_incident_responders_response.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRespondersResponse Response with a list of incident responders. +type IncidentRespondersResponse struct { + // List of incident responders. + Data []IncidentResponderDataResponse `json:"data"` + // Included related resources. + Included []IncidentUserData `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{} `json:"-"` +} + +// NewIncidentRespondersResponse instantiates a new IncidentRespondersResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentRespondersResponse(data []IncidentResponderDataResponse) *IncidentRespondersResponse { + this := IncidentRespondersResponse{} + this.Data = data + return &this +} + +// NewIncidentRespondersResponseWithDefaults instantiates a new IncidentRespondersResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentRespondersResponseWithDefaults() *IncidentRespondersResponse { + this := IncidentRespondersResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentRespondersResponse) GetData() []IncidentResponderDataResponse { + if o == nil { + var ret []IncidentResponderDataResponse + 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 *IncidentRespondersResponse) GetDataOk() (*[]IncidentResponderDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentRespondersResponse) SetData(v []IncidentResponderDataResponse) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentRespondersResponse) GetIncluded() []IncidentUserData { + if o == nil || o.Included == nil { + var ret []IncidentUserData + 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 *IncidentRespondersResponse) GetIncludedOk() (*[]IncidentUserData, 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 *IncidentRespondersResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []IncidentUserData and assigns it to the Included field. +func (o *IncidentRespondersResponse) SetIncluded(v []IncidentUserData) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentRespondersResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentRespondersResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]IncidentResponderDataResponse `json:"data"` + Included []IncidentUserData `json:"included,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) + } else { + return err + } + o.Data = *all.Data + o.Included = all.Included + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_rule_condition.go b/api/datadogV2/model_incident_rule_condition.go new file mode 100644 index 00000000000..6b98594b8fd --- /dev/null +++ b/api/datadogV2/model_incident_rule_condition.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRuleCondition A condition for an incident rule. +type IncidentRuleCondition struct { + // The field to match on. + Field string `json:"field"` + // The values to match. + Values []string `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{} `json:"-"` +} + +// NewIncidentRuleCondition instantiates a new IncidentRuleCondition object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentRuleCondition(field string, values []string) *IncidentRuleCondition { + this := IncidentRuleCondition{} + this.Field = field + this.Values = values + return &this +} + +// NewIncidentRuleConditionWithDefaults instantiates a new IncidentRuleCondition object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentRuleConditionWithDefaults() *IncidentRuleCondition { + this := IncidentRuleCondition{} + return &this +} + +// GetField returns the Field field value. +func (o *IncidentRuleCondition) 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 *IncidentRuleCondition) GetFieldOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Field, true +} + +// SetField sets field value. +func (o *IncidentRuleCondition) SetField(v string) { + o.Field = v +} + +// GetValues returns the Values field value. +func (o *IncidentRuleCondition) GetValues() []string { + if o == nil { + var ret []string + 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 *IncidentRuleCondition) GetValuesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.Values, true +} + +// SetValues sets field value. +func (o *IncidentRuleCondition) SetValues(v []string) { + o.Values = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentRuleCondition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["field"] = o.Field + toSerialize["values"] = o.Values + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentRuleCondition) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Field *string `json:"field"` + Values *[]string `json:"values"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Field == nil { + return fmt.Errorf("required field field missing") + } + if all.Values == nil { + return fmt.Errorf("required field values missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"field", "values"}) + } else { + return err + } + o.Field = *all.Field + o.Values = *all.Values + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_rule_data_attributes_request.go b/api/datadogV2/model_incident_rule_data_attributes_request.go new file mode 100644 index 00000000000..a2fab27fdfb --- /dev/null +++ b/api/datadogV2/model_incident_rule_data_attributes_request.go @@ -0,0 +1,435 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRuleDataAttributesRequest Attributes for creating an incident rule. +type IncidentRuleDataAttributesRequest struct { + // A query-based condition for an incident rule. + Condition IncidentRuleQueryCondition `json:"condition"` + // The condition table type. 1 = raw query. + ConditionTableType int32 `json:"condition_table_type"` + // List of field-based conditions. + Conditions []IncidentRuleCondition `json:"conditions,omitempty"` + // Whether the rule is enabled. + Enabled bool `json:"enabled"` + // The execution type of an incident rule. + ExecutionType IncidentRuleExecutionType `json:"execution_type"` + // The UUID of the incident type this rule applies to. + IncidentTypeUuid datadog.NullableUUID `json:"incident_type_uuid,omitempty"` + // Whether any condition (OR logic) should match instead of all (AND logic). + MatchAnyCondition *bool `json:"match_any_condition,omitempty"` + // The task ID for an incident rule. + TaskId IncidentRuleTaskIDType `json:"task_id"` + // The JSON-encoded payload for the task. + TaskPayload string `json:"task_payload"` + // The trigger event for an incident rule. + Trigger *IncidentRuleTriggerType `json:"trigger,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentRuleDataAttributesRequest instantiates a new IncidentRuleDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentRuleDataAttributesRequest(condition IncidentRuleQueryCondition, conditionTableType int32, enabled bool, executionType IncidentRuleExecutionType, taskId IncidentRuleTaskIDType, taskPayload string) *IncidentRuleDataAttributesRequest { + this := IncidentRuleDataAttributesRequest{} + this.Condition = condition + this.ConditionTableType = conditionTableType + this.Enabled = enabled + this.ExecutionType = executionType + this.TaskId = taskId + this.TaskPayload = taskPayload + return &this +} + +// NewIncidentRuleDataAttributesRequestWithDefaults instantiates a new IncidentRuleDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentRuleDataAttributesRequestWithDefaults() *IncidentRuleDataAttributesRequest { + this := IncidentRuleDataAttributesRequest{} + return &this +} + +// GetCondition returns the Condition field value. +func (o *IncidentRuleDataAttributesRequest) GetCondition() IncidentRuleQueryCondition { + if o == nil { + var ret IncidentRuleQueryCondition + return ret + } + return o.Condition +} + +// GetConditionOk returns a tuple with the Condition field value +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataAttributesRequest) GetConditionOk() (*IncidentRuleQueryCondition, bool) { + if o == nil { + return nil, false + } + return &o.Condition, true +} + +// SetCondition sets field value. +func (o *IncidentRuleDataAttributesRequest) SetCondition(v IncidentRuleQueryCondition) { + o.Condition = v +} + +// GetConditionTableType returns the ConditionTableType field value. +func (o *IncidentRuleDataAttributesRequest) GetConditionTableType() int32 { + if o == nil { + var ret int32 + return ret + } + return o.ConditionTableType +} + +// GetConditionTableTypeOk returns a tuple with the ConditionTableType field value +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataAttributesRequest) GetConditionTableTypeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ConditionTableType, true +} + +// SetConditionTableType sets field value. +func (o *IncidentRuleDataAttributesRequest) SetConditionTableType(v int32) { + o.ConditionTableType = v +} + +// GetConditions returns the Conditions field value if set, zero value otherwise. +func (o *IncidentRuleDataAttributesRequest) GetConditions() []IncidentRuleCondition { + if o == nil || o.Conditions == nil { + var ret []IncidentRuleCondition + return ret + } + return o.Conditions +} + +// GetConditionsOk returns a tuple with the Conditions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataAttributesRequest) GetConditionsOk() (*[]IncidentRuleCondition, bool) { + if o == nil || o.Conditions == nil { + return nil, false + } + return &o.Conditions, true +} + +// HasConditions returns a boolean if a field has been set. +func (o *IncidentRuleDataAttributesRequest) HasConditions() bool { + return o != nil && o.Conditions != nil +} + +// SetConditions gets a reference to the given []IncidentRuleCondition and assigns it to the Conditions field. +func (o *IncidentRuleDataAttributesRequest) SetConditions(v []IncidentRuleCondition) { + o.Conditions = v +} + +// GetEnabled returns the Enabled field value. +func (o *IncidentRuleDataAttributesRequest) GetEnabled() bool { + if o == nil { + var ret bool + return ret + } + return o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataAttributesRequest) GetEnabledOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Enabled, true +} + +// SetEnabled sets field value. +func (o *IncidentRuleDataAttributesRequest) SetEnabled(v bool) { + o.Enabled = v +} + +// GetExecutionType returns the ExecutionType field value. +func (o *IncidentRuleDataAttributesRequest) GetExecutionType() IncidentRuleExecutionType { + if o == nil { + var ret IncidentRuleExecutionType + return ret + } + return o.ExecutionType +} + +// GetExecutionTypeOk returns a tuple with the ExecutionType field value +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataAttributesRequest) GetExecutionTypeOk() (*IncidentRuleExecutionType, bool) { + if o == nil { + return nil, false + } + return &o.ExecutionType, true +} + +// SetExecutionType sets field value. +func (o *IncidentRuleDataAttributesRequest) SetExecutionType(v IncidentRuleExecutionType) { + o.ExecutionType = v +} + +// GetIncidentTypeUuid returns the IncidentTypeUuid field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentRuleDataAttributesRequest) GetIncidentTypeUuid() uuid.UUID { + if o == nil || o.IncidentTypeUuid.Get() == nil { + var ret uuid.UUID + return ret + } + return *o.IncidentTypeUuid.Get() +} + +// GetIncidentTypeUuidOk returns a tuple with the IncidentTypeUuid 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 *IncidentRuleDataAttributesRequest) GetIncidentTypeUuidOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return o.IncidentTypeUuid.Get(), o.IncidentTypeUuid.IsSet() +} + +// HasIncidentTypeUuid returns a boolean if a field has been set. +func (o *IncidentRuleDataAttributesRequest) HasIncidentTypeUuid() bool { + return o != nil && o.IncidentTypeUuid.IsSet() +} + +// SetIncidentTypeUuid gets a reference to the given datadog.NullableUUID and assigns it to the IncidentTypeUuid field. +func (o *IncidentRuleDataAttributesRequest) SetIncidentTypeUuid(v uuid.UUID) { + o.IncidentTypeUuid.Set(&v) +} + +// SetIncidentTypeUuidNil sets the value for IncidentTypeUuid to be an explicit nil. +func (o *IncidentRuleDataAttributesRequest) SetIncidentTypeUuidNil() { + o.IncidentTypeUuid.Set(nil) +} + +// UnsetIncidentTypeUuid ensures that no value is present for IncidentTypeUuid, not even an explicit nil. +func (o *IncidentRuleDataAttributesRequest) UnsetIncidentTypeUuid() { + o.IncidentTypeUuid.Unset() +} + +// GetMatchAnyCondition returns the MatchAnyCondition field value if set, zero value otherwise. +func (o *IncidentRuleDataAttributesRequest) GetMatchAnyCondition() bool { + if o == nil || o.MatchAnyCondition == nil { + var ret bool + return ret + } + return *o.MatchAnyCondition +} + +// GetMatchAnyConditionOk returns a tuple with the MatchAnyCondition field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataAttributesRequest) GetMatchAnyConditionOk() (*bool, bool) { + if o == nil || o.MatchAnyCondition == nil { + return nil, false + } + return o.MatchAnyCondition, true +} + +// HasMatchAnyCondition returns a boolean if a field has been set. +func (o *IncidentRuleDataAttributesRequest) HasMatchAnyCondition() bool { + return o != nil && o.MatchAnyCondition != nil +} + +// SetMatchAnyCondition gets a reference to the given bool and assigns it to the MatchAnyCondition field. +func (o *IncidentRuleDataAttributesRequest) SetMatchAnyCondition(v bool) { + o.MatchAnyCondition = &v +} + +// GetTaskId returns the TaskId field value. +func (o *IncidentRuleDataAttributesRequest) GetTaskId() IncidentRuleTaskIDType { + if o == nil { + var ret IncidentRuleTaskIDType + return ret + } + return o.TaskId +} + +// GetTaskIdOk returns a tuple with the TaskId field value +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataAttributesRequest) GetTaskIdOk() (*IncidentRuleTaskIDType, bool) { + if o == nil { + return nil, false + } + return &o.TaskId, true +} + +// SetTaskId sets field value. +func (o *IncidentRuleDataAttributesRequest) SetTaskId(v IncidentRuleTaskIDType) { + o.TaskId = v +} + +// GetTaskPayload returns the TaskPayload field value. +func (o *IncidentRuleDataAttributesRequest) GetTaskPayload() string { + if o == nil { + var ret string + return ret + } + return o.TaskPayload +} + +// GetTaskPayloadOk returns a tuple with the TaskPayload field value +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataAttributesRequest) GetTaskPayloadOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TaskPayload, true +} + +// SetTaskPayload sets field value. +func (o *IncidentRuleDataAttributesRequest) SetTaskPayload(v string) { + o.TaskPayload = v +} + +// GetTrigger returns the Trigger field value if set, zero value otherwise. +func (o *IncidentRuleDataAttributesRequest) GetTrigger() IncidentRuleTriggerType { + if o == nil || o.Trigger == nil { + var ret IncidentRuleTriggerType + return ret + } + return *o.Trigger +} + +// GetTriggerOk returns a tuple with the Trigger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataAttributesRequest) GetTriggerOk() (*IncidentRuleTriggerType, bool) { + if o == nil || o.Trigger == nil { + return nil, false + } + return o.Trigger, true +} + +// HasTrigger returns a boolean if a field has been set. +func (o *IncidentRuleDataAttributesRequest) HasTrigger() bool { + return o != nil && o.Trigger != nil +} + +// SetTrigger gets a reference to the given IncidentRuleTriggerType and assigns it to the Trigger field. +func (o *IncidentRuleDataAttributesRequest) SetTrigger(v IncidentRuleTriggerType) { + o.Trigger = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentRuleDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["condition"] = o.Condition + toSerialize["condition_table_type"] = o.ConditionTableType + if o.Conditions != nil { + toSerialize["conditions"] = o.Conditions + } + toSerialize["enabled"] = o.Enabled + toSerialize["execution_type"] = o.ExecutionType + if o.IncidentTypeUuid.IsSet() { + toSerialize["incident_type_uuid"] = o.IncidentTypeUuid.Get() + } + if o.MatchAnyCondition != nil { + toSerialize["match_any_condition"] = o.MatchAnyCondition + } + toSerialize["task_id"] = o.TaskId + toSerialize["task_payload"] = o.TaskPayload + if o.Trigger != nil { + toSerialize["trigger"] = o.Trigger + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentRuleDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Condition *IncidentRuleQueryCondition `json:"condition"` + ConditionTableType *int32 `json:"condition_table_type"` + Conditions []IncidentRuleCondition `json:"conditions,omitempty"` + Enabled *bool `json:"enabled"` + ExecutionType *IncidentRuleExecutionType `json:"execution_type"` + IncidentTypeUuid datadog.NullableUUID `json:"incident_type_uuid,omitempty"` + MatchAnyCondition *bool `json:"match_any_condition,omitempty"` + TaskId *IncidentRuleTaskIDType `json:"task_id"` + TaskPayload *string `json:"task_payload"` + Trigger *IncidentRuleTriggerType `json:"trigger,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Condition == nil { + return fmt.Errorf("required field condition missing") + } + if all.ConditionTableType == nil { + return fmt.Errorf("required field condition_table_type missing") + } + if all.Enabled == nil { + return fmt.Errorf("required field enabled missing") + } + if all.ExecutionType == nil { + return fmt.Errorf("required field execution_type missing") + } + if all.TaskId == nil { + return fmt.Errorf("required field task_id missing") + } + if all.TaskPayload == nil { + return fmt.Errorf("required field task_payload missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"condition", "condition_table_type", "conditions", "enabled", "execution_type", "incident_type_uuid", "match_any_condition", "task_id", "task_payload", "trigger"}) + } else { + return err + } + + hasInvalidField := false + if all.Condition.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Condition = *all.Condition + o.ConditionTableType = *all.ConditionTableType + o.Conditions = all.Conditions + o.Enabled = *all.Enabled + if !all.ExecutionType.IsValid() { + hasInvalidField = true + } else { + o.ExecutionType = *all.ExecutionType + } + o.IncidentTypeUuid = all.IncidentTypeUuid + o.MatchAnyCondition = all.MatchAnyCondition + if !all.TaskId.IsValid() { + hasInvalidField = true + } else { + o.TaskId = *all.TaskId + } + o.TaskPayload = *all.TaskPayload + if all.Trigger != nil && !all.Trigger.IsValid() { + hasInvalidField = true + } else { + o.Trigger = all.Trigger + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_rule_data_attributes_response.go b/api/datadogV2/model_incident_rule_data_attributes_response.go new file mode 100644 index 00000000000..0f38107af36 --- /dev/null +++ b/api/datadogV2/model_incident_rule_data_attributes_response.go @@ -0,0 +1,692 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "time" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRuleDataAttributesResponse Attributes of an incident rule in a response. +type IncidentRuleDataAttributesResponse struct { + // A query-based condition for an incident rule. + Condition *IncidentRuleQueryCondition `json:"condition,omitempty"` + // The condition table type. + ConditionTableType *int32 `json:"condition_table_type,omitempty"` + // List of field-based conditions. + Conditions []IncidentRuleCondition `json:"conditions,omitempty"` + // Timestamp when the rule was created. + Created *time.Time `json:"created,omitempty"` + // UUID of the user who created the rule. + CreatedByUuid *uuid.UUID `json:"created_by_uuid,omitempty"` + // Timestamp when the rule was deleted. + Deleted datadog.NullableTime `json:"deleted,omitempty"` + // Whether the rule is enabled. + Enabled *bool `json:"enabled,omitempty"` + // The execution type of the rule. + ExecutionType *int32 `json:"execution_type,omitempty"` + // The incident settings association UUID. + IncidentSettingsAssociationUuid datadog.NullableUUID `json:"incident_settings_association_uuid,omitempty"` + // Whether any condition should match. + MatchAnyCondition *bool `json:"match_any_condition,omitempty"` + // Timestamp when the rule was last modified. + Modified *time.Time `json:"modified,omitempty"` + // UUID of the user who last modified the rule. + ModifiedByUuid *uuid.UUID `json:"modified_by_uuid,omitempty"` + // The organization ID. + OrgId *int64 `json:"org_id,omitempty"` + // The task ID. + TaskId datadog.NullableString `json:"task_id,omitempty"` + // The JSON-encoded task payload. + TaskPayload datadog.NullableString `json:"task_payload,omitempty"` + // The trigger event for the rule. + Trigger *string `json:"trigger,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentRuleDataAttributesResponse instantiates a new IncidentRuleDataAttributesResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentRuleDataAttributesResponse() *IncidentRuleDataAttributesResponse { + this := IncidentRuleDataAttributesResponse{} + return &this +} + +// NewIncidentRuleDataAttributesResponseWithDefaults instantiates a new IncidentRuleDataAttributesResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentRuleDataAttributesResponseWithDefaults() *IncidentRuleDataAttributesResponse { + this := IncidentRuleDataAttributesResponse{} + return &this +} + +// GetCondition returns the Condition field value if set, zero value otherwise. +func (o *IncidentRuleDataAttributesResponse) GetCondition() IncidentRuleQueryCondition { + if o == nil || o.Condition == nil { + var ret IncidentRuleQueryCondition + 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 *IncidentRuleDataAttributesResponse) GetConditionOk() (*IncidentRuleQueryCondition, 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 *IncidentRuleDataAttributesResponse) HasCondition() bool { + return o != nil && o.Condition != nil +} + +// SetCondition gets a reference to the given IncidentRuleQueryCondition and assigns it to the Condition field. +func (o *IncidentRuleDataAttributesResponse) SetCondition(v IncidentRuleQueryCondition) { + o.Condition = &v +} + +// GetConditionTableType returns the ConditionTableType field value if set, zero value otherwise. +func (o *IncidentRuleDataAttributesResponse) GetConditionTableType() int32 { + if o == nil || o.ConditionTableType == nil { + var ret int32 + return ret + } + return *o.ConditionTableType +} + +// GetConditionTableTypeOk returns a tuple with the ConditionTableType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataAttributesResponse) GetConditionTableTypeOk() (*int32, bool) { + if o == nil || o.ConditionTableType == nil { + return nil, false + } + return o.ConditionTableType, true +} + +// HasConditionTableType returns a boolean if a field has been set. +func (o *IncidentRuleDataAttributesResponse) HasConditionTableType() bool { + return o != nil && o.ConditionTableType != nil +} + +// SetConditionTableType gets a reference to the given int32 and assigns it to the ConditionTableType field. +func (o *IncidentRuleDataAttributesResponse) SetConditionTableType(v int32) { + o.ConditionTableType = &v +} + +// GetConditions returns the Conditions field value if set, zero value otherwise. +func (o *IncidentRuleDataAttributesResponse) GetConditions() []IncidentRuleCondition { + if o == nil || o.Conditions == nil { + var ret []IncidentRuleCondition + return ret + } + return o.Conditions +} + +// GetConditionsOk returns a tuple with the Conditions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataAttributesResponse) GetConditionsOk() (*[]IncidentRuleCondition, bool) { + if o == nil || o.Conditions == nil { + return nil, false + } + return &o.Conditions, true +} + +// HasConditions returns a boolean if a field has been set. +func (o *IncidentRuleDataAttributesResponse) HasConditions() bool { + return o != nil && o.Conditions != nil +} + +// SetConditions gets a reference to the given []IncidentRuleCondition and assigns it to the Conditions field. +func (o *IncidentRuleDataAttributesResponse) SetConditions(v []IncidentRuleCondition) { + o.Conditions = v +} + +// GetCreated returns the Created field value if set, zero value otherwise. +func (o *IncidentRuleDataAttributesResponse) 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 *IncidentRuleDataAttributesResponse) 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 *IncidentRuleDataAttributesResponse) HasCreated() bool { + return o != nil && o.Created != nil +} + +// SetCreated gets a reference to the given time.Time and assigns it to the Created field. +func (o *IncidentRuleDataAttributesResponse) SetCreated(v time.Time) { + o.Created = &v +} + +// GetCreatedByUuid returns the CreatedByUuid field value if set, zero value otherwise. +func (o *IncidentRuleDataAttributesResponse) GetCreatedByUuid() uuid.UUID { + if o == nil || o.CreatedByUuid == nil { + var ret uuid.UUID + return ret + } + return *o.CreatedByUuid +} + +// GetCreatedByUuidOk returns a tuple with the CreatedByUuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataAttributesResponse) GetCreatedByUuidOk() (*uuid.UUID, bool) { + if o == nil || o.CreatedByUuid == nil { + return nil, false + } + return o.CreatedByUuid, true +} + +// HasCreatedByUuid returns a boolean if a field has been set. +func (o *IncidentRuleDataAttributesResponse) HasCreatedByUuid() bool { + return o != nil && o.CreatedByUuid != nil +} + +// SetCreatedByUuid gets a reference to the given uuid.UUID and assigns it to the CreatedByUuid field. +func (o *IncidentRuleDataAttributesResponse) SetCreatedByUuid(v uuid.UUID) { + o.CreatedByUuid = &v +} + +// GetDeleted returns the Deleted field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentRuleDataAttributesResponse) 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 *IncidentRuleDataAttributesResponse) 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 *IncidentRuleDataAttributesResponse) HasDeleted() bool { + return o != nil && o.Deleted.IsSet() +} + +// SetDeleted gets a reference to the given datadog.NullableTime and assigns it to the Deleted field. +func (o *IncidentRuleDataAttributesResponse) SetDeleted(v time.Time) { + o.Deleted.Set(&v) +} + +// SetDeletedNil sets the value for Deleted to be an explicit nil. +func (o *IncidentRuleDataAttributesResponse) SetDeletedNil() { + o.Deleted.Set(nil) +} + +// UnsetDeleted ensures that no value is present for Deleted, not even an explicit nil. +func (o *IncidentRuleDataAttributesResponse) UnsetDeleted() { + o.Deleted.Unset() +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *IncidentRuleDataAttributesResponse) 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 *IncidentRuleDataAttributesResponse) 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 *IncidentRuleDataAttributesResponse) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *IncidentRuleDataAttributesResponse) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetExecutionType returns the ExecutionType field value if set, zero value otherwise. +func (o *IncidentRuleDataAttributesResponse) GetExecutionType() int32 { + if o == nil || o.ExecutionType == nil { + var ret int32 + return ret + } + return *o.ExecutionType +} + +// GetExecutionTypeOk returns a tuple with the ExecutionType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataAttributesResponse) GetExecutionTypeOk() (*int32, bool) { + if o == nil || o.ExecutionType == nil { + return nil, false + } + return o.ExecutionType, true +} + +// HasExecutionType returns a boolean if a field has been set. +func (o *IncidentRuleDataAttributesResponse) HasExecutionType() bool { + return o != nil && o.ExecutionType != nil +} + +// SetExecutionType gets a reference to the given int32 and assigns it to the ExecutionType field. +func (o *IncidentRuleDataAttributesResponse) SetExecutionType(v int32) { + o.ExecutionType = &v +} + +// GetIncidentSettingsAssociationUuid returns the IncidentSettingsAssociationUuid field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentRuleDataAttributesResponse) GetIncidentSettingsAssociationUuid() uuid.UUID { + if o == nil || o.IncidentSettingsAssociationUuid.Get() == nil { + var ret uuid.UUID + return ret + } + return *o.IncidentSettingsAssociationUuid.Get() +} + +// GetIncidentSettingsAssociationUuidOk returns a tuple with the IncidentSettingsAssociationUuid 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 *IncidentRuleDataAttributesResponse) GetIncidentSettingsAssociationUuidOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return o.IncidentSettingsAssociationUuid.Get(), o.IncidentSettingsAssociationUuid.IsSet() +} + +// HasIncidentSettingsAssociationUuid returns a boolean if a field has been set. +func (o *IncidentRuleDataAttributesResponse) HasIncidentSettingsAssociationUuid() bool { + return o != nil && o.IncidentSettingsAssociationUuid.IsSet() +} + +// SetIncidentSettingsAssociationUuid gets a reference to the given datadog.NullableUUID and assigns it to the IncidentSettingsAssociationUuid field. +func (o *IncidentRuleDataAttributesResponse) SetIncidentSettingsAssociationUuid(v uuid.UUID) { + o.IncidentSettingsAssociationUuid.Set(&v) +} + +// SetIncidentSettingsAssociationUuidNil sets the value for IncidentSettingsAssociationUuid to be an explicit nil. +func (o *IncidentRuleDataAttributesResponse) SetIncidentSettingsAssociationUuidNil() { + o.IncidentSettingsAssociationUuid.Set(nil) +} + +// UnsetIncidentSettingsAssociationUuid ensures that no value is present for IncidentSettingsAssociationUuid, not even an explicit nil. +func (o *IncidentRuleDataAttributesResponse) UnsetIncidentSettingsAssociationUuid() { + o.IncidentSettingsAssociationUuid.Unset() +} + +// GetMatchAnyCondition returns the MatchAnyCondition field value if set, zero value otherwise. +func (o *IncidentRuleDataAttributesResponse) GetMatchAnyCondition() bool { + if o == nil || o.MatchAnyCondition == nil { + var ret bool + return ret + } + return *o.MatchAnyCondition +} + +// GetMatchAnyConditionOk returns a tuple with the MatchAnyCondition field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataAttributesResponse) GetMatchAnyConditionOk() (*bool, bool) { + if o == nil || o.MatchAnyCondition == nil { + return nil, false + } + return o.MatchAnyCondition, true +} + +// HasMatchAnyCondition returns a boolean if a field has been set. +func (o *IncidentRuleDataAttributesResponse) HasMatchAnyCondition() bool { + return o != nil && o.MatchAnyCondition != nil +} + +// SetMatchAnyCondition gets a reference to the given bool and assigns it to the MatchAnyCondition field. +func (o *IncidentRuleDataAttributesResponse) SetMatchAnyCondition(v bool) { + o.MatchAnyCondition = &v +} + +// GetModified returns the Modified field value if set, zero value otherwise. +func (o *IncidentRuleDataAttributesResponse) 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 *IncidentRuleDataAttributesResponse) 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 *IncidentRuleDataAttributesResponse) HasModified() bool { + return o != nil && o.Modified != nil +} + +// SetModified gets a reference to the given time.Time and assigns it to the Modified field. +func (o *IncidentRuleDataAttributesResponse) SetModified(v time.Time) { + o.Modified = &v +} + +// GetModifiedByUuid returns the ModifiedByUuid field value if set, zero value otherwise. +func (o *IncidentRuleDataAttributesResponse) GetModifiedByUuid() uuid.UUID { + if o == nil || o.ModifiedByUuid == nil { + var ret uuid.UUID + return ret + } + return *o.ModifiedByUuid +} + +// GetModifiedByUuidOk returns a tuple with the ModifiedByUuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataAttributesResponse) GetModifiedByUuidOk() (*uuid.UUID, bool) { + if o == nil || o.ModifiedByUuid == nil { + return nil, false + } + return o.ModifiedByUuid, true +} + +// HasModifiedByUuid returns a boolean if a field has been set. +func (o *IncidentRuleDataAttributesResponse) HasModifiedByUuid() bool { + return o != nil && o.ModifiedByUuid != nil +} + +// SetModifiedByUuid gets a reference to the given uuid.UUID and assigns it to the ModifiedByUuid field. +func (o *IncidentRuleDataAttributesResponse) SetModifiedByUuid(v uuid.UUID) { + o.ModifiedByUuid = &v +} + +// GetOrgId returns the OrgId field value if set, zero value otherwise. +func (o *IncidentRuleDataAttributesResponse) 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 *IncidentRuleDataAttributesResponse) 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 *IncidentRuleDataAttributesResponse) HasOrgId() bool { + return o != nil && o.OrgId != nil +} + +// SetOrgId gets a reference to the given int64 and assigns it to the OrgId field. +func (o *IncidentRuleDataAttributesResponse) SetOrgId(v int64) { + o.OrgId = &v +} + +// GetTaskId returns the TaskId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentRuleDataAttributesResponse) GetTaskId() string { + if o == nil || o.TaskId.Get() == nil { + var ret string + return ret + } + return *o.TaskId.Get() +} + +// GetTaskIdOk returns a tuple with the TaskId 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 *IncidentRuleDataAttributesResponse) GetTaskIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.TaskId.Get(), o.TaskId.IsSet() +} + +// HasTaskId returns a boolean if a field has been set. +func (o *IncidentRuleDataAttributesResponse) HasTaskId() bool { + return o != nil && o.TaskId.IsSet() +} + +// SetTaskId gets a reference to the given datadog.NullableString and assigns it to the TaskId field. +func (o *IncidentRuleDataAttributesResponse) SetTaskId(v string) { + o.TaskId.Set(&v) +} + +// SetTaskIdNil sets the value for TaskId to be an explicit nil. +func (o *IncidentRuleDataAttributesResponse) SetTaskIdNil() { + o.TaskId.Set(nil) +} + +// UnsetTaskId ensures that no value is present for TaskId, not even an explicit nil. +func (o *IncidentRuleDataAttributesResponse) UnsetTaskId() { + o.TaskId.Unset() +} + +// GetTaskPayload returns the TaskPayload field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentRuleDataAttributesResponse) GetTaskPayload() string { + if o == nil || o.TaskPayload.Get() == nil { + var ret string + return ret + } + return *o.TaskPayload.Get() +} + +// GetTaskPayloadOk returns a tuple with the TaskPayload 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 *IncidentRuleDataAttributesResponse) GetTaskPayloadOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.TaskPayload.Get(), o.TaskPayload.IsSet() +} + +// HasTaskPayload returns a boolean if a field has been set. +func (o *IncidentRuleDataAttributesResponse) HasTaskPayload() bool { + return o != nil && o.TaskPayload.IsSet() +} + +// SetTaskPayload gets a reference to the given datadog.NullableString and assigns it to the TaskPayload field. +func (o *IncidentRuleDataAttributesResponse) SetTaskPayload(v string) { + o.TaskPayload.Set(&v) +} + +// SetTaskPayloadNil sets the value for TaskPayload to be an explicit nil. +func (o *IncidentRuleDataAttributesResponse) SetTaskPayloadNil() { + o.TaskPayload.Set(nil) +} + +// UnsetTaskPayload ensures that no value is present for TaskPayload, not even an explicit nil. +func (o *IncidentRuleDataAttributesResponse) UnsetTaskPayload() { + o.TaskPayload.Unset() +} + +// GetTrigger returns the Trigger field value if set, zero value otherwise. +func (o *IncidentRuleDataAttributesResponse) GetTrigger() string { + if o == nil || o.Trigger == nil { + var ret string + return ret + } + return *o.Trigger +} + +// GetTriggerOk returns a tuple with the Trigger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataAttributesResponse) GetTriggerOk() (*string, bool) { + if o == nil || o.Trigger == nil { + return nil, false + } + return o.Trigger, true +} + +// HasTrigger returns a boolean if a field has been set. +func (o *IncidentRuleDataAttributesResponse) HasTrigger() bool { + return o != nil && o.Trigger != nil +} + +// SetTrigger gets a reference to the given string and assigns it to the Trigger field. +func (o *IncidentRuleDataAttributesResponse) SetTrigger(v string) { + o.Trigger = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentRuleDataAttributesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Condition != nil { + toSerialize["condition"] = o.Condition + } + if o.ConditionTableType != nil { + toSerialize["condition_table_type"] = o.ConditionTableType + } + if o.Conditions != nil { + toSerialize["conditions"] = o.Conditions + } + 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.CreatedByUuid != nil { + toSerialize["created_by_uuid"] = o.CreatedByUuid + } + if o.Deleted.IsSet() { + toSerialize["deleted"] = o.Deleted.Get() + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.ExecutionType != nil { + toSerialize["execution_type"] = o.ExecutionType + } + if o.IncidentSettingsAssociationUuid.IsSet() { + toSerialize["incident_settings_association_uuid"] = o.IncidentSettingsAssociationUuid.Get() + } + if o.MatchAnyCondition != nil { + toSerialize["match_any_condition"] = o.MatchAnyCondition + } + 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.ModifiedByUuid != nil { + toSerialize["modified_by_uuid"] = o.ModifiedByUuid + } + if o.OrgId != nil { + toSerialize["org_id"] = o.OrgId + } + if o.TaskId.IsSet() { + toSerialize["task_id"] = o.TaskId.Get() + } + if o.TaskPayload.IsSet() { + toSerialize["task_payload"] = o.TaskPayload.Get() + } + if o.Trigger != nil { + toSerialize["trigger"] = o.Trigger + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentRuleDataAttributesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Condition *IncidentRuleQueryCondition `json:"condition,omitempty"` + ConditionTableType *int32 `json:"condition_table_type,omitempty"` + Conditions []IncidentRuleCondition `json:"conditions,omitempty"` + Created *time.Time `json:"created,omitempty"` + CreatedByUuid *uuid.UUID `json:"created_by_uuid,omitempty"` + Deleted datadog.NullableTime `json:"deleted,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + ExecutionType *int32 `json:"execution_type,omitempty"` + IncidentSettingsAssociationUuid datadog.NullableUUID `json:"incident_settings_association_uuid,omitempty"` + MatchAnyCondition *bool `json:"match_any_condition,omitempty"` + Modified *time.Time `json:"modified,omitempty"` + ModifiedByUuid *uuid.UUID `json:"modified_by_uuid,omitempty"` + OrgId *int64 `json:"org_id,omitempty"` + TaskId datadog.NullableString `json:"task_id,omitempty"` + TaskPayload datadog.NullableString `json:"task_payload,omitempty"` + Trigger *string `json:"trigger,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"condition", "condition_table_type", "conditions", "created", "created_by_uuid", "deleted", "enabled", "execution_type", "incident_settings_association_uuid", "match_any_condition", "modified", "modified_by_uuid", "org_id", "task_id", "task_payload", "trigger"}) + } else { + return err + } + + hasInvalidField := false + if all.Condition != nil && all.Condition.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Condition = all.Condition + o.ConditionTableType = all.ConditionTableType + o.Conditions = all.Conditions + o.Created = all.Created + o.CreatedByUuid = all.CreatedByUuid + o.Deleted = all.Deleted + o.Enabled = all.Enabled + o.ExecutionType = all.ExecutionType + o.IncidentSettingsAssociationUuid = all.IncidentSettingsAssociationUuid + o.MatchAnyCondition = all.MatchAnyCondition + o.Modified = all.Modified + o.ModifiedByUuid = all.ModifiedByUuid + o.OrgId = all.OrgId + o.TaskId = all.TaskId + o.TaskPayload = all.TaskPayload + o.Trigger = all.Trigger + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_rule_data_request.go b/api/datadogV2/model_incident_rule_data_request.go new file mode 100644 index 00000000000..9d81f121e37 --- /dev/null +++ b/api/datadogV2/model_incident_rule_data_request.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRuleDataRequest Incident rule data in a create request. +type IncidentRuleDataRequest struct { + // Attributes for creating an incident rule. + Attributes IncidentRuleDataAttributesRequest `json:"attributes"` + // Incident rule resource type. + Type IncidentRuleType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentRuleDataRequest instantiates a new IncidentRuleDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentRuleDataRequest(attributes IncidentRuleDataAttributesRequest, typeVar IncidentRuleType) *IncidentRuleDataRequest { + this := IncidentRuleDataRequest{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewIncidentRuleDataRequestWithDefaults instantiates a new IncidentRuleDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentRuleDataRequestWithDefaults() *IncidentRuleDataRequest { + this := IncidentRuleDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentRuleDataRequest) GetAttributes() IncidentRuleDataAttributesRequest { + if o == nil { + var ret IncidentRuleDataAttributesRequest + 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 *IncidentRuleDataRequest) GetAttributesOk() (*IncidentRuleDataAttributesRequest, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentRuleDataRequest) SetAttributes(v IncidentRuleDataAttributesRequest) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *IncidentRuleDataRequest) GetType() IncidentRuleType { + if o == nil { + var ret IncidentRuleType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataRequest) GetTypeOk() (*IncidentRuleType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentRuleDataRequest) SetType(v IncidentRuleType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentRuleDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentRuleDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentRuleDataAttributesRequest `json:"attributes"` + Type *IncidentRuleType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_rule_data_response.go b/api/datadogV2/model_incident_rule_data_response.go new file mode 100644 index 00000000000..5afef76cfa9 --- /dev/null +++ b/api/datadogV2/model_incident_rule_data_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 datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRuleDataResponse Incident rule data in a response. +type IncidentRuleDataResponse struct { + // Attributes of an incident rule in a response. + Attributes IncidentRuleDataAttributesResponse `json:"attributes"` + // The rule identifier. + Id uuid.UUID `json:"id"` + // Incident rule response resource type. + Type IncidentRuleResponseType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentRuleDataResponse instantiates a new IncidentRuleDataResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentRuleDataResponse(attributes IncidentRuleDataAttributesResponse, id uuid.UUID, typeVar IncidentRuleResponseType) *IncidentRuleDataResponse { + this := IncidentRuleDataResponse{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentRuleDataResponseWithDefaults instantiates a new IncidentRuleDataResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentRuleDataResponseWithDefaults() *IncidentRuleDataResponse { + this := IncidentRuleDataResponse{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentRuleDataResponse) GetAttributes() IncidentRuleDataAttributesResponse { + if o == nil { + var ret IncidentRuleDataAttributesResponse + 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 *IncidentRuleDataResponse) GetAttributesOk() (*IncidentRuleDataAttributesResponse, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentRuleDataResponse) SetAttributes(v IncidentRuleDataAttributesResponse) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *IncidentRuleDataResponse) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentRuleDataResponse) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentRuleDataResponse) SetId(v uuid.UUID) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *IncidentRuleDataResponse) GetType() IncidentRuleResponseType { + if o == nil { + var ret IncidentRuleResponseType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentRuleDataResponse) GetTypeOk() (*IncidentRuleResponseType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentRuleDataResponse) SetType(v IncidentRuleResponseType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentRuleDataResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentRuleDataResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentRuleDataAttributesResponse `json:"attributes"` + Id *uuid.UUID `json:"id"` + Type *IncidentRuleResponseType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_rule_execution_type.go b/api/datadogV2/model_incident_rule_execution_type.go new file mode 100644 index 00000000000..f836e01012b --- /dev/null +++ b/api/datadogV2/model_incident_rule_execution_type.go @@ -0,0 +1,66 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRuleExecutionType The execution type of an incident rule. +type IncidentRuleExecutionType int64 + +// List of IncidentRuleExecutionType. +const ( + INCIDENTRULEEXECUTIONTYPE_SINGLE_EXECUTION IncidentRuleExecutionType = 1 + INCIDENTRULEEXECUTIONTYPE_MULTI_EXECUTION IncidentRuleExecutionType = 2 +) + +var allowedIncidentRuleExecutionTypeEnumValues = []IncidentRuleExecutionType{ + INCIDENTRULEEXECUTIONTYPE_SINGLE_EXECUTION, + INCIDENTRULEEXECUTIONTYPE_MULTI_EXECUTION, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentRuleExecutionType) GetAllowedValues() []IncidentRuleExecutionType { + return allowedIncidentRuleExecutionTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentRuleExecutionType) UnmarshalJSON(src []byte) error { + var value int64 + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentRuleExecutionType(value) + return nil +} + +// NewIncidentRuleExecutionTypeFromValue returns a pointer to a valid IncidentRuleExecutionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentRuleExecutionTypeFromValue(v int64) (*IncidentRuleExecutionType, error) { + ev := IncidentRuleExecutionType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentRuleExecutionType: valid values are %v", v, allowedIncidentRuleExecutionTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentRuleExecutionType) IsValid() bool { + for _, existing := range allowedIncidentRuleExecutionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentRuleExecutionType value. +func (v IncidentRuleExecutionType) Ptr() *IncidentRuleExecutionType { + return &v +} diff --git a/api/datadogV2/model_incident_rule_patch_data_attributes_request.go b/api/datadogV2/model_incident_rule_patch_data_attributes_request.go new file mode 100644 index 00000000000..863acd7f13b --- /dev/null +++ b/api/datadogV2/model_incident_rule_patch_data_attributes_request.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRulePatchDataAttributesRequest Attributes for patching an incident rule. All fields are optional. +type IncidentRulePatchDataAttributesRequest struct { + // A query-based condition for an incident rule. + Condition *IncidentRuleQueryCondition `json:"condition,omitempty"` + // List of field-based conditions. + Conditions []IncidentRuleCondition `json:"conditions,omitempty"` + // Whether the rule is enabled. + Enabled *bool `json:"enabled,omitempty"` + // The JSON-encoded payload for the task. + TaskPayload *string `json:"task_payload,omitempty"` + // The trigger event for an incident rule. + Trigger *IncidentRuleTriggerType `json:"trigger,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentRulePatchDataAttributesRequest instantiates a new IncidentRulePatchDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentRulePatchDataAttributesRequest() *IncidentRulePatchDataAttributesRequest { + this := IncidentRulePatchDataAttributesRequest{} + return &this +} + +// NewIncidentRulePatchDataAttributesRequestWithDefaults instantiates a new IncidentRulePatchDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentRulePatchDataAttributesRequestWithDefaults() *IncidentRulePatchDataAttributesRequest { + this := IncidentRulePatchDataAttributesRequest{} + return &this +} + +// GetCondition returns the Condition field value if set, zero value otherwise. +func (o *IncidentRulePatchDataAttributesRequest) GetCondition() IncidentRuleQueryCondition { + if o == nil || o.Condition == nil { + var ret IncidentRuleQueryCondition + 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 *IncidentRulePatchDataAttributesRequest) GetConditionOk() (*IncidentRuleQueryCondition, 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 *IncidentRulePatchDataAttributesRequest) HasCondition() bool { + return o != nil && o.Condition != nil +} + +// SetCondition gets a reference to the given IncidentRuleQueryCondition and assigns it to the Condition field. +func (o *IncidentRulePatchDataAttributesRequest) SetCondition(v IncidentRuleQueryCondition) { + o.Condition = &v +} + +// GetConditions returns the Conditions field value if set, zero value otherwise. +func (o *IncidentRulePatchDataAttributesRequest) GetConditions() []IncidentRuleCondition { + if o == nil || o.Conditions == nil { + var ret []IncidentRuleCondition + return ret + } + return o.Conditions +} + +// GetConditionsOk returns a tuple with the Conditions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentRulePatchDataAttributesRequest) GetConditionsOk() (*[]IncidentRuleCondition, bool) { + if o == nil || o.Conditions == nil { + return nil, false + } + return &o.Conditions, true +} + +// HasConditions returns a boolean if a field has been set. +func (o *IncidentRulePatchDataAttributesRequest) HasConditions() bool { + return o != nil && o.Conditions != nil +} + +// SetConditions gets a reference to the given []IncidentRuleCondition and assigns it to the Conditions field. +func (o *IncidentRulePatchDataAttributesRequest) SetConditions(v []IncidentRuleCondition) { + o.Conditions = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *IncidentRulePatchDataAttributesRequest) 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 *IncidentRulePatchDataAttributesRequest) 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 *IncidentRulePatchDataAttributesRequest) HasEnabled() bool { + return o != nil && o.Enabled != nil +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *IncidentRulePatchDataAttributesRequest) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetTaskPayload returns the TaskPayload field value if set, zero value otherwise. +func (o *IncidentRulePatchDataAttributesRequest) GetTaskPayload() string { + if o == nil || o.TaskPayload == nil { + var ret string + return ret + } + return *o.TaskPayload +} + +// GetTaskPayloadOk returns a tuple with the TaskPayload field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentRulePatchDataAttributesRequest) GetTaskPayloadOk() (*string, bool) { + if o == nil || o.TaskPayload == nil { + return nil, false + } + return o.TaskPayload, true +} + +// HasTaskPayload returns a boolean if a field has been set. +func (o *IncidentRulePatchDataAttributesRequest) HasTaskPayload() bool { + return o != nil && o.TaskPayload != nil +} + +// SetTaskPayload gets a reference to the given string and assigns it to the TaskPayload field. +func (o *IncidentRulePatchDataAttributesRequest) SetTaskPayload(v string) { + o.TaskPayload = &v +} + +// GetTrigger returns the Trigger field value if set, zero value otherwise. +func (o *IncidentRulePatchDataAttributesRequest) GetTrigger() IncidentRuleTriggerType { + if o == nil || o.Trigger == nil { + var ret IncidentRuleTriggerType + return ret + } + return *o.Trigger +} + +// GetTriggerOk returns a tuple with the Trigger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentRulePatchDataAttributesRequest) GetTriggerOk() (*IncidentRuleTriggerType, bool) { + if o == nil || o.Trigger == nil { + return nil, false + } + return o.Trigger, true +} + +// HasTrigger returns a boolean if a field has been set. +func (o *IncidentRulePatchDataAttributesRequest) HasTrigger() bool { + return o != nil && o.Trigger != nil +} + +// SetTrigger gets a reference to the given IncidentRuleTriggerType and assigns it to the Trigger field. +func (o *IncidentRulePatchDataAttributesRequest) SetTrigger(v IncidentRuleTriggerType) { + o.Trigger = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentRulePatchDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Condition != nil { + toSerialize["condition"] = o.Condition + } + if o.Conditions != nil { + toSerialize["conditions"] = o.Conditions + } + if o.Enabled != nil { + toSerialize["enabled"] = o.Enabled + } + if o.TaskPayload != nil { + toSerialize["task_payload"] = o.TaskPayload + } + if o.Trigger != nil { + toSerialize["trigger"] = o.Trigger + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentRulePatchDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Condition *IncidentRuleQueryCondition `json:"condition,omitempty"` + Conditions []IncidentRuleCondition `json:"conditions,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + TaskPayload *string `json:"task_payload,omitempty"` + Trigger *IncidentRuleTriggerType `json:"trigger,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"condition", "conditions", "enabled", "task_payload", "trigger"}) + } else { + return err + } + + hasInvalidField := false + if all.Condition != nil && all.Condition.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Condition = all.Condition + o.Conditions = all.Conditions + o.Enabled = all.Enabled + o.TaskPayload = all.TaskPayload + if all.Trigger != nil && !all.Trigger.IsValid() { + hasInvalidField = true + } else { + o.Trigger = all.Trigger + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_rule_patch_data_request.go b/api/datadogV2/model_incident_rule_patch_data_request.go new file mode 100644 index 00000000000..b47ff201853 --- /dev/null +++ b/api/datadogV2/model_incident_rule_patch_data_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 datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRulePatchDataRequest Incident rule data in a patch request. +type IncidentRulePatchDataRequest struct { + // Attributes for patching an incident rule. All fields are optional. + Attributes *IncidentRulePatchDataAttributesRequest `json:"attributes,omitempty"` + // The rule identifier. + Id uuid.UUID `json:"id"` + // Incident rule resource type. + Type IncidentRuleType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentRulePatchDataRequest instantiates a new IncidentRulePatchDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentRulePatchDataRequest(id uuid.UUID, typeVar IncidentRuleType) *IncidentRulePatchDataRequest { + this := IncidentRulePatchDataRequest{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentRulePatchDataRequestWithDefaults instantiates a new IncidentRulePatchDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentRulePatchDataRequestWithDefaults() *IncidentRulePatchDataRequest { + this := IncidentRulePatchDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *IncidentRulePatchDataRequest) GetAttributes() IncidentRulePatchDataAttributesRequest { + if o == nil || o.Attributes == nil { + var ret IncidentRulePatchDataAttributesRequest + 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 *IncidentRulePatchDataRequest) GetAttributesOk() (*IncidentRulePatchDataAttributesRequest, 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 *IncidentRulePatchDataRequest) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given IncidentRulePatchDataAttributesRequest and assigns it to the Attributes field. +func (o *IncidentRulePatchDataRequest) SetAttributes(v IncidentRulePatchDataAttributesRequest) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *IncidentRulePatchDataRequest) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentRulePatchDataRequest) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentRulePatchDataRequest) SetId(v uuid.UUID) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *IncidentRulePatchDataRequest) GetType() IncidentRuleType { + if o == nil { + var ret IncidentRuleType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentRulePatchDataRequest) GetTypeOk() (*IncidentRuleType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentRulePatchDataRequest) SetType(v IncidentRuleType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentRulePatchDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentRulePatchDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentRulePatchDataAttributesRequest `json:"attributes,omitempty"` + Id *uuid.UUID `json:"id"` + Type *IncidentRuleType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_rule_patch_request.go b/api/datadogV2/model_incident_rule_patch_request.go new file mode 100644 index 00000000000..3e25d268798 --- /dev/null +++ b/api/datadogV2/model_incident_rule_patch_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRulePatchRequest Request payload for patching an incident rule. +type IncidentRulePatchRequest struct { + // Incident rule data in a patch request. + Data IncidentRulePatchDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentRulePatchRequest instantiates a new IncidentRulePatchRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentRulePatchRequest(data IncidentRulePatchDataRequest) *IncidentRulePatchRequest { + this := IncidentRulePatchRequest{} + this.Data = data + return &this +} + +// NewIncidentRulePatchRequestWithDefaults instantiates a new IncidentRulePatchRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentRulePatchRequestWithDefaults() *IncidentRulePatchRequest { + this := IncidentRulePatchRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentRulePatchRequest) GetData() IncidentRulePatchDataRequest { + if o == nil { + var ret IncidentRulePatchDataRequest + 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 *IncidentRulePatchRequest) GetDataOk() (*IncidentRulePatchDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentRulePatchRequest) SetData(v IncidentRulePatchDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentRulePatchRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentRulePatchRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentRulePatchDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_rule_query_condition.go b/api/datadogV2/model_incident_rule_query_condition.go new file mode 100644 index 00000000000..80194ef87cf --- /dev/null +++ b/api/datadogV2/model_incident_rule_query_condition.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRuleQueryCondition A query-based condition for an incident rule. +type IncidentRuleQueryCondition struct { + // The normalized query string. + NormalizedQuery datadog.NullableString `json:"normalized_query,omitempty"` + // The raw query string. + RawQuery datadog.NullableString `json:"raw_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{} `json:"-"` +} + +// NewIncidentRuleQueryCondition instantiates a new IncidentRuleQueryCondition object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentRuleQueryCondition() *IncidentRuleQueryCondition { + this := IncidentRuleQueryCondition{} + return &this +} + +// NewIncidentRuleQueryConditionWithDefaults instantiates a new IncidentRuleQueryCondition object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentRuleQueryConditionWithDefaults() *IncidentRuleQueryCondition { + this := IncidentRuleQueryCondition{} + return &this +} + +// GetNormalizedQuery returns the NormalizedQuery field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentRuleQueryCondition) GetNormalizedQuery() string { + if o == nil || o.NormalizedQuery.Get() == nil { + var ret string + return ret + } + return *o.NormalizedQuery.Get() +} + +// GetNormalizedQueryOk returns a tuple with the NormalizedQuery 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 *IncidentRuleQueryCondition) GetNormalizedQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.NormalizedQuery.Get(), o.NormalizedQuery.IsSet() +} + +// HasNormalizedQuery returns a boolean if a field has been set. +func (o *IncidentRuleQueryCondition) HasNormalizedQuery() bool { + return o != nil && o.NormalizedQuery.IsSet() +} + +// SetNormalizedQuery gets a reference to the given datadog.NullableString and assigns it to the NormalizedQuery field. +func (o *IncidentRuleQueryCondition) SetNormalizedQuery(v string) { + o.NormalizedQuery.Set(&v) +} + +// SetNormalizedQueryNil sets the value for NormalizedQuery to be an explicit nil. +func (o *IncidentRuleQueryCondition) SetNormalizedQueryNil() { + o.NormalizedQuery.Set(nil) +} + +// UnsetNormalizedQuery ensures that no value is present for NormalizedQuery, not even an explicit nil. +func (o *IncidentRuleQueryCondition) UnsetNormalizedQuery() { + o.NormalizedQuery.Unset() +} + +// GetRawQuery returns the RawQuery field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentRuleQueryCondition) GetRawQuery() string { + if o == nil || o.RawQuery.Get() == nil { + var ret string + return ret + } + return *o.RawQuery.Get() +} + +// GetRawQueryOk returns a tuple with the RawQuery 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 *IncidentRuleQueryCondition) GetRawQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.RawQuery.Get(), o.RawQuery.IsSet() +} + +// HasRawQuery returns a boolean if a field has been set. +func (o *IncidentRuleQueryCondition) HasRawQuery() bool { + return o != nil && o.RawQuery.IsSet() +} + +// SetRawQuery gets a reference to the given datadog.NullableString and assigns it to the RawQuery field. +func (o *IncidentRuleQueryCondition) SetRawQuery(v string) { + o.RawQuery.Set(&v) +} + +// SetRawQueryNil sets the value for RawQuery to be an explicit nil. +func (o *IncidentRuleQueryCondition) SetRawQueryNil() { + o.RawQuery.Set(nil) +} + +// UnsetRawQuery ensures that no value is present for RawQuery, not even an explicit nil. +func (o *IncidentRuleQueryCondition) UnsetRawQuery() { + o.RawQuery.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentRuleQueryCondition) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.NormalizedQuery.IsSet() { + toSerialize["normalized_query"] = o.NormalizedQuery.Get() + } + if o.RawQuery.IsSet() { + toSerialize["raw_query"] = o.RawQuery.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentRuleQueryCondition) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + NormalizedQuery datadog.NullableString `json:"normalized_query,omitempty"` + RawQuery datadog.NullableString `json:"raw_query,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"normalized_query", "raw_query"}) + } else { + return err + } + o.NormalizedQuery = all.NormalizedQuery + o.RawQuery = all.RawQuery + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_rule_request.go b/api/datadogV2/model_incident_rule_request.go new file mode 100644 index 00000000000..ef9c8be3a16 --- /dev/null +++ b/api/datadogV2/model_incident_rule_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRuleRequest Request payload for creating an incident rule. +type IncidentRuleRequest struct { + // Incident rule data in a create request. + Data IncidentRuleDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentRuleRequest instantiates a new IncidentRuleRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentRuleRequest(data IncidentRuleDataRequest) *IncidentRuleRequest { + this := IncidentRuleRequest{} + this.Data = data + return &this +} + +// NewIncidentRuleRequestWithDefaults instantiates a new IncidentRuleRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentRuleRequestWithDefaults() *IncidentRuleRequest { + this := IncidentRuleRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentRuleRequest) GetData() IncidentRuleDataRequest { + if o == nil { + var ret IncidentRuleDataRequest + 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 *IncidentRuleRequest) GetDataOk() (*IncidentRuleDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentRuleRequest) SetData(v IncidentRuleDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentRuleRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentRuleRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentRuleDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_rule_response.go b/api/datadogV2/model_incident_rule_response.go new file mode 100644 index 00000000000..54020c73ae8 --- /dev/null +++ b/api/datadogV2/model_incident_rule_response.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRuleResponse Response with a single incident rule. +type IncidentRuleResponse struct { + // Incident rule data in a response. + Data IncidentRuleDataResponse `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentRuleResponse instantiates a new IncidentRuleResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentRuleResponse(data IncidentRuleDataResponse) *IncidentRuleResponse { + this := IncidentRuleResponse{} + this.Data = data + return &this +} + +// NewIncidentRuleResponseWithDefaults instantiates a new IncidentRuleResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentRuleResponseWithDefaults() *IncidentRuleResponse { + this := IncidentRuleResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentRuleResponse) GetData() IncidentRuleDataResponse { + if o == nil { + var ret IncidentRuleDataResponse + 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 *IncidentRuleResponse) GetDataOk() (*IncidentRuleDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentRuleResponse) SetData(v IncidentRuleDataResponse) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentRuleResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentRuleResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentRuleDataResponse `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_rule_response_type.go b/api/datadogV2/model_incident_rule_response_type.go new file mode 100644 index 00000000000..2c0298db4f0 --- /dev/null +++ b/api/datadogV2/model_incident_rule_response_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRuleResponseType Incident rule response resource type. +type IncidentRuleResponseType string + +// List of IncidentRuleResponseType. +const ( + INCIDENTRULERESPONSETYPE_INCIDENTS_RULES IncidentRuleResponseType = "incidents_rules" +) + +var allowedIncidentRuleResponseTypeEnumValues = []IncidentRuleResponseType{ + INCIDENTRULERESPONSETYPE_INCIDENTS_RULES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentRuleResponseType) GetAllowedValues() []IncidentRuleResponseType { + return allowedIncidentRuleResponseTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentRuleResponseType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentRuleResponseType(value) + return nil +} + +// NewIncidentRuleResponseTypeFromValue returns a pointer to a valid IncidentRuleResponseType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentRuleResponseTypeFromValue(v string) (*IncidentRuleResponseType, error) { + ev := IncidentRuleResponseType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentRuleResponseType: valid values are %v", v, allowedIncidentRuleResponseTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentRuleResponseType) IsValid() bool { + for _, existing := range allowedIncidentRuleResponseTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentRuleResponseType value. +func (v IncidentRuleResponseType) Ptr() *IncidentRuleResponseType { + return &v +} diff --git a/api/datadogV2/model_incident_rule_task_id_type.go b/api/datadogV2/model_incident_rule_task_id_type.go new file mode 100644 index 00000000000..81b0673a243 --- /dev/null +++ b/api/datadogV2/model_incident_rule_task_id_type.go @@ -0,0 +1,86 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRuleTaskIDType The task ID for an incident rule. +type IncidentRuleTaskIDType string + +// List of IncidentRuleTaskIDType. +const ( + INCIDENTRULETASKIDTYPE_JIRA_CREATE_ISSUE_JOB IncidentRuleTaskIDType = "jira-create-issue-job" + INCIDENTRULETASKIDTYPE_NOTIFY_INCIDENT_HANDLES_JOB IncidentRuleTaskIDType = "notify-incident-handles-job" + INCIDENTRULETASKIDTYPE_SERVICENOW_CREATE_INCIDENT_JOB IncidentRuleTaskIDType = "servicenow-create-incident-job" + INCIDENTRULETASKIDTYPE_SLACK_CREATE_CHANNEL_JOB IncidentRuleTaskIDType = "slack-create-channel-job" + INCIDENTRULETASKIDTYPE_ZOOM_CREATE_MEETING_JOB IncidentRuleTaskIDType = "zoom-create-meeting-job" + INCIDENTRULETASKIDTYPE_GOOGLE_MEET_CREATE_MEETING_JOB IncidentRuleTaskIDType = "google-meet-create-meeting-job" + INCIDENTRULETASKIDTYPE_WORKFLOW_AUTOMATION_JOB IncidentRuleTaskIDType = "workflow-automation-job" + INCIDENTRULETASKIDTYPE_MS_TEAMS_CREATE_MEETING_JOB IncidentRuleTaskIDType = "ms-teams-create-meeting-job" + INCIDENTRULETASKIDTYPE_GOOGLE_CHAT_CREATE_SPACE_JOB IncidentRuleTaskIDType = "google-chat-create-space-job" + INCIDENTRULETASKIDTYPE_ZOOM_SUPPRESS_SUMMARIZATION_JOB IncidentRuleTaskIDType = "zoom-suppress-summarization-job" + INCIDENTRULETASKIDTYPE_MS_TEAMS_SUPPRESS_SUMMARIZATION_JOB IncidentRuleTaskIDType = "ms-teams-suppress-summarization-job" + INCIDENTRULETASKIDTYPE_GOOGLE_MEET_SUPPRESS_SUMMARIZATION_JOB IncidentRuleTaskIDType = "google-meet-suppress-summarization-job" +) + +var allowedIncidentRuleTaskIDTypeEnumValues = []IncidentRuleTaskIDType{ + INCIDENTRULETASKIDTYPE_JIRA_CREATE_ISSUE_JOB, + INCIDENTRULETASKIDTYPE_NOTIFY_INCIDENT_HANDLES_JOB, + INCIDENTRULETASKIDTYPE_SERVICENOW_CREATE_INCIDENT_JOB, + INCIDENTRULETASKIDTYPE_SLACK_CREATE_CHANNEL_JOB, + INCIDENTRULETASKIDTYPE_ZOOM_CREATE_MEETING_JOB, + INCIDENTRULETASKIDTYPE_GOOGLE_MEET_CREATE_MEETING_JOB, + INCIDENTRULETASKIDTYPE_WORKFLOW_AUTOMATION_JOB, + INCIDENTRULETASKIDTYPE_MS_TEAMS_CREATE_MEETING_JOB, + INCIDENTRULETASKIDTYPE_GOOGLE_CHAT_CREATE_SPACE_JOB, + INCIDENTRULETASKIDTYPE_ZOOM_SUPPRESS_SUMMARIZATION_JOB, + INCIDENTRULETASKIDTYPE_MS_TEAMS_SUPPRESS_SUMMARIZATION_JOB, + INCIDENTRULETASKIDTYPE_GOOGLE_MEET_SUPPRESS_SUMMARIZATION_JOB, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentRuleTaskIDType) GetAllowedValues() []IncidentRuleTaskIDType { + return allowedIncidentRuleTaskIDTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentRuleTaskIDType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentRuleTaskIDType(value) + return nil +} + +// NewIncidentRuleTaskIDTypeFromValue returns a pointer to a valid IncidentRuleTaskIDType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentRuleTaskIDTypeFromValue(v string) (*IncidentRuleTaskIDType, error) { + ev := IncidentRuleTaskIDType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentRuleTaskIDType: valid values are %v", v, allowedIncidentRuleTaskIDTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentRuleTaskIDType) IsValid() bool { + for _, existing := range allowedIncidentRuleTaskIDTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentRuleTaskIDType value. +func (v IncidentRuleTaskIDType) Ptr() *IncidentRuleTaskIDType { + return &v +} diff --git a/api/datadogV2/model_incident_rule_trigger_type.go b/api/datadogV2/model_incident_rule_trigger_type.go new file mode 100644 index 00000000000..ce27e144b1f --- /dev/null +++ b/api/datadogV2/model_incident_rule_trigger_type.go @@ -0,0 +1,68 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRuleTriggerType The trigger event for an incident rule. +type IncidentRuleTriggerType string + +// List of IncidentRuleTriggerType. +const ( + INCIDENTRULETRIGGERTYPE_INCIDENT_SAVED_TRIGGER IncidentRuleTriggerType = "incident_saved_trigger" + INCIDENTRULETRIGGERTYPE_INCIDENT_CREATED_TRIGGER IncidentRuleTriggerType = "incident_created_trigger" + INCIDENTRULETRIGGERTYPE_INCIDENT_MODIFIED_TRIGGER IncidentRuleTriggerType = "incident_modified_trigger" +) + +var allowedIncidentRuleTriggerTypeEnumValues = []IncidentRuleTriggerType{ + INCIDENTRULETRIGGERTYPE_INCIDENT_SAVED_TRIGGER, + INCIDENTRULETRIGGERTYPE_INCIDENT_CREATED_TRIGGER, + INCIDENTRULETRIGGERTYPE_INCIDENT_MODIFIED_TRIGGER, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentRuleTriggerType) GetAllowedValues() []IncidentRuleTriggerType { + return allowedIncidentRuleTriggerTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentRuleTriggerType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentRuleTriggerType(value) + return nil +} + +// NewIncidentRuleTriggerTypeFromValue returns a pointer to a valid IncidentRuleTriggerType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentRuleTriggerTypeFromValue(v string) (*IncidentRuleTriggerType, error) { + ev := IncidentRuleTriggerType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentRuleTriggerType: valid values are %v", v, allowedIncidentRuleTriggerTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentRuleTriggerType) IsValid() bool { + for _, existing := range allowedIncidentRuleTriggerTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentRuleTriggerType value. +func (v IncidentRuleTriggerType) Ptr() *IncidentRuleTriggerType { + return &v +} diff --git a/api/datadogV2/model_incident_rule_type.go b/api/datadogV2/model_incident_rule_type.go new file mode 100644 index 00000000000..1696b8c8ced --- /dev/null +++ b/api/datadogV2/model_incident_rule_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRuleType Incident rule resource type. +type IncidentRuleType string + +// List of IncidentRuleType. +const ( + INCIDENTRULETYPE_INCIDENT_RULES IncidentRuleType = "incident_rules" +) + +var allowedIncidentRuleTypeEnumValues = []IncidentRuleType{ + INCIDENTRULETYPE_INCIDENT_RULES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentRuleType) GetAllowedValues() []IncidentRuleType { + return allowedIncidentRuleTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentRuleType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentRuleType(value) + return nil +} + +// NewIncidentRuleTypeFromValue returns a pointer to a valid IncidentRuleType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentRuleTypeFromValue(v string) (*IncidentRuleType, error) { + ev := IncidentRuleType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentRuleType: valid values are %v", v, allowedIncidentRuleTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentRuleType) IsValid() bool { + for _, existing := range allowedIncidentRuleTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentRuleType value. +func (v IncidentRuleType) Ptr() *IncidentRuleType { + return &v +} diff --git a/api/datadogV2/model_incident_rules_response.go b/api/datadogV2/model_incident_rules_response.go new file mode 100644 index 00000000000..35f3651a08d --- /dev/null +++ b/api/datadogV2/model_incident_rules_response.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentRulesResponse Response with a list of incident rules. +type IncidentRulesResponse struct { + // List of incident rules. + Data []IncidentRuleDataResponse `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentRulesResponse instantiates a new IncidentRulesResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentRulesResponse(data []IncidentRuleDataResponse) *IncidentRulesResponse { + this := IncidentRulesResponse{} + this.Data = data + return &this +} + +// NewIncidentRulesResponseWithDefaults instantiates a new IncidentRulesResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentRulesResponseWithDefaults() *IncidentRulesResponse { + this := IncidentRulesResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentRulesResponse) GetData() []IncidentRuleDataResponse { + if o == nil { + var ret []IncidentRuleDataResponse + 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 *IncidentRulesResponse) GetDataOk() (*[]IncidentRuleDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentRulesResponse) SetData(v []IncidentRuleDataResponse) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentRulesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentRulesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]IncidentRuleDataResponse `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_service_now_record_data_attributes_request.go b/api/datadogV2/model_incident_service_now_record_data_attributes_request.go new file mode 100644 index 00000000000..52ba713901f --- /dev/null +++ b/api/datadogV2/model_incident_service_now_record_data_attributes_request.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentServiceNowRecordDataAttributesRequest Attributes for creating a ServiceNow record for an incident. +type IncidentServiceNowRecordDataAttributesRequest struct { + // The ServiceNow assignment group. + AssignmentGroup string `json:"assignment_group"` + // The ServiceNow configuration item mapping. + ConfigurationItemMapping string `json:"configuration_item_mapping"` + // The ServiceNow instance name. + InstanceName string `json:"instance_name"` + // An existing ServiceNow record ID (Sys ID) to link instead of creating a new record. + RecordId *string `json:"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{} `json:"-"` +} + +// NewIncidentServiceNowRecordDataAttributesRequest instantiates a new IncidentServiceNowRecordDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentServiceNowRecordDataAttributesRequest(assignmentGroup string, configurationItemMapping string, instanceName string) *IncidentServiceNowRecordDataAttributesRequest { + this := IncidentServiceNowRecordDataAttributesRequest{} + this.AssignmentGroup = assignmentGroup + this.ConfigurationItemMapping = configurationItemMapping + this.InstanceName = instanceName + return &this +} + +// NewIncidentServiceNowRecordDataAttributesRequestWithDefaults instantiates a new IncidentServiceNowRecordDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentServiceNowRecordDataAttributesRequestWithDefaults() *IncidentServiceNowRecordDataAttributesRequest { + this := IncidentServiceNowRecordDataAttributesRequest{} + return &this +} + +// GetAssignmentGroup returns the AssignmentGroup field value. +func (o *IncidentServiceNowRecordDataAttributesRequest) GetAssignmentGroup() string { + if o == nil { + var ret string + return ret + } + return o.AssignmentGroup +} + +// GetAssignmentGroupOk returns a tuple with the AssignmentGroup field value +// and a boolean to check if the value has been set. +func (o *IncidentServiceNowRecordDataAttributesRequest) GetAssignmentGroupOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AssignmentGroup, true +} + +// SetAssignmentGroup sets field value. +func (o *IncidentServiceNowRecordDataAttributesRequest) SetAssignmentGroup(v string) { + o.AssignmentGroup = v +} + +// GetConfigurationItemMapping returns the ConfigurationItemMapping field value. +func (o *IncidentServiceNowRecordDataAttributesRequest) GetConfigurationItemMapping() string { + if o == nil { + var ret string + return ret + } + return o.ConfigurationItemMapping +} + +// GetConfigurationItemMappingOk returns a tuple with the ConfigurationItemMapping field value +// and a boolean to check if the value has been set. +func (o *IncidentServiceNowRecordDataAttributesRequest) GetConfigurationItemMappingOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ConfigurationItemMapping, true +} + +// SetConfigurationItemMapping sets field value. +func (o *IncidentServiceNowRecordDataAttributesRequest) SetConfigurationItemMapping(v string) { + o.ConfigurationItemMapping = v +} + +// GetInstanceName returns the InstanceName field value. +func (o *IncidentServiceNowRecordDataAttributesRequest) GetInstanceName() string { + if o == nil { + var ret string + return ret + } + return o.InstanceName +} + +// GetInstanceNameOk returns a tuple with the InstanceName field value +// and a boolean to check if the value has been set. +func (o *IncidentServiceNowRecordDataAttributesRequest) GetInstanceNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.InstanceName, true +} + +// SetInstanceName sets field value. +func (o *IncidentServiceNowRecordDataAttributesRequest) SetInstanceName(v string) { + o.InstanceName = v +} + +// GetRecordId returns the RecordId field value if set, zero value otherwise. +func (o *IncidentServiceNowRecordDataAttributesRequest) GetRecordId() string { + if o == nil || o.RecordId == nil { + var ret string + return ret + } + return *o.RecordId +} + +// GetRecordIdOk returns a tuple with the RecordId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentServiceNowRecordDataAttributesRequest) GetRecordIdOk() (*string, bool) { + if o == nil || o.RecordId == nil { + return nil, false + } + return o.RecordId, true +} + +// HasRecordId returns a boolean if a field has been set. +func (o *IncidentServiceNowRecordDataAttributesRequest) HasRecordId() bool { + return o != nil && o.RecordId != nil +} + +// SetRecordId gets a reference to the given string and assigns it to the RecordId field. +func (o *IncidentServiceNowRecordDataAttributesRequest) SetRecordId(v string) { + o.RecordId = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentServiceNowRecordDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["assignment_group"] = o.AssignmentGroup + toSerialize["configuration_item_mapping"] = o.ConfigurationItemMapping + toSerialize["instance_name"] = o.InstanceName + if o.RecordId != nil { + toSerialize["record_id"] = o.RecordId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentServiceNowRecordDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AssignmentGroup *string `json:"assignment_group"` + ConfigurationItemMapping *string `json:"configuration_item_mapping"` + InstanceName *string `json:"instance_name"` + RecordId *string `json:"record_id,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.AssignmentGroup == nil { + return fmt.Errorf("required field assignment_group missing") + } + if all.ConfigurationItemMapping == nil { + return fmt.Errorf("required field configuration_item_mapping missing") + } + if all.InstanceName == nil { + return fmt.Errorf("required field instance_name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"assignment_group", "configuration_item_mapping", "instance_name", "record_id"}) + } else { + return err + } + o.AssignmentGroup = *all.AssignmentGroup + o.ConfigurationItemMapping = *all.ConfigurationItemMapping + o.InstanceName = *all.InstanceName + o.RecordId = all.RecordId + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_service_now_record_data_request.go b/api/datadogV2/model_incident_service_now_record_data_request.go new file mode 100644 index 00000000000..511fea09eaf --- /dev/null +++ b/api/datadogV2/model_incident_service_now_record_data_request.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentServiceNowRecordDataRequest ServiceNow record data in a create request. +type IncidentServiceNowRecordDataRequest struct { + // Attributes for creating a ServiceNow record for an incident. + Attributes IncidentServiceNowRecordDataAttributesRequest `json:"attributes"` + // ServiceNow record prompt resource type. + Type IncidentServiceNowRecordPromptType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentServiceNowRecordDataRequest instantiates a new IncidentServiceNowRecordDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentServiceNowRecordDataRequest(attributes IncidentServiceNowRecordDataAttributesRequest, typeVar IncidentServiceNowRecordPromptType) *IncidentServiceNowRecordDataRequest { + this := IncidentServiceNowRecordDataRequest{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewIncidentServiceNowRecordDataRequestWithDefaults instantiates a new IncidentServiceNowRecordDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentServiceNowRecordDataRequestWithDefaults() *IncidentServiceNowRecordDataRequest { + this := IncidentServiceNowRecordDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentServiceNowRecordDataRequest) GetAttributes() IncidentServiceNowRecordDataAttributesRequest { + if o == nil { + var ret IncidentServiceNowRecordDataAttributesRequest + 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 *IncidentServiceNowRecordDataRequest) GetAttributesOk() (*IncidentServiceNowRecordDataAttributesRequest, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentServiceNowRecordDataRequest) SetAttributes(v IncidentServiceNowRecordDataAttributesRequest) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *IncidentServiceNowRecordDataRequest) GetType() IncidentServiceNowRecordPromptType { + if o == nil { + var ret IncidentServiceNowRecordPromptType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentServiceNowRecordDataRequest) GetTypeOk() (*IncidentServiceNowRecordPromptType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentServiceNowRecordDataRequest) SetType(v IncidentServiceNowRecordPromptType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentServiceNowRecordDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentServiceNowRecordDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentServiceNowRecordDataAttributesRequest `json:"attributes"` + Type *IncidentServiceNowRecordPromptType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_service_now_record_prompt_type.go b/api/datadogV2/model_incident_service_now_record_prompt_type.go new file mode 100644 index 00000000000..2b0044244f2 --- /dev/null +++ b/api/datadogV2/model_incident_service_now_record_prompt_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentServiceNowRecordPromptType ServiceNow record prompt resource type. +type IncidentServiceNowRecordPromptType string + +// List of IncidentServiceNowRecordPromptType. +const ( + INCIDENTSERVICENOWRECORDPROMPTTYPE_INCIDENT_SERVICENOW_RECORD_PROMPT IncidentServiceNowRecordPromptType = "incident_servicenow_record_prompt" +) + +var allowedIncidentServiceNowRecordPromptTypeEnumValues = []IncidentServiceNowRecordPromptType{ + INCIDENTSERVICENOWRECORDPROMPTTYPE_INCIDENT_SERVICENOW_RECORD_PROMPT, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentServiceNowRecordPromptType) GetAllowedValues() []IncidentServiceNowRecordPromptType { + return allowedIncidentServiceNowRecordPromptTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentServiceNowRecordPromptType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentServiceNowRecordPromptType(value) + return nil +} + +// NewIncidentServiceNowRecordPromptTypeFromValue returns a pointer to a valid IncidentServiceNowRecordPromptType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentServiceNowRecordPromptTypeFromValue(v string) (*IncidentServiceNowRecordPromptType, error) { + ev := IncidentServiceNowRecordPromptType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentServiceNowRecordPromptType: valid values are %v", v, allowedIncidentServiceNowRecordPromptTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentServiceNowRecordPromptType) IsValid() bool { + for _, existing := range allowedIncidentServiceNowRecordPromptTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentServiceNowRecordPromptType value. +func (v IncidentServiceNowRecordPromptType) Ptr() *IncidentServiceNowRecordPromptType { + return &v +} diff --git a/api/datadogV2/model_incident_service_now_record_request.go b/api/datadogV2/model_incident_service_now_record_request.go new file mode 100644 index 00000000000..20ecd5462c4 --- /dev/null +++ b/api/datadogV2/model_incident_service_now_record_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentServiceNowRecordRequest Request payload for creating a ServiceNow record for an incident. +type IncidentServiceNowRecordRequest struct { + // ServiceNow record data in a create request. + Data IncidentServiceNowRecordDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentServiceNowRecordRequest instantiates a new IncidentServiceNowRecordRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentServiceNowRecordRequest(data IncidentServiceNowRecordDataRequest) *IncidentServiceNowRecordRequest { + this := IncidentServiceNowRecordRequest{} + this.Data = data + return &this +} + +// NewIncidentServiceNowRecordRequestWithDefaults instantiates a new IncidentServiceNowRecordRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentServiceNowRecordRequestWithDefaults() *IncidentServiceNowRecordRequest { + this := IncidentServiceNowRecordRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentServiceNowRecordRequest) GetData() IncidentServiceNowRecordDataRequest { + if o == nil { + var ret IncidentServiceNowRecordDataRequest + 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 *IncidentServiceNowRecordRequest) GetDataOk() (*IncidentServiceNowRecordDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentServiceNowRecordRequest) SetData(v IncidentServiceNowRecordDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentServiceNowRecordRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentServiceNowRecordRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentServiceNowRecordDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_data_attributes_request.go b/api/datadogV2/model_incident_timestamp_override_data_attributes_request.go new file mode 100644 index 00000000000..7c2574dadf1 --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_data_attributes_request.go @@ -0,0 +1,148 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverrideDataAttributesRequest Attributes for creating a timestamp override. +type IncidentTimestampOverrideDataAttributesRequest struct { + // The type of timestamp to override. + TimestampType IncidentTimestampType `json:"timestamp_type"` + // The overridden timestamp value. + TimestampValue time.Time `json:"timestamp_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{} `json:"-"` +} + +// NewIncidentTimestampOverrideDataAttributesRequest instantiates a new IncidentTimestampOverrideDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentTimestampOverrideDataAttributesRequest(timestampType IncidentTimestampType, timestampValue time.Time) *IncidentTimestampOverrideDataAttributesRequest { + this := IncidentTimestampOverrideDataAttributesRequest{} + this.TimestampType = timestampType + this.TimestampValue = timestampValue + return &this +} + +// NewIncidentTimestampOverrideDataAttributesRequestWithDefaults instantiates a new IncidentTimestampOverrideDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentTimestampOverrideDataAttributesRequestWithDefaults() *IncidentTimestampOverrideDataAttributesRequest { + this := IncidentTimestampOverrideDataAttributesRequest{} + return &this +} + +// GetTimestampType returns the TimestampType field value. +func (o *IncidentTimestampOverrideDataAttributesRequest) GetTimestampType() IncidentTimestampType { + if o == nil { + var ret IncidentTimestampType + return ret + } + return o.TimestampType +} + +// GetTimestampTypeOk returns a tuple with the TimestampType field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideDataAttributesRequest) GetTimestampTypeOk() (*IncidentTimestampType, bool) { + if o == nil { + return nil, false + } + return &o.TimestampType, true +} + +// SetTimestampType sets field value. +func (o *IncidentTimestampOverrideDataAttributesRequest) SetTimestampType(v IncidentTimestampType) { + o.TimestampType = v +} + +// GetTimestampValue returns the TimestampValue field value. +func (o *IncidentTimestampOverrideDataAttributesRequest) GetTimestampValue() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.TimestampValue +} + +// GetTimestampValueOk returns a tuple with the TimestampValue field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideDataAttributesRequest) GetTimestampValueOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.TimestampValue, true +} + +// SetTimestampValue sets field value. +func (o *IncidentTimestampOverrideDataAttributesRequest) SetTimestampValue(v time.Time) { + o.TimestampValue = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverrideDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["timestamp_type"] = o.TimestampType + if o.TimestampValue.Nanosecond() == 0 { + toSerialize["timestamp_value"] = o.TimestampValue.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["timestamp_value"] = o.TimestampValue.Format("2006-01-02T15:04:05.000Z07:00") + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverrideDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + TimestampType *IncidentTimestampType `json:"timestamp_type"` + TimestampValue *time.Time `json:"timestamp_value"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.TimestampType == nil { + return fmt.Errorf("required field timestamp_type missing") + } + if all.TimestampValue == nil { + return fmt.Errorf("required field timestamp_value missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"timestamp_type", "timestamp_value"}) + } else { + return err + } + + hasInvalidField := false + if !all.TimestampType.IsValid() { + hasInvalidField = true + } else { + o.TimestampType = *all.TimestampType + } + o.TimestampValue = *all.TimestampValue + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_data_attributes_response.go b/api/datadogV2/model_incident_timestamp_override_data_attributes_response.go new file mode 100644 index 00000000000..3f74c3b3ebb --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_data_attributes_response.go @@ -0,0 +1,298 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverrideDataAttributesResponse Attributes of a timestamp override in a response. +type IncidentTimestampOverrideDataAttributesResponse struct { + // Timestamp when the override was created. + CreatedAt time.Time `json:"created_at"` + // Timestamp when the override was deleted. + DeletedAt datadog.NullableTime `json:"deleted_at,omitempty"` + // The incident identifier. + IncidentId string `json:"incident_id"` + // Timestamp when the override was last modified. + ModifiedAt time.Time `json:"modified_at"` + // The type of timestamp to override. + TimestampType IncidentTimestampType `json:"timestamp_type"` + // The overridden timestamp value. + TimestampValue time.Time `json:"timestamp_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{} `json:"-"` +} + +// NewIncidentTimestampOverrideDataAttributesResponse instantiates a new IncidentTimestampOverrideDataAttributesResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentTimestampOverrideDataAttributesResponse(createdAt time.Time, incidentId string, modifiedAt time.Time, timestampType IncidentTimestampType, timestampValue time.Time) *IncidentTimestampOverrideDataAttributesResponse { + this := IncidentTimestampOverrideDataAttributesResponse{} + this.CreatedAt = createdAt + this.IncidentId = incidentId + this.ModifiedAt = modifiedAt + this.TimestampType = timestampType + this.TimestampValue = timestampValue + return &this +} + +// NewIncidentTimestampOverrideDataAttributesResponseWithDefaults instantiates a new IncidentTimestampOverrideDataAttributesResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentTimestampOverrideDataAttributesResponseWithDefaults() *IncidentTimestampOverrideDataAttributesResponse { + this := IncidentTimestampOverrideDataAttributesResponse{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value. +func (o *IncidentTimestampOverrideDataAttributesResponse) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideDataAttributesResponse) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value. +func (o *IncidentTimestampOverrideDataAttributesResponse) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetDeletedAt returns the DeletedAt field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentTimestampOverrideDataAttributesResponse) GetDeletedAt() time.Time { + if o == nil || o.DeletedAt.Get() == nil { + var ret time.Time + return ret + } + return *o.DeletedAt.Get() +} + +// GetDeletedAtOk returns a tuple with the DeletedAt 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 *IncidentTimestampOverrideDataAttributesResponse) GetDeletedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.DeletedAt.Get(), o.DeletedAt.IsSet() +} + +// HasDeletedAt returns a boolean if a field has been set. +func (o *IncidentTimestampOverrideDataAttributesResponse) HasDeletedAt() bool { + return o != nil && o.DeletedAt.IsSet() +} + +// SetDeletedAt gets a reference to the given datadog.NullableTime and assigns it to the DeletedAt field. +func (o *IncidentTimestampOverrideDataAttributesResponse) SetDeletedAt(v time.Time) { + o.DeletedAt.Set(&v) +} + +// SetDeletedAtNil sets the value for DeletedAt to be an explicit nil. +func (o *IncidentTimestampOverrideDataAttributesResponse) SetDeletedAtNil() { + o.DeletedAt.Set(nil) +} + +// UnsetDeletedAt ensures that no value is present for DeletedAt, not even an explicit nil. +func (o *IncidentTimestampOverrideDataAttributesResponse) UnsetDeletedAt() { + o.DeletedAt.Unset() +} + +// GetIncidentId returns the IncidentId field value. +func (o *IncidentTimestampOverrideDataAttributesResponse) GetIncidentId() string { + if o == nil { + var ret string + 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 *IncidentTimestampOverrideDataAttributesResponse) GetIncidentIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.IncidentId, true +} + +// SetIncidentId sets field value. +func (o *IncidentTimestampOverrideDataAttributesResponse) SetIncidentId(v string) { + o.IncidentId = v +} + +// GetModifiedAt returns the ModifiedAt field value. +func (o *IncidentTimestampOverrideDataAttributesResponse) GetModifiedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideDataAttributesResponse) GetModifiedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.ModifiedAt, true +} + +// SetModifiedAt sets field value. +func (o *IncidentTimestampOverrideDataAttributesResponse) SetModifiedAt(v time.Time) { + o.ModifiedAt = v +} + +// GetTimestampType returns the TimestampType field value. +func (o *IncidentTimestampOverrideDataAttributesResponse) GetTimestampType() IncidentTimestampType { + if o == nil { + var ret IncidentTimestampType + return ret + } + return o.TimestampType +} + +// GetTimestampTypeOk returns a tuple with the TimestampType field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideDataAttributesResponse) GetTimestampTypeOk() (*IncidentTimestampType, bool) { + if o == nil { + return nil, false + } + return &o.TimestampType, true +} + +// SetTimestampType sets field value. +func (o *IncidentTimestampOverrideDataAttributesResponse) SetTimestampType(v IncidentTimestampType) { + o.TimestampType = v +} + +// GetTimestampValue returns the TimestampValue field value. +func (o *IncidentTimestampOverrideDataAttributesResponse) GetTimestampValue() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.TimestampValue +} + +// GetTimestampValueOk returns a tuple with the TimestampValue field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideDataAttributesResponse) GetTimestampValueOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.TimestampValue, true +} + +// SetTimestampValue sets field value. +func (o *IncidentTimestampOverrideDataAttributesResponse) SetTimestampValue(v time.Time) { + o.TimestampValue = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverrideDataAttributesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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.DeletedAt.IsSet() { + toSerialize["deleted_at"] = o.DeletedAt.Get() + } + toSerialize["incident_id"] = o.IncidentId + 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["timestamp_type"] = o.TimestampType + if o.TimestampValue.Nanosecond() == 0 { + toSerialize["timestamp_value"] = o.TimestampValue.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["timestamp_value"] = o.TimestampValue.Format("2006-01-02T15:04:05.000Z07:00") + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverrideDataAttributesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedAt *time.Time `json:"created_at"` + DeletedAt datadog.NullableTime `json:"deleted_at,omitempty"` + IncidentId *string `json:"incident_id"` + ModifiedAt *time.Time `json:"modified_at"` + TimestampType *IncidentTimestampType `json:"timestamp_type"` + TimestampValue *time.Time `json:"timestamp_value"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.CreatedAt == nil { + return fmt.Errorf("required field created_at missing") + } + if all.IncidentId == nil { + return fmt.Errorf("required field incident_id missing") + } + if all.ModifiedAt == nil { + return fmt.Errorf("required field modified_at missing") + } + if all.TimestampType == nil { + return fmt.Errorf("required field timestamp_type missing") + } + if all.TimestampValue == nil { + return fmt.Errorf("required field timestamp_value missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "deleted_at", "incident_id", "modified_at", "timestamp_type", "timestamp_value"}) + } else { + return err + } + + hasInvalidField := false + o.CreatedAt = *all.CreatedAt + o.DeletedAt = all.DeletedAt + o.IncidentId = *all.IncidentId + o.ModifiedAt = *all.ModifiedAt + if !all.TimestampType.IsValid() { + hasInvalidField = true + } else { + o.TimestampType = *all.TimestampType + } + o.TimestampValue = *all.TimestampValue + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_data_request.go b/api/datadogV2/model_incident_timestamp_override_data_request.go new file mode 100644 index 00000000000..a4764c15f73 --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_data_request.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverrideDataRequest Timestamp override data in a create request. +type IncidentTimestampOverrideDataRequest struct { + // Attributes for creating a timestamp override. + Attributes IncidentTimestampOverrideDataAttributesRequest `json:"attributes"` + // Incident timestamp override resource type. + Type IncidentTimestampOverrideType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentTimestampOverrideDataRequest instantiates a new IncidentTimestampOverrideDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentTimestampOverrideDataRequest(attributes IncidentTimestampOverrideDataAttributesRequest, typeVar IncidentTimestampOverrideType) *IncidentTimestampOverrideDataRequest { + this := IncidentTimestampOverrideDataRequest{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewIncidentTimestampOverrideDataRequestWithDefaults instantiates a new IncidentTimestampOverrideDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentTimestampOverrideDataRequestWithDefaults() *IncidentTimestampOverrideDataRequest { + this := IncidentTimestampOverrideDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentTimestampOverrideDataRequest) GetAttributes() IncidentTimestampOverrideDataAttributesRequest { + if o == nil { + var ret IncidentTimestampOverrideDataAttributesRequest + 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 *IncidentTimestampOverrideDataRequest) GetAttributesOk() (*IncidentTimestampOverrideDataAttributesRequest, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentTimestampOverrideDataRequest) SetAttributes(v IncidentTimestampOverrideDataAttributesRequest) { + o.Attributes = v +} + +// GetType returns the Type field value. +func (o *IncidentTimestampOverrideDataRequest) GetType() IncidentTimestampOverrideType { + if o == nil { + var ret IncidentTimestampOverrideType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideDataRequest) GetTypeOk() (*IncidentTimestampOverrideType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentTimestampOverrideDataRequest) SetType(v IncidentTimestampOverrideType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverrideDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverrideDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentTimestampOverrideDataAttributesRequest `json:"attributes"` + Type *IncidentTimestampOverrideType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_data_response.go b/api/datadogV2/model_incident_timestamp_override_data_response.go new file mode 100644 index 00000000000..a1d1f70265e --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_data_response.go @@ -0,0 +1,218 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverrideDataResponse Timestamp override data in a response. +type IncidentTimestampOverrideDataResponse struct { + // Attributes of a timestamp override in a response. + Attributes IncidentTimestampOverrideDataAttributesResponse `json:"attributes"` + // The timestamp override identifier. + Id uuid.UUID `json:"id"` + // Relationships for a timestamp override. + Relationships *IncidentTimestampOverrideRelationships `json:"relationships,omitempty"` + // Incident timestamp override resource type. + Type IncidentTimestampOverrideType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentTimestampOverrideDataResponse instantiates a new IncidentTimestampOverrideDataResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentTimestampOverrideDataResponse(attributes IncidentTimestampOverrideDataAttributesResponse, id uuid.UUID, typeVar IncidentTimestampOverrideType) *IncidentTimestampOverrideDataResponse { + this := IncidentTimestampOverrideDataResponse{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentTimestampOverrideDataResponseWithDefaults instantiates a new IncidentTimestampOverrideDataResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentTimestampOverrideDataResponseWithDefaults() *IncidentTimestampOverrideDataResponse { + this := IncidentTimestampOverrideDataResponse{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentTimestampOverrideDataResponse) GetAttributes() IncidentTimestampOverrideDataAttributesResponse { + if o == nil { + var ret IncidentTimestampOverrideDataAttributesResponse + 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 *IncidentTimestampOverrideDataResponse) GetAttributesOk() (*IncidentTimestampOverrideDataAttributesResponse, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentTimestampOverrideDataResponse) SetAttributes(v IncidentTimestampOverrideDataAttributesResponse) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *IncidentTimestampOverrideDataResponse) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentTimestampOverrideDataResponse) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentTimestampOverrideDataResponse) SetId(v uuid.UUID) { + o.Id = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentTimestampOverrideDataResponse) GetRelationships() IncidentTimestampOverrideRelationships { + if o == nil || o.Relationships == nil { + var ret IncidentTimestampOverrideRelationships + 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 *IncidentTimestampOverrideDataResponse) GetRelationshipsOk() (*IncidentTimestampOverrideRelationships, 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 *IncidentTimestampOverrideDataResponse) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given IncidentTimestampOverrideRelationships and assigns it to the Relationships field. +func (o *IncidentTimestampOverrideDataResponse) SetRelationships(v IncidentTimestampOverrideRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *IncidentTimestampOverrideDataResponse) GetType() IncidentTimestampOverrideType { + if o == nil { + var ret IncidentTimestampOverrideType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverrideDataResponse) GetTypeOk() (*IncidentTimestampOverrideType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentTimestampOverrideDataResponse) SetType(v IncidentTimestampOverrideType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverrideDataResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverrideDataResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentTimestampOverrideDataAttributesResponse `json:"attributes"` + Id *uuid.UUID `json:"id"` + Relationships *IncidentTimestampOverrideRelationships `json:"relationships,omitempty"` + Type *IncidentTimestampOverrideType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_patch_data_attributes_request.go b/api/datadogV2/model_incident_timestamp_override_patch_data_attributes_request.go new file mode 100644 index 00000000000..2006e6ccc75 --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_patch_data_attributes_request.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 datadogV2 + +import ( + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverridePatchDataAttributesRequest Attributes for patching a timestamp override. All fields are optional. +type IncidentTimestampOverridePatchDataAttributesRequest struct { + // The type of timestamp to override. + TimestampType *IncidentTimestampType `json:"timestamp_type,omitempty"` + // The overridden timestamp value. + TimestampValue *time.Time `json:"timestamp_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{} `json:"-"` +} + +// NewIncidentTimestampOverridePatchDataAttributesRequest instantiates a new IncidentTimestampOverridePatchDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentTimestampOverridePatchDataAttributesRequest() *IncidentTimestampOverridePatchDataAttributesRequest { + this := IncidentTimestampOverridePatchDataAttributesRequest{} + return &this +} + +// NewIncidentTimestampOverridePatchDataAttributesRequestWithDefaults instantiates a new IncidentTimestampOverridePatchDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentTimestampOverridePatchDataAttributesRequestWithDefaults() *IncidentTimestampOverridePatchDataAttributesRequest { + this := IncidentTimestampOverridePatchDataAttributesRequest{} + return &this +} + +// GetTimestampType returns the TimestampType field value if set, zero value otherwise. +func (o *IncidentTimestampOverridePatchDataAttributesRequest) GetTimestampType() IncidentTimestampType { + if o == nil || o.TimestampType == nil { + var ret IncidentTimestampType + return ret + } + return *o.TimestampType +} + +// GetTimestampTypeOk returns a tuple with the TimestampType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverridePatchDataAttributesRequest) GetTimestampTypeOk() (*IncidentTimestampType, bool) { + if o == nil || o.TimestampType == nil { + return nil, false + } + return o.TimestampType, true +} + +// HasTimestampType returns a boolean if a field has been set. +func (o *IncidentTimestampOverridePatchDataAttributesRequest) HasTimestampType() bool { + return o != nil && o.TimestampType != nil +} + +// SetTimestampType gets a reference to the given IncidentTimestampType and assigns it to the TimestampType field. +func (o *IncidentTimestampOverridePatchDataAttributesRequest) SetTimestampType(v IncidentTimestampType) { + o.TimestampType = &v +} + +// GetTimestampValue returns the TimestampValue field value if set, zero value otherwise. +func (o *IncidentTimestampOverridePatchDataAttributesRequest) GetTimestampValue() time.Time { + if o == nil || o.TimestampValue == nil { + var ret time.Time + return ret + } + return *o.TimestampValue +} + +// GetTimestampValueOk returns a tuple with the TimestampValue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverridePatchDataAttributesRequest) GetTimestampValueOk() (*time.Time, bool) { + if o == nil || o.TimestampValue == nil { + return nil, false + } + return o.TimestampValue, true +} + +// HasTimestampValue returns a boolean if a field has been set. +func (o *IncidentTimestampOverridePatchDataAttributesRequest) HasTimestampValue() bool { + return o != nil && o.TimestampValue != nil +} + +// SetTimestampValue gets a reference to the given time.Time and assigns it to the TimestampValue field. +func (o *IncidentTimestampOverridePatchDataAttributesRequest) SetTimestampValue(v time.Time) { + o.TimestampValue = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverridePatchDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.TimestampType != nil { + toSerialize["timestamp_type"] = o.TimestampType + } + if o.TimestampValue != nil { + if o.TimestampValue.Nanosecond() == 0 { + toSerialize["timestamp_value"] = o.TimestampValue.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["timestamp_value"] = o.TimestampValue.Format("2006-01-02T15:04:05.000Z07:00") + } + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverridePatchDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + TimestampType *IncidentTimestampType `json:"timestamp_type,omitempty"` + TimestampValue *time.Time `json:"timestamp_value,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"timestamp_type", "timestamp_value"}) + } else { + return err + } + + hasInvalidField := false + if all.TimestampType != nil && !all.TimestampType.IsValid() { + hasInvalidField = true + } else { + o.TimestampType = all.TimestampType + } + o.TimestampValue = all.TimestampValue + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_patch_data_request.go b/api/datadogV2/model_incident_timestamp_override_patch_data_request.go new file mode 100644 index 00000000000..c300c349298 --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_patch_data_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 datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverridePatchDataRequest Timestamp override data in a patch request. +type IncidentTimestampOverridePatchDataRequest struct { + // Attributes for patching a timestamp override. All fields are optional. + Attributes *IncidentTimestampOverridePatchDataAttributesRequest `json:"attributes,omitempty"` + // The timestamp override identifier. + Id uuid.UUID `json:"id"` + // Incident timestamp override resource type. + Type IncidentTimestampOverrideType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentTimestampOverridePatchDataRequest instantiates a new IncidentTimestampOverridePatchDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentTimestampOverridePatchDataRequest(id uuid.UUID, typeVar IncidentTimestampOverrideType) *IncidentTimestampOverridePatchDataRequest { + this := IncidentTimestampOverridePatchDataRequest{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentTimestampOverridePatchDataRequestWithDefaults instantiates a new IncidentTimestampOverridePatchDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentTimestampOverridePatchDataRequestWithDefaults() *IncidentTimestampOverridePatchDataRequest { + this := IncidentTimestampOverridePatchDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *IncidentTimestampOverridePatchDataRequest) GetAttributes() IncidentTimestampOverridePatchDataAttributesRequest { + if o == nil || o.Attributes == nil { + var ret IncidentTimestampOverridePatchDataAttributesRequest + 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 *IncidentTimestampOverridePatchDataRequest) GetAttributesOk() (*IncidentTimestampOverridePatchDataAttributesRequest, 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 *IncidentTimestampOverridePatchDataRequest) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given IncidentTimestampOverridePatchDataAttributesRequest and assigns it to the Attributes field. +func (o *IncidentTimestampOverridePatchDataRequest) SetAttributes(v IncidentTimestampOverridePatchDataAttributesRequest) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *IncidentTimestampOverridePatchDataRequest) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentTimestampOverridePatchDataRequest) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentTimestampOverridePatchDataRequest) SetId(v uuid.UUID) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *IncidentTimestampOverridePatchDataRequest) GetType() IncidentTimestampOverrideType { + if o == nil { + var ret IncidentTimestampOverrideType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentTimestampOverridePatchDataRequest) GetTypeOk() (*IncidentTimestampOverrideType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentTimestampOverridePatchDataRequest) SetType(v IncidentTimestampOverrideType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverridePatchDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverridePatchDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentTimestampOverridePatchDataAttributesRequest `json:"attributes,omitempty"` + Id *uuid.UUID `json:"id"` + Type *IncidentTimestampOverrideType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_patch_request.go b/api/datadogV2/model_incident_timestamp_override_patch_request.go new file mode 100644 index 00000000000..e411e9caa9c --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_patch_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverridePatchRequest Request payload for patching a timestamp override. +type IncidentTimestampOverridePatchRequest struct { + // Timestamp override data in a patch request. + Data IncidentTimestampOverridePatchDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentTimestampOverridePatchRequest instantiates a new IncidentTimestampOverridePatchRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentTimestampOverridePatchRequest(data IncidentTimestampOverridePatchDataRequest) *IncidentTimestampOverridePatchRequest { + this := IncidentTimestampOverridePatchRequest{} + this.Data = data + return &this +} + +// NewIncidentTimestampOverridePatchRequestWithDefaults instantiates a new IncidentTimestampOverridePatchRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentTimestampOverridePatchRequestWithDefaults() *IncidentTimestampOverridePatchRequest { + this := IncidentTimestampOverridePatchRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentTimestampOverridePatchRequest) GetData() IncidentTimestampOverridePatchDataRequest { + if o == nil { + var ret IncidentTimestampOverridePatchDataRequest + 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 *IncidentTimestampOverridePatchRequest) GetDataOk() (*IncidentTimestampOverridePatchDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentTimestampOverridePatchRequest) SetData(v IncidentTimestampOverridePatchDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverridePatchRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverridePatchRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentTimestampOverridePatchDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_relationships.go b/api/datadogV2/model_incident_timestamp_override_relationships.go new file mode 100644 index 00000000000..699c6ea7da8 --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_relationships.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverrideRelationships Relationships for a timestamp override. +type IncidentTimestampOverrideRelationships struct { + // Relationship to user. + CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"` + // Relationship to user. + LastModifiedByUser *RelationshipToUser `json:"last_modified_by_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{} `json:"-"` +} + +// NewIncidentTimestampOverrideRelationships instantiates a new IncidentTimestampOverrideRelationships object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentTimestampOverrideRelationships() *IncidentTimestampOverrideRelationships { + this := IncidentTimestampOverrideRelationships{} + return &this +} + +// NewIncidentTimestampOverrideRelationshipsWithDefaults instantiates a new IncidentTimestampOverrideRelationships object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentTimestampOverrideRelationshipsWithDefaults() *IncidentTimestampOverrideRelationships { + this := IncidentTimestampOverrideRelationships{} + return &this +} + +// GetCreatedByUser returns the CreatedByUser field value if set, zero value otherwise. +func (o *IncidentTimestampOverrideRelationships) 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 *IncidentTimestampOverrideRelationships) 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 *IncidentTimestampOverrideRelationships) HasCreatedByUser() bool { + return o != nil && o.CreatedByUser != nil +} + +// SetCreatedByUser gets a reference to the given RelationshipToUser and assigns it to the CreatedByUser field. +func (o *IncidentTimestampOverrideRelationships) SetCreatedByUser(v RelationshipToUser) { + o.CreatedByUser = &v +} + +// GetLastModifiedByUser returns the LastModifiedByUser field value if set, zero value otherwise. +func (o *IncidentTimestampOverrideRelationships) 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 *IncidentTimestampOverrideRelationships) 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 *IncidentTimestampOverrideRelationships) HasLastModifiedByUser() bool { + return o != nil && o.LastModifiedByUser != nil +} + +// SetLastModifiedByUser gets a reference to the given RelationshipToUser and assigns it to the LastModifiedByUser field. +func (o *IncidentTimestampOverrideRelationships) SetLastModifiedByUser(v RelationshipToUser) { + o.LastModifiedByUser = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverrideRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CreatedByUser != nil { + toSerialize["created_by_user"] = o.CreatedByUser + } + if o.LastModifiedByUser != nil { + toSerialize["last_modified_by_user"] = o.LastModifiedByUser + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverrideRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"` + LastModifiedByUser *RelationshipToUser `json:"last_modified_by_user,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_by_user", "last_modified_by_user"}) + } else { + return err + } + + hasInvalidField := false + if all.CreatedByUser != nil && all.CreatedByUser.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CreatedByUser = all.CreatedByUser + if all.LastModifiedByUser != nil && all.LastModifiedByUser.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LastModifiedByUser = all.LastModifiedByUser + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_request.go b/api/datadogV2/model_incident_timestamp_override_request.go new file mode 100644 index 00000000000..23b3d5c4751 --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverrideRequest Request payload for creating a timestamp override. +type IncidentTimestampOverrideRequest struct { + // Timestamp override data in a create request. + Data IncidentTimestampOverrideDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentTimestampOverrideRequest instantiates a new IncidentTimestampOverrideRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentTimestampOverrideRequest(data IncidentTimestampOverrideDataRequest) *IncidentTimestampOverrideRequest { + this := IncidentTimestampOverrideRequest{} + this.Data = data + return &this +} + +// NewIncidentTimestampOverrideRequestWithDefaults instantiates a new IncidentTimestampOverrideRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentTimestampOverrideRequestWithDefaults() *IncidentTimestampOverrideRequest { + this := IncidentTimestampOverrideRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentTimestampOverrideRequest) GetData() IncidentTimestampOverrideDataRequest { + if o == nil { + var ret IncidentTimestampOverrideDataRequest + 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 *IncidentTimestampOverrideRequest) GetDataOk() (*IncidentTimestampOverrideDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentTimestampOverrideRequest) SetData(v IncidentTimestampOverrideDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverrideRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverrideRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentTimestampOverrideDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_response.go b/api/datadogV2/model_incident_timestamp_override_response.go new file mode 100644 index 00000000000..d5ab51e3f05 --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_response.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverrideResponse Response with a single timestamp override. +type IncidentTimestampOverrideResponse struct { + // Timestamp override data in a response. + Data IncidentTimestampOverrideDataResponse `json:"data"` + // Included related resources. + Included []IncidentUserData `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{} `json:"-"` +} + +// NewIncidentTimestampOverrideResponse instantiates a new IncidentTimestampOverrideResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentTimestampOverrideResponse(data IncidentTimestampOverrideDataResponse) *IncidentTimestampOverrideResponse { + this := IncidentTimestampOverrideResponse{} + this.Data = data + return &this +} + +// NewIncidentTimestampOverrideResponseWithDefaults instantiates a new IncidentTimestampOverrideResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentTimestampOverrideResponseWithDefaults() *IncidentTimestampOverrideResponse { + this := IncidentTimestampOverrideResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentTimestampOverrideResponse) GetData() IncidentTimestampOverrideDataResponse { + if o == nil { + var ret IncidentTimestampOverrideDataResponse + 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 *IncidentTimestampOverrideResponse) GetDataOk() (*IncidentTimestampOverrideDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentTimestampOverrideResponse) SetData(v IncidentTimestampOverrideDataResponse) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentTimestampOverrideResponse) GetIncluded() []IncidentUserData { + if o == nil || o.Included == nil { + var ret []IncidentUserData + 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 *IncidentTimestampOverrideResponse) GetIncludedOk() (*[]IncidentUserData, 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 *IncidentTimestampOverrideResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []IncidentUserData and assigns it to the Included field. +func (o *IncidentTimestampOverrideResponse) SetIncluded(v []IncidentUserData) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverrideResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverrideResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentTimestampOverrideDataResponse `json:"data"` + Included []IncidentUserData `json:"included,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + o.Included = all.Included + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_override_type.go b/api/datadogV2/model_incident_timestamp_override_type.go new file mode 100644 index 00000000000..970faf06811 --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_override_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverrideType Incident timestamp override resource type. +type IncidentTimestampOverrideType string + +// List of IncidentTimestampOverrideType. +const ( + INCIDENTTIMESTAMPOVERRIDETYPE_INCIDENTS_TIMESTAMP_OVERRIDES IncidentTimestampOverrideType = "incidents_timestamp_overrides" +) + +var allowedIncidentTimestampOverrideTypeEnumValues = []IncidentTimestampOverrideType{ + INCIDENTTIMESTAMPOVERRIDETYPE_INCIDENTS_TIMESTAMP_OVERRIDES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentTimestampOverrideType) GetAllowedValues() []IncidentTimestampOverrideType { + return allowedIncidentTimestampOverrideTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentTimestampOverrideType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentTimestampOverrideType(value) + return nil +} + +// NewIncidentTimestampOverrideTypeFromValue returns a pointer to a valid IncidentTimestampOverrideType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentTimestampOverrideTypeFromValue(v string) (*IncidentTimestampOverrideType, error) { + ev := IncidentTimestampOverrideType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentTimestampOverrideType: valid values are %v", v, allowedIncidentTimestampOverrideTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentTimestampOverrideType) IsValid() bool { + for _, existing := range allowedIncidentTimestampOverrideTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentTimestampOverrideType value. +func (v IncidentTimestampOverrideType) Ptr() *IncidentTimestampOverrideType { + return &v +} diff --git a/api/datadogV2/model_incident_timestamp_overrides_response.go b/api/datadogV2/model_incident_timestamp_overrides_response.go new file mode 100644 index 00000000000..6fe909a377d --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_overrides_response.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampOverridesResponse Response with a list of timestamp overrides. +type IncidentTimestampOverridesResponse struct { + // List of timestamp overrides. + Data []IncidentTimestampOverrideDataResponse `json:"data"` + // Included related resources. + Included []IncidentUserData `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{} `json:"-"` +} + +// NewIncidentTimestampOverridesResponse instantiates a new IncidentTimestampOverridesResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentTimestampOverridesResponse(data []IncidentTimestampOverrideDataResponse) *IncidentTimestampOverridesResponse { + this := IncidentTimestampOverridesResponse{} + this.Data = data + return &this +} + +// NewIncidentTimestampOverridesResponseWithDefaults instantiates a new IncidentTimestampOverridesResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentTimestampOverridesResponseWithDefaults() *IncidentTimestampOverridesResponse { + this := IncidentTimestampOverridesResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentTimestampOverridesResponse) GetData() []IncidentTimestampOverrideDataResponse { + if o == nil { + var ret []IncidentTimestampOverrideDataResponse + 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 *IncidentTimestampOverridesResponse) GetDataOk() (*[]IncidentTimestampOverrideDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentTimestampOverridesResponse) SetData(v []IncidentTimestampOverrideDataResponse) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentTimestampOverridesResponse) GetIncluded() []IncidentUserData { + if o == nil || o.Included == nil { + var ret []IncidentUserData + 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 *IncidentTimestampOverridesResponse) GetIncludedOk() (*[]IncidentUserData, 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 *IncidentTimestampOverridesResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []IncidentUserData and assigns it to the Included field. +func (o *IncidentTimestampOverridesResponse) SetIncluded(v []IncidentUserData) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentTimestampOverridesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentTimestampOverridesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]IncidentTimestampOverrideDataResponse `json:"data"` + Included []IncidentUserData `json:"included,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) + } else { + return err + } + o.Data = *all.Data + o.Included = all.Included + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_timestamp_type.go b/api/datadogV2/model_incident_timestamp_type.go new file mode 100644 index 00000000000..b13e5c8629c --- /dev/null +++ b/api/datadogV2/model_incident_timestamp_type.go @@ -0,0 +1,70 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentTimestampType The type of timestamp to override. +type IncidentTimestampType string + +// List of IncidentTimestampType. +const ( + INCIDENTTIMESTAMPTYPE_CREATED IncidentTimestampType = "created" + INCIDENTTIMESTAMPTYPE_DETECTED IncidentTimestampType = "detected" + INCIDENTTIMESTAMPTYPE_RESOLVED IncidentTimestampType = "resolved" + INCIDENTTIMESTAMPTYPE_DECLARED IncidentTimestampType = "declared" +) + +var allowedIncidentTimestampTypeEnumValues = []IncidentTimestampType{ + INCIDENTTIMESTAMPTYPE_CREATED, + INCIDENTTIMESTAMPTYPE_DETECTED, + INCIDENTTIMESTAMPTYPE_RESOLVED, + INCIDENTTIMESTAMPTYPE_DECLARED, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentTimestampType) GetAllowedValues() []IncidentTimestampType { + return allowedIncidentTimestampTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentTimestampType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentTimestampType(value) + return nil +} + +// NewIncidentTimestampTypeFromValue returns a pointer to a valid IncidentTimestampType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentTimestampTypeFromValue(v string) (*IncidentTimestampType, error) { + ev := IncidentTimestampType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentTimestampType: valid values are %v", v, allowedIncidentTimestampTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentTimestampType) IsValid() bool { + for _, existing := range allowedIncidentTimestampTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentTimestampType value. +func (v IncidentTimestampType) Ptr() *IncidentTimestampType { + return &v +} diff --git a/api/datadogV2/model_incident_user_defined_role_data_attributes_request.go b/api/datadogV2/model_incident_user_defined_role_data_attributes_request.go new file mode 100644 index 00000000000..17eef8ed2dd --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_role_data_attributes_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRoleDataAttributesRequest Attributes for creating an incident user-defined role. +type IncidentUserDefinedRoleDataAttributesRequest struct { + // A description of the user-defined role. + Description datadog.NullableString `json:"description,omitempty"` + // The name of the user-defined role. + Name string `json:"name"` + // Policy configuration for a user-defined role. + Policy IncidentUserDefinedRolePolicy `json:"policy"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentUserDefinedRoleDataAttributesRequest instantiates a new IncidentUserDefinedRoleDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentUserDefinedRoleDataAttributesRequest(name string, policy IncidentUserDefinedRolePolicy) *IncidentUserDefinedRoleDataAttributesRequest { + this := IncidentUserDefinedRoleDataAttributesRequest{} + this.Name = name + this.Policy = policy + return &this +} + +// NewIncidentUserDefinedRoleDataAttributesRequestWithDefaults instantiates a new IncidentUserDefinedRoleDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentUserDefinedRoleDataAttributesRequestWithDefaults() *IncidentUserDefinedRoleDataAttributesRequest { + this := IncidentUserDefinedRoleDataAttributesRequest{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentUserDefinedRoleDataAttributesRequest) 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 *IncidentUserDefinedRoleDataAttributesRequest) 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 *IncidentUserDefinedRoleDataAttributesRequest) HasDescription() bool { + return o != nil && o.Description.IsSet() +} + +// SetDescription gets a reference to the given datadog.NullableString and assigns it to the Description field. +func (o *IncidentUserDefinedRoleDataAttributesRequest) SetDescription(v string) { + o.Description.Set(&v) +} + +// SetDescriptionNil sets the value for Description to be an explicit nil. +func (o *IncidentUserDefinedRoleDataAttributesRequest) SetDescriptionNil() { + o.Description.Set(nil) +} + +// UnsetDescription ensures that no value is present for Description, not even an explicit nil. +func (o *IncidentUserDefinedRoleDataAttributesRequest) UnsetDescription() { + o.Description.Unset() +} + +// GetName returns the Name field value. +func (o *IncidentUserDefinedRoleDataAttributesRequest) 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 *IncidentUserDefinedRoleDataAttributesRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *IncidentUserDefinedRoleDataAttributesRequest) SetName(v string) { + o.Name = v +} + +// GetPolicy returns the Policy field value. +func (o *IncidentUserDefinedRoleDataAttributesRequest) GetPolicy() IncidentUserDefinedRolePolicy { + if o == nil { + var ret IncidentUserDefinedRolePolicy + return ret + } + return o.Policy +} + +// GetPolicyOk returns a tuple with the Policy field value +// and a boolean to check if the value has been set. +func (o *IncidentUserDefinedRoleDataAttributesRequest) GetPolicyOk() (*IncidentUserDefinedRolePolicy, bool) { + if o == nil { + return nil, false + } + return &o.Policy, true +} + +// SetPolicy sets field value. +func (o *IncidentUserDefinedRoleDataAttributesRequest) SetPolicy(v IncidentUserDefinedRolePolicy) { + o.Policy = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUserDefinedRoleDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Description.IsSet() { + toSerialize["description"] = o.Description.Get() + } + toSerialize["name"] = o.Name + toSerialize["policy"] = o.Policy + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUserDefinedRoleDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Description datadog.NullableString `json:"description,omitempty"` + Name *string `json:"name"` + Policy *IncidentUserDefinedRolePolicy `json:"policy"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Policy == nil { + return fmt.Errorf("required field policy missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"description", "name", "policy"}) + } else { + return err + } + + hasInvalidField := false + o.Description = all.Description + o.Name = *all.Name + if all.Policy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Policy = *all.Policy + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_user_defined_role_data_attributes_response.go b/api/datadogV2/model_incident_user_defined_role_data_attributes_response.go new file mode 100644 index 00000000000..c95d613ecbf --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_role_data_attributes_response.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 datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRoleDataAttributesResponse Attributes of an incident user-defined role. +type IncidentUserDefinedRoleDataAttributesResponse struct { + // Timestamp when the role was created. + Created time.Time `json:"created"` + // A description of the user-defined role. + Description datadog.NullableString `json:"description,omitempty"` + // Timestamp when the role was last modified. + Modified time.Time `json:"modified"` + // The name of the user-defined role. + Name string `json:"name"` + // Policy configuration for a user-defined role. + Policy IncidentUserDefinedRolePolicy `json:"policy"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentUserDefinedRoleDataAttributesResponse instantiates a new IncidentUserDefinedRoleDataAttributesResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentUserDefinedRoleDataAttributesResponse(created time.Time, modified time.Time, name string, policy IncidentUserDefinedRolePolicy) *IncidentUserDefinedRoleDataAttributesResponse { + this := IncidentUserDefinedRoleDataAttributesResponse{} + this.Created = created + this.Modified = modified + this.Name = name + this.Policy = policy + return &this +} + +// NewIncidentUserDefinedRoleDataAttributesResponseWithDefaults instantiates a new IncidentUserDefinedRoleDataAttributesResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentUserDefinedRoleDataAttributesResponseWithDefaults() *IncidentUserDefinedRoleDataAttributesResponse { + this := IncidentUserDefinedRoleDataAttributesResponse{} + return &this +} + +// GetCreated returns the Created field value. +func (o *IncidentUserDefinedRoleDataAttributesResponse) GetCreated() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.Created +} + +// GetCreatedOk returns a tuple with the Created field value +// and a boolean to check if the value has been set. +func (o *IncidentUserDefinedRoleDataAttributesResponse) GetCreatedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Created, true +} + +// SetCreated sets field value. +func (o *IncidentUserDefinedRoleDataAttributesResponse) SetCreated(v time.Time) { + o.Created = v +} + +// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentUserDefinedRoleDataAttributesResponse) 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 *IncidentUserDefinedRoleDataAttributesResponse) 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 *IncidentUserDefinedRoleDataAttributesResponse) HasDescription() bool { + return o != nil && o.Description.IsSet() +} + +// SetDescription gets a reference to the given datadog.NullableString and assigns it to the Description field. +func (o *IncidentUserDefinedRoleDataAttributesResponse) SetDescription(v string) { + o.Description.Set(&v) +} + +// SetDescriptionNil sets the value for Description to be an explicit nil. +func (o *IncidentUserDefinedRoleDataAttributesResponse) SetDescriptionNil() { + o.Description.Set(nil) +} + +// UnsetDescription ensures that no value is present for Description, not even an explicit nil. +func (o *IncidentUserDefinedRoleDataAttributesResponse) UnsetDescription() { + o.Description.Unset() +} + +// GetModified returns the Modified field value. +func (o *IncidentUserDefinedRoleDataAttributesResponse) GetModified() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.Modified +} + +// GetModifiedOk returns a tuple with the Modified field value +// and a boolean to check if the value has been set. +func (o *IncidentUserDefinedRoleDataAttributesResponse) GetModifiedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Modified, true +} + +// SetModified sets field value. +func (o *IncidentUserDefinedRoleDataAttributesResponse) SetModified(v time.Time) { + o.Modified = v +} + +// GetName returns the Name field value. +func (o *IncidentUserDefinedRoleDataAttributesResponse) 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 *IncidentUserDefinedRoleDataAttributesResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *IncidentUserDefinedRoleDataAttributesResponse) SetName(v string) { + o.Name = v +} + +// GetPolicy returns the Policy field value. +func (o *IncidentUserDefinedRoleDataAttributesResponse) GetPolicy() IncidentUserDefinedRolePolicy { + if o == nil { + var ret IncidentUserDefinedRolePolicy + return ret + } + return o.Policy +} + +// GetPolicyOk returns a tuple with the Policy field value +// and a boolean to check if the value has been set. +func (o *IncidentUserDefinedRoleDataAttributesResponse) GetPolicyOk() (*IncidentUserDefinedRolePolicy, bool) { + if o == nil { + return nil, false + } + return &o.Policy, true +} + +// SetPolicy sets field value. +func (o *IncidentUserDefinedRoleDataAttributesResponse) SetPolicy(v IncidentUserDefinedRolePolicy) { + o.Policy = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUserDefinedRoleDataAttributesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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.IsSet() { + toSerialize["description"] = o.Description.Get() + } + 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 + toSerialize["policy"] = o.Policy + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUserDefinedRoleDataAttributesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Created *time.Time `json:"created"` + Description datadog.NullableString `json:"description,omitempty"` + Modified *time.Time `json:"modified"` + Name *string `json:"name"` + Policy *IncidentUserDefinedRolePolicy `json:"policy"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Created == nil { + return fmt.Errorf("required field created missing") + } + if all.Modified == nil { + return fmt.Errorf("required field modified missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + if all.Policy == nil { + return fmt.Errorf("required field policy missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created", "description", "modified", "name", "policy"}) + } else { + return err + } + + hasInvalidField := false + o.Created = *all.Created + o.Description = all.Description + o.Modified = *all.Modified + o.Name = *all.Name + if all.Policy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Policy = *all.Policy + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_user_defined_role_data_request.go b/api/datadogV2/model_incident_user_defined_role_data_request.go new file mode 100644 index 00000000000..7bfb364d1d0 --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_role_data_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRoleDataRequest Data for creating an incident user-defined role. +type IncidentUserDefinedRoleDataRequest struct { + // Attributes for creating an incident user-defined role. + Attributes IncidentUserDefinedRoleDataAttributesRequest `json:"attributes"` + // Relationships for creating a user-defined role. + Relationships IncidentUserDefinedRoleRelationshipsRequest `json:"relationships"` + // Incident user-defined role resource type. + Type IncidentUserDefinedRoleType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentUserDefinedRoleDataRequest instantiates a new IncidentUserDefinedRoleDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentUserDefinedRoleDataRequest(attributes IncidentUserDefinedRoleDataAttributesRequest, relationships IncidentUserDefinedRoleRelationshipsRequest, typeVar IncidentUserDefinedRoleType) *IncidentUserDefinedRoleDataRequest { + this := IncidentUserDefinedRoleDataRequest{} + this.Attributes = attributes + this.Relationships = relationships + this.Type = typeVar + return &this +} + +// NewIncidentUserDefinedRoleDataRequestWithDefaults instantiates a new IncidentUserDefinedRoleDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentUserDefinedRoleDataRequestWithDefaults() *IncidentUserDefinedRoleDataRequest { + this := IncidentUserDefinedRoleDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentUserDefinedRoleDataRequest) GetAttributes() IncidentUserDefinedRoleDataAttributesRequest { + if o == nil { + var ret IncidentUserDefinedRoleDataAttributesRequest + 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 *IncidentUserDefinedRoleDataRequest) GetAttributesOk() (*IncidentUserDefinedRoleDataAttributesRequest, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentUserDefinedRoleDataRequest) SetAttributes(v IncidentUserDefinedRoleDataAttributesRequest) { + o.Attributes = v +} + +// GetRelationships returns the Relationships field value. +func (o *IncidentUserDefinedRoleDataRequest) GetRelationships() IncidentUserDefinedRoleRelationshipsRequest { + if o == nil { + var ret IncidentUserDefinedRoleRelationshipsRequest + 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 *IncidentUserDefinedRoleDataRequest) GetRelationshipsOk() (*IncidentUserDefinedRoleRelationshipsRequest, bool) { + if o == nil { + return nil, false + } + return &o.Relationships, true +} + +// SetRelationships sets field value. +func (o *IncidentUserDefinedRoleDataRequest) SetRelationships(v IncidentUserDefinedRoleRelationshipsRequest) { + o.Relationships = v +} + +// GetType returns the Type field value. +func (o *IncidentUserDefinedRoleDataRequest) GetType() IncidentUserDefinedRoleType { + if o == nil { + var ret IncidentUserDefinedRoleType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentUserDefinedRoleDataRequest) GetTypeOk() (*IncidentUserDefinedRoleType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentUserDefinedRoleDataRequest) SetType(v IncidentUserDefinedRoleType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUserDefinedRoleDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["relationships"] = o.Relationships + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUserDefinedRoleDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentUserDefinedRoleDataAttributesRequest `json:"attributes"` + Relationships *IncidentUserDefinedRoleRelationshipsRequest `json:"relationships"` + Type *IncidentUserDefinedRoleType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Relationships == nil { + return fmt.Errorf("required field relationships missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = *all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_user_defined_role_data_response.go b/api/datadogV2/model_incident_user_defined_role_data_response.go new file mode 100644 index 00000000000..1ca7ab13874 --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_role_data_response.go @@ -0,0 +1,218 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRoleDataResponse Data for an incident user-defined role response. +type IncidentUserDefinedRoleDataResponse struct { + // Attributes of an incident user-defined role. + Attributes IncidentUserDefinedRoleDataAttributesResponse `json:"attributes"` + // The ID of the user-defined role. + Id uuid.UUID `json:"id"` + // Relationships of a user-defined role response. + Relationships *IncidentUserDefinedRoleRelationshipsResponse `json:"relationships,omitempty"` + // Incident user-defined role resource type. + Type IncidentUserDefinedRoleType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentUserDefinedRoleDataResponse instantiates a new IncidentUserDefinedRoleDataResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentUserDefinedRoleDataResponse(attributes IncidentUserDefinedRoleDataAttributesResponse, id uuid.UUID, typeVar IncidentUserDefinedRoleType) *IncidentUserDefinedRoleDataResponse { + this := IncidentUserDefinedRoleDataResponse{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentUserDefinedRoleDataResponseWithDefaults instantiates a new IncidentUserDefinedRoleDataResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentUserDefinedRoleDataResponseWithDefaults() *IncidentUserDefinedRoleDataResponse { + this := IncidentUserDefinedRoleDataResponse{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *IncidentUserDefinedRoleDataResponse) GetAttributes() IncidentUserDefinedRoleDataAttributesResponse { + if o == nil { + var ret IncidentUserDefinedRoleDataAttributesResponse + 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 *IncidentUserDefinedRoleDataResponse) GetAttributesOk() (*IncidentUserDefinedRoleDataAttributesResponse, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *IncidentUserDefinedRoleDataResponse) SetAttributes(v IncidentUserDefinedRoleDataAttributesResponse) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *IncidentUserDefinedRoleDataResponse) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentUserDefinedRoleDataResponse) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentUserDefinedRoleDataResponse) SetId(v uuid.UUID) { + o.Id = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *IncidentUserDefinedRoleDataResponse) GetRelationships() IncidentUserDefinedRoleRelationshipsResponse { + if o == nil || o.Relationships == nil { + var ret IncidentUserDefinedRoleRelationshipsResponse + 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 *IncidentUserDefinedRoleDataResponse) GetRelationshipsOk() (*IncidentUserDefinedRoleRelationshipsResponse, 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 *IncidentUserDefinedRoleDataResponse) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given IncidentUserDefinedRoleRelationshipsResponse and assigns it to the Relationships field. +func (o *IncidentUserDefinedRoleDataResponse) SetRelationships(v IncidentUserDefinedRoleRelationshipsResponse) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *IncidentUserDefinedRoleDataResponse) GetType() IncidentUserDefinedRoleType { + if o == nil { + var ret IncidentUserDefinedRoleType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentUserDefinedRoleDataResponse) GetTypeOk() (*IncidentUserDefinedRoleType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentUserDefinedRoleDataResponse) SetType(v IncidentUserDefinedRoleType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUserDefinedRoleDataResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + 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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUserDefinedRoleDataResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentUserDefinedRoleDataAttributesResponse `json:"attributes"` + Id *uuid.UUID `json:"id"` + Relationships *IncidentUserDefinedRoleRelationshipsResponse `json:"relationships,omitempty"` + Type *IncidentUserDefinedRoleType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_user_defined_role_incident_type_relationship.go b/api/datadogV2/model_incident_user_defined_role_incident_type_relationship.go new file mode 100644 index 00000000000..bb3c81cf48f --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_role_incident_type_relationship.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRoleIncidentTypeRelationship Relationship to an incident type for a user-defined role. +type IncidentUserDefinedRoleIncidentTypeRelationship struct { + // Data for the incident type relationship of a user-defined role. + Data IncidentUserDefinedRoleIncidentTypeRelationshipData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentUserDefinedRoleIncidentTypeRelationship instantiates a new IncidentUserDefinedRoleIncidentTypeRelationship object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentUserDefinedRoleIncidentTypeRelationship(data IncidentUserDefinedRoleIncidentTypeRelationshipData) *IncidentUserDefinedRoleIncidentTypeRelationship { + this := IncidentUserDefinedRoleIncidentTypeRelationship{} + this.Data = data + return &this +} + +// NewIncidentUserDefinedRoleIncidentTypeRelationshipWithDefaults instantiates a new IncidentUserDefinedRoleIncidentTypeRelationship object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentUserDefinedRoleIncidentTypeRelationshipWithDefaults() *IncidentUserDefinedRoleIncidentTypeRelationship { + this := IncidentUserDefinedRoleIncidentTypeRelationship{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentUserDefinedRoleIncidentTypeRelationship) GetData() IncidentUserDefinedRoleIncidentTypeRelationshipData { + if o == nil { + var ret IncidentUserDefinedRoleIncidentTypeRelationshipData + 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 *IncidentUserDefinedRoleIncidentTypeRelationship) GetDataOk() (*IncidentUserDefinedRoleIncidentTypeRelationshipData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentUserDefinedRoleIncidentTypeRelationship) SetData(v IncidentUserDefinedRoleIncidentTypeRelationshipData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUserDefinedRoleIncidentTypeRelationship) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUserDefinedRoleIncidentTypeRelationship) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentUserDefinedRoleIncidentTypeRelationshipData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_user_defined_role_incident_type_relationship_data.go b/api/datadogV2/model_incident_user_defined_role_incident_type_relationship_data.go new file mode 100644 index 00000000000..3ec4ef1190f --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_role_incident_type_relationship_data.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 datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRoleIncidentTypeRelationshipData Data for the incident type relationship of a user-defined role. +type IncidentUserDefinedRoleIncidentTypeRelationshipData struct { + // The ID of the incident type. + Id uuid.UUID `json:"id"` + // The type of the resource. + Type string `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentUserDefinedRoleIncidentTypeRelationshipData instantiates a new IncidentUserDefinedRoleIncidentTypeRelationshipData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentUserDefinedRoleIncidentTypeRelationshipData(id uuid.UUID, typeVar string) *IncidentUserDefinedRoleIncidentTypeRelationshipData { + this := IncidentUserDefinedRoleIncidentTypeRelationshipData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentUserDefinedRoleIncidentTypeRelationshipDataWithDefaults instantiates a new IncidentUserDefinedRoleIncidentTypeRelationshipData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentUserDefinedRoleIncidentTypeRelationshipDataWithDefaults() *IncidentUserDefinedRoleIncidentTypeRelationshipData { + this := IncidentUserDefinedRoleIncidentTypeRelationshipData{} + return &this +} + +// GetId returns the Id field value. +func (o *IncidentUserDefinedRoleIncidentTypeRelationshipData) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentUserDefinedRoleIncidentTypeRelationshipData) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentUserDefinedRoleIncidentTypeRelationshipData) SetId(v uuid.UUID) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *IncidentUserDefinedRoleIncidentTypeRelationshipData) 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 *IncidentUserDefinedRoleIncidentTypeRelationshipData) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentUserDefinedRoleIncidentTypeRelationshipData) SetType(v string) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUserDefinedRoleIncidentTypeRelationshipData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUserDefinedRoleIncidentTypeRelationshipData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *uuid.UUID `json:"id"` + Type *string `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) + } else { + return err + } + o.Id = *all.Id + o.Type = *all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_user_defined_role_included_item.go b/api/datadogV2/model_incident_user_defined_role_included_item.go new file mode 100644 index 00000000000..e31076dfbdc --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_role_included_item.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRoleIncludedItem - A single included resource in a user-defined role response. +type IncidentUserDefinedRoleIncludedItem struct { + IncidentUserData *IncidentUserData + IncidentTypeObject *IncidentTypeObject + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// IncidentUserDataAsIncidentUserDefinedRoleIncludedItem is a convenience function that returns IncidentUserData wrapped in IncidentUserDefinedRoleIncludedItem. +func IncidentUserDataAsIncidentUserDefinedRoleIncludedItem(v *IncidentUserData) IncidentUserDefinedRoleIncludedItem { + return IncidentUserDefinedRoleIncludedItem{IncidentUserData: v} +} + +// IncidentTypeObjectAsIncidentUserDefinedRoleIncludedItem is a convenience function that returns IncidentTypeObject wrapped in IncidentUserDefinedRoleIncludedItem. +func IncidentTypeObjectAsIncidentUserDefinedRoleIncludedItem(v *IncidentTypeObject) IncidentUserDefinedRoleIncludedItem { + return IncidentUserDefinedRoleIncludedItem{IncidentTypeObject: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *IncidentUserDefinedRoleIncludedItem) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into IncidentUserData + err = datadog.Unmarshal(data, &obj.IncidentUserData) + if err == nil { + if obj.IncidentUserData != nil && obj.IncidentUserData.UnparsedObject == nil { + jsonIncidentUserData, _ := datadog.Marshal(obj.IncidentUserData) + if string(jsonIncidentUserData) == "{}" && string(data) != "{}" { // empty struct + obj.IncidentUserData = nil + } else { + match++ + } + } else { + obj.IncidentUserData = nil + } + } else { + obj.IncidentUserData = nil + } + + // try to unmarshal data into IncidentTypeObject + err = datadog.Unmarshal(data, &obj.IncidentTypeObject) + if err == nil { + if obj.IncidentTypeObject != nil && obj.IncidentTypeObject.UnparsedObject == nil { + jsonIncidentTypeObject, _ := datadog.Marshal(obj.IncidentTypeObject) + if string(jsonIncidentTypeObject) == "{}" { // empty struct + obj.IncidentTypeObject = nil + } else { + match++ + } + } else { + obj.IncidentTypeObject = nil + } + } else { + obj.IncidentTypeObject = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.IncidentUserData = nil + obj.IncidentTypeObject = nil + return datadog.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 IncidentUserDefinedRoleIncludedItem) MarshalJSON() ([]byte, error) { + if obj.IncidentUserData != nil { + return datadog.Marshal(&obj.IncidentUserData) + } + + if obj.IncidentTypeObject != nil { + return datadog.Marshal(&obj.IncidentTypeObject) + } + + if obj.UnparsedObject != nil { + return datadog.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *IncidentUserDefinedRoleIncludedItem) GetActualInstance() interface{} { + if obj.IncidentUserData != nil { + return obj.IncidentUserData + } + + if obj.IncidentTypeObject != nil { + return obj.IncidentTypeObject + } + + // all schemas are nil + return nil +} diff --git a/api/datadogV2/model_incident_user_defined_role_patch_data_attributes_request.go b/api/datadogV2/model_incident_user_defined_role_patch_data_attributes_request.go new file mode 100644 index 00000000000..c0f553f4d5b --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_role_patch_data_attributes_request.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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRolePatchDataAttributesRequest Attributes for updating an incident user-defined role. +type IncidentUserDefinedRolePatchDataAttributesRequest struct { + // A description of the user-defined role. + Description datadog.NullableString `json:"description,omitempty"` + // The name of the user-defined role. + Name *string `json:"name,omitempty"` + // Policy configuration for a user-defined role. + Policy *IncidentUserDefinedRolePolicy `json:"policy,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentUserDefinedRolePatchDataAttributesRequest instantiates a new IncidentUserDefinedRolePatchDataAttributesRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentUserDefinedRolePatchDataAttributesRequest() *IncidentUserDefinedRolePatchDataAttributesRequest { + this := IncidentUserDefinedRolePatchDataAttributesRequest{} + return &this +} + +// NewIncidentUserDefinedRolePatchDataAttributesRequestWithDefaults instantiates a new IncidentUserDefinedRolePatchDataAttributesRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentUserDefinedRolePatchDataAttributesRequestWithDefaults() *IncidentUserDefinedRolePatchDataAttributesRequest { + this := IncidentUserDefinedRolePatchDataAttributesRequest{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncidentUserDefinedRolePatchDataAttributesRequest) 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 *IncidentUserDefinedRolePatchDataAttributesRequest) 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 *IncidentUserDefinedRolePatchDataAttributesRequest) HasDescription() bool { + return o != nil && o.Description.IsSet() +} + +// SetDescription gets a reference to the given datadog.NullableString and assigns it to the Description field. +func (o *IncidentUserDefinedRolePatchDataAttributesRequest) SetDescription(v string) { + o.Description.Set(&v) +} + +// SetDescriptionNil sets the value for Description to be an explicit nil. +func (o *IncidentUserDefinedRolePatchDataAttributesRequest) SetDescriptionNil() { + o.Description.Set(nil) +} + +// UnsetDescription ensures that no value is present for Description, not even an explicit nil. +func (o *IncidentUserDefinedRolePatchDataAttributesRequest) UnsetDescription() { + o.Description.Unset() +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *IncidentUserDefinedRolePatchDataAttributesRequest) 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 *IncidentUserDefinedRolePatchDataAttributesRequest) 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 *IncidentUserDefinedRolePatchDataAttributesRequest) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *IncidentUserDefinedRolePatchDataAttributesRequest) SetName(v string) { + o.Name = &v +} + +// GetPolicy returns the Policy field value if set, zero value otherwise. +func (o *IncidentUserDefinedRolePatchDataAttributesRequest) GetPolicy() IncidentUserDefinedRolePolicy { + if o == nil || o.Policy == nil { + var ret IncidentUserDefinedRolePolicy + return ret + } + return *o.Policy +} + +// GetPolicyOk returns a tuple with the Policy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentUserDefinedRolePatchDataAttributesRequest) GetPolicyOk() (*IncidentUserDefinedRolePolicy, bool) { + if o == nil || o.Policy == nil { + return nil, false + } + return o.Policy, true +} + +// HasPolicy returns a boolean if a field has been set. +func (o *IncidentUserDefinedRolePatchDataAttributesRequest) HasPolicy() bool { + return o != nil && o.Policy != nil +} + +// SetPolicy gets a reference to the given IncidentUserDefinedRolePolicy and assigns it to the Policy field. +func (o *IncidentUserDefinedRolePatchDataAttributesRequest) SetPolicy(v IncidentUserDefinedRolePolicy) { + o.Policy = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUserDefinedRolePatchDataAttributesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Description.IsSet() { + toSerialize["description"] = o.Description.Get() + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Policy != nil { + toSerialize["policy"] = o.Policy + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUserDefinedRolePatchDataAttributesRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Description datadog.NullableString `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + Policy *IncidentUserDefinedRolePolicy `json:"policy,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"description", "name", "policy"}) + } else { + return err + } + + hasInvalidField := false + o.Description = all.Description + o.Name = all.Name + if all.Policy != nil && all.Policy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Policy = all.Policy + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_user_defined_role_patch_data_request.go b/api/datadogV2/model_incident_user_defined_role_patch_data_request.go new file mode 100644 index 00000000000..5152bcb2602 --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_role_patch_data_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 datadogV2 + +import ( + "fmt" + + "github.com/google/uuid" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRolePatchDataRequest Data for updating an incident user-defined role. +type IncidentUserDefinedRolePatchDataRequest struct { + // Attributes for updating an incident user-defined role. + Attributes *IncidentUserDefinedRolePatchDataAttributesRequest `json:"attributes,omitempty"` + // The ID of the user-defined role to update. + Id uuid.UUID `json:"id"` + // Incident user-defined role resource type. + Type IncidentUserDefinedRoleType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentUserDefinedRolePatchDataRequest instantiates a new IncidentUserDefinedRolePatchDataRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentUserDefinedRolePatchDataRequest(id uuid.UUID, typeVar IncidentUserDefinedRoleType) *IncidentUserDefinedRolePatchDataRequest { + this := IncidentUserDefinedRolePatchDataRequest{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewIncidentUserDefinedRolePatchDataRequestWithDefaults instantiates a new IncidentUserDefinedRolePatchDataRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentUserDefinedRolePatchDataRequestWithDefaults() *IncidentUserDefinedRolePatchDataRequest { + this := IncidentUserDefinedRolePatchDataRequest{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *IncidentUserDefinedRolePatchDataRequest) GetAttributes() IncidentUserDefinedRolePatchDataAttributesRequest { + if o == nil || o.Attributes == nil { + var ret IncidentUserDefinedRolePatchDataAttributesRequest + 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 *IncidentUserDefinedRolePatchDataRequest) GetAttributesOk() (*IncidentUserDefinedRolePatchDataAttributesRequest, 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 *IncidentUserDefinedRolePatchDataRequest) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given IncidentUserDefinedRolePatchDataAttributesRequest and assigns it to the Attributes field. +func (o *IncidentUserDefinedRolePatchDataRequest) SetAttributes(v IncidentUserDefinedRolePatchDataAttributesRequest) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *IncidentUserDefinedRolePatchDataRequest) GetId() uuid.UUID { + if o == nil { + var ret uuid.UUID + 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 *IncidentUserDefinedRolePatchDataRequest) GetIdOk() (*uuid.UUID, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *IncidentUserDefinedRolePatchDataRequest) SetId(v uuid.UUID) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *IncidentUserDefinedRolePatchDataRequest) GetType() IncidentUserDefinedRoleType { + if o == nil { + var ret IncidentUserDefinedRoleType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IncidentUserDefinedRolePatchDataRequest) GetTypeOk() (*IncidentUserDefinedRoleType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *IncidentUserDefinedRolePatchDataRequest) SetType(v IncidentUserDefinedRoleType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUserDefinedRolePatchDataRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUserDefinedRolePatchDataRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *IncidentUserDefinedRolePatchDataAttributesRequest `json:"attributes,omitempty"` + Id *uuid.UUID `json:"id"` + Type *IncidentUserDefinedRoleType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_user_defined_role_patch_request.go b/api/datadogV2/model_incident_user_defined_role_patch_request.go new file mode 100644 index 00000000000..0d96c69e9de --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_role_patch_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRolePatchRequest Request for updating an incident user-defined role. +type IncidentUserDefinedRolePatchRequest struct { + // Data for updating an incident user-defined role. + Data IncidentUserDefinedRolePatchDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentUserDefinedRolePatchRequest instantiates a new IncidentUserDefinedRolePatchRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentUserDefinedRolePatchRequest(data IncidentUserDefinedRolePatchDataRequest) *IncidentUserDefinedRolePatchRequest { + this := IncidentUserDefinedRolePatchRequest{} + this.Data = data + return &this +} + +// NewIncidentUserDefinedRolePatchRequestWithDefaults instantiates a new IncidentUserDefinedRolePatchRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentUserDefinedRolePatchRequestWithDefaults() *IncidentUserDefinedRolePatchRequest { + this := IncidentUserDefinedRolePatchRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentUserDefinedRolePatchRequest) GetData() IncidentUserDefinedRolePatchDataRequest { + if o == nil { + var ret IncidentUserDefinedRolePatchDataRequest + 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 *IncidentUserDefinedRolePatchRequest) GetDataOk() (*IncidentUserDefinedRolePatchDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentUserDefinedRolePatchRequest) SetData(v IncidentUserDefinedRolePatchDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUserDefinedRolePatchRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUserDefinedRolePatchRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentUserDefinedRolePatchDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_user_defined_role_policy.go b/api/datadogV2/model_incident_user_defined_role_policy.go new file mode 100644 index 00000000000..dafecc86421 --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_role_policy.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRolePolicy Policy configuration for a user-defined role. +type IncidentUserDefinedRolePolicy struct { + // Whether this role can only be assigned to one responder at a time. + IsSingle bool `json:"is_single"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentUserDefinedRolePolicy instantiates a new IncidentUserDefinedRolePolicy object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentUserDefinedRolePolicy(isSingle bool) *IncidentUserDefinedRolePolicy { + this := IncidentUserDefinedRolePolicy{} + this.IsSingle = isSingle + return &this +} + +// NewIncidentUserDefinedRolePolicyWithDefaults instantiates a new IncidentUserDefinedRolePolicy object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentUserDefinedRolePolicyWithDefaults() *IncidentUserDefinedRolePolicy { + this := IncidentUserDefinedRolePolicy{} + return &this +} + +// GetIsSingle returns the IsSingle field value. +func (o *IncidentUserDefinedRolePolicy) GetIsSingle() bool { + if o == nil { + var ret bool + return ret + } + return o.IsSingle +} + +// GetIsSingleOk returns a tuple with the IsSingle field value +// and a boolean to check if the value has been set. +func (o *IncidentUserDefinedRolePolicy) GetIsSingleOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsSingle, true +} + +// SetIsSingle sets field value. +func (o *IncidentUserDefinedRolePolicy) SetIsSingle(v bool) { + o.IsSingle = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUserDefinedRolePolicy) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["is_single"] = o.IsSingle + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUserDefinedRolePolicy) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IsSingle *bool `json:"is_single"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IsSingle == nil { + return fmt.Errorf("required field is_single missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"is_single"}) + } else { + return err + } + o.IsSingle = *all.IsSingle + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_user_defined_role_relationships_request.go b/api/datadogV2/model_incident_user_defined_role_relationships_request.go new file mode 100644 index 00000000000..adf1f8a8fce --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_role_relationships_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRoleRelationshipsRequest Relationships for creating a user-defined role. +type IncidentUserDefinedRoleRelationshipsRequest struct { + // Relationship to an incident type for a user-defined role. + IncidentType IncidentUserDefinedRoleIncidentTypeRelationship `json:"incident_type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentUserDefinedRoleRelationshipsRequest instantiates a new IncidentUserDefinedRoleRelationshipsRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentUserDefinedRoleRelationshipsRequest(incidentType IncidentUserDefinedRoleIncidentTypeRelationship) *IncidentUserDefinedRoleRelationshipsRequest { + this := IncidentUserDefinedRoleRelationshipsRequest{} + this.IncidentType = incidentType + return &this +} + +// NewIncidentUserDefinedRoleRelationshipsRequestWithDefaults instantiates a new IncidentUserDefinedRoleRelationshipsRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentUserDefinedRoleRelationshipsRequestWithDefaults() *IncidentUserDefinedRoleRelationshipsRequest { + this := IncidentUserDefinedRoleRelationshipsRequest{} + return &this +} + +// GetIncidentType returns the IncidentType field value. +func (o *IncidentUserDefinedRoleRelationshipsRequest) GetIncidentType() IncidentUserDefinedRoleIncidentTypeRelationship { + if o == nil { + var ret IncidentUserDefinedRoleIncidentTypeRelationship + return ret + } + return o.IncidentType +} + +// GetIncidentTypeOk returns a tuple with the IncidentType field value +// and a boolean to check if the value has been set. +func (o *IncidentUserDefinedRoleRelationshipsRequest) GetIncidentTypeOk() (*IncidentUserDefinedRoleIncidentTypeRelationship, bool) { + if o == nil { + return nil, false + } + return &o.IncidentType, true +} + +// SetIncidentType sets field value. +func (o *IncidentUserDefinedRoleRelationshipsRequest) SetIncidentType(v IncidentUserDefinedRoleIncidentTypeRelationship) { + o.IncidentType = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUserDefinedRoleRelationshipsRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["incident_type"] = o.IncidentType + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUserDefinedRoleRelationshipsRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncidentType *IncidentUserDefinedRoleIncidentTypeRelationship `json:"incident_type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.IncidentType == nil { + return fmt.Errorf("required field incident_type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"incident_type"}) + } else { + return err + } + + hasInvalidField := false + if all.IncidentType.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IncidentType = *all.IncidentType + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_user_defined_role_relationships_response.go b/api/datadogV2/model_incident_user_defined_role_relationships_response.go new file mode 100644 index 00000000000..41af266001c --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_role_relationships_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 datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRoleRelationshipsResponse Relationships of a user-defined role response. +type IncidentUserDefinedRoleRelationshipsResponse struct { + // Relationship to user. + CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"` + // Relationship to an incident type for a user-defined role. + IncidentType *IncidentUserDefinedRoleIncidentTypeRelationship `json:"incident_type,omitempty"` + // Relationship to user. + LastModifiedByUser *RelationshipToUser `json:"last_modified_by_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{} `json:"-"` +} + +// NewIncidentUserDefinedRoleRelationshipsResponse instantiates a new IncidentUserDefinedRoleRelationshipsResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentUserDefinedRoleRelationshipsResponse() *IncidentUserDefinedRoleRelationshipsResponse { + this := IncidentUserDefinedRoleRelationshipsResponse{} + return &this +} + +// NewIncidentUserDefinedRoleRelationshipsResponseWithDefaults instantiates a new IncidentUserDefinedRoleRelationshipsResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentUserDefinedRoleRelationshipsResponseWithDefaults() *IncidentUserDefinedRoleRelationshipsResponse { + this := IncidentUserDefinedRoleRelationshipsResponse{} + return &this +} + +// GetCreatedByUser returns the CreatedByUser field value if set, zero value otherwise. +func (o *IncidentUserDefinedRoleRelationshipsResponse) 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 *IncidentUserDefinedRoleRelationshipsResponse) 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 *IncidentUserDefinedRoleRelationshipsResponse) HasCreatedByUser() bool { + return o != nil && o.CreatedByUser != nil +} + +// SetCreatedByUser gets a reference to the given RelationshipToUser and assigns it to the CreatedByUser field. +func (o *IncidentUserDefinedRoleRelationshipsResponse) SetCreatedByUser(v RelationshipToUser) { + o.CreatedByUser = &v +} + +// GetIncidentType returns the IncidentType field value if set, zero value otherwise. +func (o *IncidentUserDefinedRoleRelationshipsResponse) GetIncidentType() IncidentUserDefinedRoleIncidentTypeRelationship { + if o == nil || o.IncidentType == nil { + var ret IncidentUserDefinedRoleIncidentTypeRelationship + return ret + } + return *o.IncidentType +} + +// GetIncidentTypeOk returns a tuple with the IncidentType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IncidentUserDefinedRoleRelationshipsResponse) GetIncidentTypeOk() (*IncidentUserDefinedRoleIncidentTypeRelationship, bool) { + if o == nil || o.IncidentType == nil { + return nil, false + } + return o.IncidentType, true +} + +// HasIncidentType returns a boolean if a field has been set. +func (o *IncidentUserDefinedRoleRelationshipsResponse) HasIncidentType() bool { + return o != nil && o.IncidentType != nil +} + +// SetIncidentType gets a reference to the given IncidentUserDefinedRoleIncidentTypeRelationship and assigns it to the IncidentType field. +func (o *IncidentUserDefinedRoleRelationshipsResponse) SetIncidentType(v IncidentUserDefinedRoleIncidentTypeRelationship) { + o.IncidentType = &v +} + +// GetLastModifiedByUser returns the LastModifiedByUser field value if set, zero value otherwise. +func (o *IncidentUserDefinedRoleRelationshipsResponse) 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 *IncidentUserDefinedRoleRelationshipsResponse) 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 *IncidentUserDefinedRoleRelationshipsResponse) HasLastModifiedByUser() bool { + return o != nil && o.LastModifiedByUser != nil +} + +// SetLastModifiedByUser gets a reference to the given RelationshipToUser and assigns it to the LastModifiedByUser field. +func (o *IncidentUserDefinedRoleRelationshipsResponse) SetLastModifiedByUser(v RelationshipToUser) { + o.LastModifiedByUser = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUserDefinedRoleRelationshipsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CreatedByUser != nil { + toSerialize["created_by_user"] = o.CreatedByUser + } + if o.IncidentType != nil { + toSerialize["incident_type"] = o.IncidentType + } + if o.LastModifiedByUser != nil { + toSerialize["last_modified_by_user"] = o.LastModifiedByUser + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUserDefinedRoleRelationshipsResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedByUser *RelationshipToUser `json:"created_by_user,omitempty"` + IncidentType *IncidentUserDefinedRoleIncidentTypeRelationship `json:"incident_type,omitempty"` + LastModifiedByUser *RelationshipToUser `json:"last_modified_by_user,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_by_user", "incident_type", "last_modified_by_user"}) + } else { + return err + } + + hasInvalidField := false + if all.CreatedByUser != nil && all.CreatedByUser.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CreatedByUser = all.CreatedByUser + if all.IncidentType != nil && all.IncidentType.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.IncidentType = all.IncidentType + if all.LastModifiedByUser != nil && all.LastModifiedByUser.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LastModifiedByUser = all.LastModifiedByUser + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_user_defined_role_request.go b/api/datadogV2/model_incident_user_defined_role_request.go new file mode 100644 index 00000000000..77368d40001 --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_role_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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRoleRequest Request for creating an incident user-defined role. +type IncidentUserDefinedRoleRequest struct { + // Data for creating an incident user-defined role. + Data IncidentUserDefinedRoleDataRequest `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewIncidentUserDefinedRoleRequest instantiates a new IncidentUserDefinedRoleRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentUserDefinedRoleRequest(data IncidentUserDefinedRoleDataRequest) *IncidentUserDefinedRoleRequest { + this := IncidentUserDefinedRoleRequest{} + this.Data = data + return &this +} + +// NewIncidentUserDefinedRoleRequestWithDefaults instantiates a new IncidentUserDefinedRoleRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentUserDefinedRoleRequestWithDefaults() *IncidentUserDefinedRoleRequest { + this := IncidentUserDefinedRoleRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentUserDefinedRoleRequest) GetData() IncidentUserDefinedRoleDataRequest { + if o == nil { + var ret IncidentUserDefinedRoleDataRequest + 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 *IncidentUserDefinedRoleRequest) GetDataOk() (*IncidentUserDefinedRoleDataRequest, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentUserDefinedRoleRequest) SetData(v IncidentUserDefinedRoleDataRequest) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUserDefinedRoleRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUserDefinedRoleRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentUserDefinedRoleDataRequest `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_user_defined_role_response.go b/api/datadogV2/model_incident_user_defined_role_response.go new file mode 100644 index 00000000000..3050bf5089e --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_role_response.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRoleResponse Response with a single incident user-defined role. +type IncidentUserDefinedRoleResponse struct { + // Data for an incident user-defined role response. + Data IncidentUserDefinedRoleDataResponse `json:"data"` + // Included resources for an incident user-defined role response. + Included []IncidentUserDefinedRoleIncludedItem `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{} `json:"-"` +} + +// NewIncidentUserDefinedRoleResponse instantiates a new IncidentUserDefinedRoleResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentUserDefinedRoleResponse(data IncidentUserDefinedRoleDataResponse) *IncidentUserDefinedRoleResponse { + this := IncidentUserDefinedRoleResponse{} + this.Data = data + return &this +} + +// NewIncidentUserDefinedRoleResponseWithDefaults instantiates a new IncidentUserDefinedRoleResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentUserDefinedRoleResponseWithDefaults() *IncidentUserDefinedRoleResponse { + this := IncidentUserDefinedRoleResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentUserDefinedRoleResponse) GetData() IncidentUserDefinedRoleDataResponse { + if o == nil { + var ret IncidentUserDefinedRoleDataResponse + 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 *IncidentUserDefinedRoleResponse) GetDataOk() (*IncidentUserDefinedRoleDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentUserDefinedRoleResponse) SetData(v IncidentUserDefinedRoleDataResponse) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentUserDefinedRoleResponse) GetIncluded() []IncidentUserDefinedRoleIncludedItem { + if o == nil || o.Included == nil { + var ret []IncidentUserDefinedRoleIncludedItem + 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 *IncidentUserDefinedRoleResponse) GetIncludedOk() (*[]IncidentUserDefinedRoleIncludedItem, 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 *IncidentUserDefinedRoleResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []IncidentUserDefinedRoleIncludedItem and assigns it to the Included field. +func (o *IncidentUserDefinedRoleResponse) SetIncluded(v []IncidentUserDefinedRoleIncludedItem) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUserDefinedRoleResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUserDefinedRoleResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *IncidentUserDefinedRoleDataResponse `json:"data"` + Included []IncidentUserDefinedRoleIncludedItem `json:"included,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + o.Included = all.Included + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_incident_user_defined_role_type.go b/api/datadogV2/model_incident_user_defined_role_type.go new file mode 100644 index 00000000000..0cc63ceaed0 --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_role_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRoleType Incident user-defined role resource type. +type IncidentUserDefinedRoleType string + +// List of IncidentUserDefinedRoleType. +const ( + INCIDENTUSERDEFINEDROLETYPE_INCIDENT_USER_DEFINED_ROLES IncidentUserDefinedRoleType = "incident_user_defined_roles" +) + +var allowedIncidentUserDefinedRoleTypeEnumValues = []IncidentUserDefinedRoleType{ + INCIDENTUSERDEFINEDROLETYPE_INCIDENT_USER_DEFINED_ROLES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *IncidentUserDefinedRoleType) GetAllowedValues() []IncidentUserDefinedRoleType { + return allowedIncidentUserDefinedRoleTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *IncidentUserDefinedRoleType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = IncidentUserDefinedRoleType(value) + return nil +} + +// NewIncidentUserDefinedRoleTypeFromValue returns a pointer to a valid IncidentUserDefinedRoleType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewIncidentUserDefinedRoleTypeFromValue(v string) (*IncidentUserDefinedRoleType, error) { + ev := IncidentUserDefinedRoleType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for IncidentUserDefinedRoleType: valid values are %v", v, allowedIncidentUserDefinedRoleTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v IncidentUserDefinedRoleType) IsValid() bool { + for _, existing := range allowedIncidentUserDefinedRoleTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to IncidentUserDefinedRoleType value. +func (v IncidentUserDefinedRoleType) Ptr() *IncidentUserDefinedRoleType { + return &v +} diff --git a/api/datadogV2/model_incident_user_defined_roles_response.go b/api/datadogV2/model_incident_user_defined_roles_response.go new file mode 100644 index 00000000000..1117448f191 --- /dev/null +++ b/api/datadogV2/model_incident_user_defined_roles_response.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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// IncidentUserDefinedRolesResponse Response with a list of incident user-defined roles. +type IncidentUserDefinedRolesResponse struct { + // List of incident user-defined role data objects. + Data []IncidentUserDefinedRoleDataResponse `json:"data"` + // Included resources for an incident user-defined role response. + Included []IncidentUserDefinedRoleIncludedItem `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{} `json:"-"` +} + +// NewIncidentUserDefinedRolesResponse instantiates a new IncidentUserDefinedRolesResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewIncidentUserDefinedRolesResponse(data []IncidentUserDefinedRoleDataResponse) *IncidentUserDefinedRolesResponse { + this := IncidentUserDefinedRolesResponse{} + this.Data = data + return &this +} + +// NewIncidentUserDefinedRolesResponseWithDefaults instantiates a new IncidentUserDefinedRolesResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewIncidentUserDefinedRolesResponseWithDefaults() *IncidentUserDefinedRolesResponse { + this := IncidentUserDefinedRolesResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *IncidentUserDefinedRolesResponse) GetData() []IncidentUserDefinedRoleDataResponse { + if o == nil { + var ret []IncidentUserDefinedRoleDataResponse + 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 *IncidentUserDefinedRolesResponse) GetDataOk() (*[]IncidentUserDefinedRoleDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *IncidentUserDefinedRolesResponse) SetData(v []IncidentUserDefinedRoleDataResponse) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *IncidentUserDefinedRolesResponse) GetIncluded() []IncidentUserDefinedRoleIncludedItem { + if o == nil || o.Included == nil { + var ret []IncidentUserDefinedRoleIncludedItem + 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 *IncidentUserDefinedRolesResponse) GetIncludedOk() (*[]IncidentUserDefinedRoleIncludedItem, 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 *IncidentUserDefinedRolesResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []IncidentUserDefinedRoleIncludedItem and assigns it to the Included field. +func (o *IncidentUserDefinedRolesResponse) SetIncluded(v []IncidentUserDefinedRoleIncludedItem) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o IncidentUserDefinedRolesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.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 datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *IncidentUserDefinedRolesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]IncidentUserDefinedRoleDataResponse `json:"data"` + Included []IncidentUserDefinedRoleIncludedItem `json:"included,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) + } else { + return err + } + o.Data = *all.Data + o.Included = all.Included + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/examples/v2/incidents/PatchIncidentImpact.go b/examples/v2/incidents/PatchIncidentImpact.go new file mode 100644 index 00000000000..8fc61f4b5a4 --- /dev/null +++ b/examples/v2/incidents/PatchIncidentImpact.go @@ -0,0 +1,45 @@ +// Patch an incident impact returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.IncidentImpactCreateRequest{ + Data: datadogV2.IncidentImpactCreateData{ + Attributes: datadogV2.IncidentImpactCreateAttributes{ + Description: "Service was unavailable for external users", + EndAt: *datadog.NewNullableTime(datadog.PtrTime(time.Date(2025, 8, 29, 13, 17, 0, 0, time.UTC))), + Fields: map[string]interface{}{ + "customers_impacted": "all", + "products_impacted": "['shopping', 'marketing']", + }, + StartAt: time.Date(2025, 8, 28, 13, 17, 0, 0, time.UTC), + }, + Type: datadogV2.INCIDENTIMPACTTYPE_INCIDENT_IMPACTS, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.PatchIncidentImpact", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewIncidentsApi(apiClient) + resp, r, err := api.PatchIncidentImpact(ctx, "incident_id", "impact_id", body, *datadogV2.NewPatchIncidentImpactOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.PatchIncidentImpact`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.PatchIncidentImpact`:\n%s\n", responseContent) +} diff --git a/examples/v2/incidents/UpdateIncidentImpact.go b/examples/v2/incidents/UpdateIncidentImpact.go new file mode 100644 index 00000000000..ee617a19e6f --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentImpact.go @@ -0,0 +1,45 @@ +// Update an incident impact returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.IncidentImpactCreateRequest{ + Data: datadogV2.IncidentImpactCreateData{ + Attributes: datadogV2.IncidentImpactCreateAttributes{ + Description: "Service was unavailable for external users", + EndAt: *datadog.NewNullableTime(datadog.PtrTime(time.Date(2025, 8, 29, 13, 17, 0, 0, time.UTC))), + Fields: map[string]interface{}{ + "customers_impacted": "all", + "products_impacted": "['shopping', 'marketing']", + }, + StartAt: time.Date(2025, 8, 28, 13, 17, 0, 0, time.UTC), + }, + Type: datadogV2.INCIDENTIMPACTTYPE_INCIDENT_IMPACTS, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.UpdateIncidentImpact", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewIncidentsApi(apiClient) + resp, r, err := api.UpdateIncidentImpact(ctx, "incident_id", "impact_id", body, *datadogV2.NewUpdateIncidentImpactOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.UpdateIncidentImpact`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.UpdateIncidentImpact`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/features/v2/incidents.feature b/tests/scenarios/features/v2/incidents.feature index e30ccb25292..ad6a8db18e1 100644 --- a/tests/scenarios/features/v2/incidents.feature +++ b/tests/scenarios/features/v2/incidents.feature @@ -1122,6 +1122,36 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app + Scenario: Patch an incident impact returns "Bad Request" response + Given operation "PatchIncidentImpact" enabled + And new "PatchIncidentImpact" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "impact_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Service was unavailable for external users", "end_at": "2025-08-29T13:17:00Z", "fields": {"customers_impacted": "all", "products_impacted": ["shopping", "marketing"]}, "start_at": "2025-08-28T13:17:00Z"}, "type": "incident_impacts"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Patch an incident impact returns "Not Found" response + Given operation "PatchIncidentImpact" enabled + And new "PatchIncidentImpact" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "impact_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Service was unavailable for external users", "end_at": "2025-08-29T13:17:00Z", "fields": {"customers_impacted": "all", "products_impacted": ["shopping", "marketing"]}, "start_at": "2025-08-28T13:17:00Z"}, "type": "incident_impacts"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/incident-app + Scenario: Patch an incident impact returns "OK" response + Given operation "PatchIncidentImpact" enabled + And new "PatchIncidentImpact" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "impact_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Service was unavailable for external users", "end_at": "2025-08-29T13:17:00Z", "fields": {"customers_impacted": "all", "products_impacted": ["shopping", "marketing"]}, "start_at": "2025-08-28T13:17:00Z"}, "type": "incident_impacts"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/incident-app Scenario: Remove commander from an incident returns "OK" response Given operation "UpdateIncident" enabled @@ -1232,6 +1262,36 @@ Feature: Incidents Then the response status is 200 OK And the response "data.attributes.title" is equal to "{{ incident.data.attributes.title }}-updated" + @generated @skip @team:DataDog/incident-app + Scenario: Update an incident impact returns "Bad Request" response + Given operation "UpdateIncidentImpact" enabled + And new "UpdateIncidentImpact" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "impact_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Service was unavailable for external users", "end_at": "2025-08-29T13:17:00Z", "fields": {"customers_impacted": "all", "products_impacted": ["shopping", "marketing"]}, "start_at": "2025-08-28T13:17:00Z"}, "type": "incident_impacts"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Update an incident impact returns "Not Found" response + Given operation "UpdateIncidentImpact" enabled + And new "UpdateIncidentImpact" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "impact_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Service was unavailable for external users", "end_at": "2025-08-29T13:17:00Z", "fields": {"customers_impacted": "all", "products_impacted": ["shopping", "marketing"]}, "start_at": "2025-08-28T13:17:00Z"}, "type": "incident_impacts"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/incident-app + Scenario: Update an incident impact returns "OK" response + Given operation "UpdateIncidentImpact" enabled + And new "UpdateIncidentImpact" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "impact_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Service was unavailable for external users", "end_at": "2025-08-29T13:17:00Z", "fields": {"customers_impacted": "all", "products_impacted": ["shopping", "marketing"]}, "start_at": "2025-08-28T13:17:00Z"}, "type": "incident_impacts"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:Datadog/incident-app Scenario: Update an incident notification rule returns "Bad Request" response Given operation "UpdateIncidentNotificationRule" enabled diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index f1a04b48a1a..e27a03165c9 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -2992,6 +2992,18 @@ "type": "idempotent" } }, + "PatchIncidentImpact": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, + "UpdateIncidentImpact": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, "ListIncidentIntegrations": { "tag": "Incidents", "undo": {