diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index ea8f0cd3e16b..397fab62c753 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -719,6 +719,14 @@ components: schema: default: false type: boolean + IncidentUserDefinedFieldIDPathParameter: + description: The ID of the incident user-defined field. + in: path + name: field_id + required: true + schema: + example: "00000000-0000-0000-0000-000000000000" + type: string Include: description: Include relationship data. explode: true @@ -32833,6 +32841,380 @@ components: type: $ref: "#/components/schemas/UsersType" type: object + IncidentUserDefinedFieldAttributesCreateRequest: + description: Attributes for creating an incident user-defined field. + properties: + category: + $ref: "#/components/schemas/IncidentUserDefinedFieldCategory" + collected: + $ref: "#/components/schemas/IncidentUserDefinedFieldCollected" + default_value: + description: The default value for the field. Must be one of the valid values when valid_values is set. + example: "critical" + nullable: true + type: string + display_name: + description: The human-readable name shown in the UI. Defaults to a formatted version of the name if not provided. + example: "Root Cause" + type: string + name: + description: The unique identifier of the field. Must start with a letter or digit and contain only letters, digits, underscores, or periods. + example: "root_cause" + type: string + ordinal: + description: A decimal string representing the field's display order in the UI. + example: "1.5" + nullable: true + type: string + required: + description: When true, users must fill out this field on incidents. + example: false + type: boolean + tag_key: + description: For metric tag-type fields only, the metric tag key that powers the autocomplete options. + example: "datacenter" + nullable: true + type: string + type: + $ref: "#/components/schemas/IncidentUserDefinedFieldFieldType" + valid_values: + description: The list of allowed values for dropdown and multiselect fields. Limited to 1000 values. + items: + $ref: "#/components/schemas/IncidentUserDefinedFieldValidValue" + type: array + required: + - name + - type + type: object + IncidentUserDefinedFieldAttributesResponse: + description: Attributes of an incident user-defined field. + properties: + attached_to: + description: The resource type this field is attached to. Always "incidents". + example: "incidents" + readOnly: true + type: string + category: + $ref: "#/components/schemas/IncidentUserDefinedFieldCategory" + collected: + $ref: "#/components/schemas/IncidentUserDefinedFieldCollected" + created: + description: Timestamp when the field was created. + example: "2026-03-18T08:40:05.185406Z" + format: date-time + readOnly: true + type: string + default_value: + description: The default value for the field. + example: "critical" + nullable: true + type: string + deleted: + description: Timestamp when the field was soft-deleted, or null if not deleted. + example: + format: date-time + nullable: true + readOnly: true + type: string + display_name: + description: The human-readable name shown in the UI. + example: "Root Cause" + type: string + metadata: + $ref: "#/components/schemas/IncidentUserDefinedFieldMetadata" + modified: + description: Timestamp when the field was last modified. + example: "2026-03-18T08:40:05.185406Z" + format: date-time + nullable: true + readOnly: true + type: string + name: + description: The unique identifier of the field. + example: "root_cause" + type: string + ordinal: + description: A decimal string representing the field's display order in the UI. + example: "1.5" + nullable: true + type: string + prerequisite: + description: Reserved for future use. Always null. + example: + nullable: true + readOnly: true + type: string + required: + description: When true, users must fill out this field on incidents. + example: false + type: boolean + reserved: + description: When true, this field is reserved for system use and cannot be deleted. + example: false + readOnly: true + type: boolean + table_id: + description: Reserved for internal use. Always 0. + example: 0 + format: int64 + readOnly: true + type: integer + tag_key: + description: For metric tag-type fields only, the metric tag key that powers the autocomplete options. + example: + nullable: true + type: string + type: + description: The data type of the field. 1=dropdown, 2=multiselect, 3=textbox, 4=textarray, 5=metrictag, 6=autocomplete, 7=number, 8=datetime. + example: 3 + format: int32 + maximum: 8 + minimum: 1 + nullable: true + type: integer + valid_values: + description: The list of allowed values for dropdown, multiselect, and autocomplete fields. + items: + $ref: "#/components/schemas/IncidentUserDefinedFieldValidValue" + nullable: true + type: array + required: + - attached_to + - category + - collected + - created + - default_value + - deleted + - display_name + - metadata + - modified + - name + - ordinal + - prerequisite + - required + - reserved + - table_id + - tag_key + - type + - valid_values + type: object + IncidentUserDefinedFieldAttributesUpdateRequest: + description: Attributes for updating an incident user-defined field. All fields are optional. + properties: + category: + $ref: "#/components/schemas/IncidentUserDefinedFieldCategory" + collected: + $ref: "#/components/schemas/IncidentUserDefinedFieldCollected" + default_value: + description: The default value for the field. Must be one of the valid values when valid_values is set. + example: "critical" + nullable: true + type: string + display_name: + description: The human-readable name shown in the UI. + example: "Root Cause" + type: string + ordinal: + description: A decimal string representing the field's display order in the UI. + example: "1.5" + nullable: true + type: string + required: + description: When true, users must fill out this field on incidents. + example: false + nullable: true + type: boolean + valid_values: + description: The list of allowed values for dropdown and multiselect fields. Limited to 1000 values. + items: + $ref: "#/components/schemas/IncidentUserDefinedFieldValidValue" + nullable: true + type: array + type: object + IncidentUserDefinedFieldCategory: + description: 'The section in which the field appears: "what_happened" or "why_it_happened". When null, the field appears in the Attributes section.' + enum: + - what_happened + - why_it_happened + example: what_happened + nullable: true + type: string + x-enum-varnames: + - WHAT_HAPPENED + - WHY_IT_HAPPENED + IncidentUserDefinedFieldCollected: + description: The lifecycle stage at which the app prompts users to fill out this field. Cannot be set on required fields. + enum: + - active + - stable + - resolved + - completed + example: active + nullable: true + type: string + x-enum-varnames: + - ACTIVE + - STABLE + - RESOLVED + - COMPLETED + IncidentUserDefinedFieldCreateData: + description: Data for creating an incident user-defined field. + properties: + attributes: + $ref: "#/components/schemas/IncidentUserDefinedFieldAttributesCreateRequest" + relationships: + $ref: "#/components/schemas/IncidentUserDefinedFieldCreateRelationships" + type: + $ref: "#/components/schemas/IncidentUserDefinedFieldType" + required: + - type + - attributes + - relationships + type: object + IncidentUserDefinedFieldCreateRelationships: + description: Relationships for creating an incident user-defined field. + properties: + incident_type: + $ref: "#/components/schemas/RelationshipToIncidentType" + required: + - incident_type + type: object + IncidentUserDefinedFieldCreateRequest: + description: Request body for creating an incident user-defined field. + properties: + data: + $ref: "#/components/schemas/IncidentUserDefinedFieldCreateData" + required: + - data + type: object + IncidentUserDefinedFieldFieldType: + description: The data type of the field. 1=dropdown, 2=multiselect, 3=textbox, 4=textarray, 5=metrictag, 6=autocomplete, 7=number, 8=datetime. + enum: + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + example: 3 + format: int32 + type: integer + x-enum-varnames: + - DROPDOWN + - MULTISELECT + - TEXTBOX + - TEXTARRAY + - METRICTAG + - AUTOCOMPLETE + - NUMBER + - DATETIME + IncidentUserDefinedFieldListMeta: + description: Pagination metadata for the user-defined field list response. + properties: + offset: + description: The offset of the current page. + example: 0 + format: int64 + type: integer + size: + description: The total number of items in the current page. + example: 5 + format: int64 + type: integer + type: object + IncidentUserDefinedFieldListResponse: + description: Response containing a list of incident user-defined fields. + properties: + data: + description: An array of user-defined field objects. + items: + $ref: "#/components/schemas/IncidentUserDefinedFieldResponseData" + type: array + meta: + $ref: "#/components/schemas/IncidentUserDefinedFieldListMeta" + required: + - data + - meta + type: object + IncidentUserDefinedFieldMetadata: + description: Metadata for autocomplete-type user-defined fields, describing how to populate autocomplete options. + nullable: true + properties: + category: + description: The category of the autocomplete source. + example: "teams_and_services" + type: string + search_limit_param: + description: The query parameter used to limit the number of autocomplete results. + example: "page[size]" + type: string + search_params: + additionalProperties: {} + description: Additional query parameters to include in the search URL. + type: object + search_query_param: + description: The query parameter used to pass typed input to the search URL. + example: "filter" + type: string + search_result_path: + description: The JSON path to the results in the response body. + example: "$.data[*].attributes.name" + type: string + search_url: + description: The URL used to populate autocomplete options. + example: "/api/v2/incidents/config/services" + type: string + required: + - category + - search_url + - search_query_param + - search_limit_param + - search_result_path + - search_params + type: object + IncidentUserDefinedFieldRelationships: + description: Relationships of an incident user-defined field. + properties: + created_by_user: + $ref: "#/components/schemas/RelationshipToUser" + incident_type: + $ref: "#/components/schemas/RelationshipToIncidentType" + last_modified_by_user: + $ref: "#/components/schemas/RelationshipToUser" + required: + - created_by_user + - last_modified_by_user + - incident_type + type: object + IncidentUserDefinedFieldResponse: + description: Response containing a single incident user-defined field. + properties: + data: + $ref: "#/components/schemas/IncidentUserDefinedFieldResponseData" + required: + - data + type: object + IncidentUserDefinedFieldResponseData: + description: Data object for an incident user-defined field response. + properties: + attributes: + $ref: "#/components/schemas/IncidentUserDefinedFieldAttributesResponse" + id: + description: The unique identifier of the user-defined field. + example: "00000000-0000-0000-0000-000000000000" + type: string + relationships: + $ref: "#/components/schemas/IncidentUserDefinedFieldRelationships" + type: + $ref: "#/components/schemas/IncidentUserDefinedFieldType" + required: + - id + - type + - attributes + - relationships + type: object IncidentUserDefinedFieldType: description: The incident user defined fields type. enum: @@ -32841,6 +33223,53 @@ components: type: string x-enum-varnames: - USER_DEFINED_FIELD + IncidentUserDefinedFieldUpdateData: + description: Data for updating an incident user-defined field. + properties: + attributes: + $ref: "#/components/schemas/IncidentUserDefinedFieldAttributesUpdateRequest" + id: + description: The unique identifier of the user-defined field to update. + example: "00000000-0000-0000-0000-000000000000" + type: string + type: + $ref: "#/components/schemas/IncidentUserDefinedFieldType" + required: + - id + - type + - attributes + type: object + IncidentUserDefinedFieldUpdateRequest: + description: Request body for updating an incident user-defined field. + properties: + data: + $ref: "#/components/schemas/IncidentUserDefinedFieldUpdateData" + required: + - data + type: object + IncidentUserDefinedFieldValidValue: + description: A valid value for an incident user-defined field. + properties: + description: + description: A detailed description of the valid value. + example: "A critical severity incident." + type: string + display_name: + description: The human-readable display name for this value. + example: "Critical" + type: string + short_description: + description: A short description of the valid value. + example: "Critical" + type: string + value: + description: The identifier that is stored when this option is selected. + example: "critical" + type: string + required: + - display_name + - value + type: object IncidentsResponse: description: Response with a list of incidents. properties: @@ -85550,6 +85979,440 @@ 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/user-defined-fields: + get: + description: Get a list of all incident user-defined fields. + operationId: ListIncidentUserDefinedFields + parameters: + - description: The number of results to return per page. Must be between 0 and 1000. + in: query + name: page[size] + schema: + default: 1000 + format: int64 + maximum: 1000 + minimum: 0 + type: integer + - description: The page number to retrieve, starting at 0. + in: query + name: page[number] + schema: + default: 0 + format: int64 + minimum: 0 + type: integer + - description: When true, include soft-deleted fields in the response. + in: query + name: include-deleted + schema: + default: false + type: boolean + - description: Filter results to fields associated with the given incident type UUID. + in: query + name: filter[incident-type] + schema: + type: string + - description: Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + in: query + name: include + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + attached_to: "incidents" + category: "what_happened" + collected: "active" + created: "2026-03-18T08:40:04.437887Z" + default_value: + deleted: + display_name: "Root Cause" + metadata: + modified: "2026-03-18T08:40:04.437887Z" + name: "root_cause" + ordinal: "1.1" + prerequisite: + required: false + reserved: false + table_id: 0 + tag_key: + type: 1 + valid_values: + - description: "A bug in the service code." + display_name: "Service Bug" + value: "service_bug" + id: "6f8f42e0-6a84-4495-9a24-6decb0a87de0" + relationships: + created_by_user: + data: + id: "00000000-0000-0000-0000-000000000001" + type: "users" + incident_type: + data: + id: "7459c30c-c661-4171-9474-db3a486377b2" + type: "incident_types" + last_modified_by_user: + data: + id: "00000000-0000-0000-0000-000000000001" + type: "users" + type: "user_defined_field" + meta: + offset: 0 + size: 1 + schema: + $ref: "#/components/schemas/IncidentUserDefinedFieldListResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_read + summary: Get a list of incident user-defined fields + tags: + - Incidents + x-permission: + operator: AND + 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 an incident user-defined field. + operationId: CreateIncidentUserDefinedField + parameters: + - description: Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + in: query + name: include + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/IncidentUserDefinedFieldCreateRequest" + description: Incident user-defined field payload. + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + attached_to: "incidents" + category: + collected: + created: "2026-03-18T08:40:05.185406Z" + default_value: + deleted: + display_name: "Root Cause" + metadata: + modified: "2026-03-18T08:40:05.185406Z" + name: "root_cause" + ordinal: "9" + prerequisite: + required: false + reserved: false + table_id: 0 + tag_key: + type: 3 + valid_values: + id: "82263487-b540-4c12-8797-58ac1d4fed17" + relationships: + created_by_user: + data: + id: "2f2c94fe-cd6e-4f8e-b9c7-d5755aca09a6" + type: "users" + incident_type: + data: + id: "7459c30c-c661-4171-9474-db3a486377b2" + type: "incident_types" + last_modified_by_user: + data: + id: "2f2c94fe-cd6e-4f8e-b9c7-d5755aca09a6" + type: "users" + type: "user_defined_field" + schema: + $ref: "#/components/schemas/IncidentUserDefinedFieldResponse" + description: CREATED + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "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: Create an incident user-defined field + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: AND + 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/user-defined-fields/{field_id}: + delete: + description: Delete an incident user-defined field. + operationId: DeleteIncidentUserDefinedField + parameters: + - $ref: "#/components/parameters/IncidentUserDefinedFieldIDPathParameter" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "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 field + tags: + - Incidents + x-permission: + operator: AND + 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/). + get: + description: Get details of an incident user-defined field. + operationId: GetIncidentUserDefinedField + parameters: + - $ref: "#/components/parameters/IncidentUserDefinedFieldIDPathParameter" + - description: Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + in: query + name: include + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + attached_to: "incidents" + category: "what_happened" + collected: "active" + created: "2026-03-18T08:40:04.437887Z" + default_value: + deleted: + display_name: "Root Cause" + metadata: + modified: "2026-03-18T08:40:04.437887Z" + name: "root_cause" + ordinal: "1.1" + prerequisite: + required: false + reserved: false + table_id: 0 + tag_key: + type: 1 + valid_values: + - description: "A bug in the service code." + display_name: "Service Bug" + value: "service_bug" + id: "6f8f42e0-6a84-4495-9a24-6decb0a87de0" + relationships: + created_by_user: + data: + id: "00000000-0000-0000-0000-000000000001" + type: "users" + incident_type: + data: + id: "7459c30c-c661-4171-9474-db3a486377b2" + type: "incident_types" + last_modified_by_user: + data: + id: "00000000-0000-0000-0000-000000000001" + type: "users" + type: "user_defined_field" + schema: + $ref: "#/components/schemas/IncidentUserDefinedFieldResponse" + description: OK + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_read + summary: Get an incident user-defined field + tags: + - Incidents + x-permission: + operator: AND + 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/). + patch: + description: Update an incident user-defined field. + operationId: UpdateIncidentUserDefinedField + parameters: + - $ref: "#/components/parameters/IncidentUserDefinedFieldIDPathParameter" + - description: Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + in: query + name: include + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/IncidentUserDefinedFieldUpdateRequest" + description: Incident user-defined field update payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + attached_to: "incidents" + category: "what_happened" + collected: + created: "2026-03-18T08:39:49.913895Z" + default_value: + deleted: + display_name: "Root Cause" + metadata: + modified: "2026-03-18T08:39:49.922909Z" + name: "root_cause" + ordinal: "8" + prerequisite: + required: false + reserved: false + table_id: 0 + tag_key: + type: 3 + valid_values: + id: "13a731a3-a010-450e-b6a3-3d450a26170c" + relationships: + created_by_user: + data: + id: "8e7d4859-0916-4df8-b51c-5f5a4ea7815e" + type: "users" + incident_type: + data: + id: "95edc42f-c55d-46fa-92a1-a182646454af" + type: "incident_types" + last_modified_by_user: + data: + id: "8e7d4859-0916-4df8-b51c-5f5a4ea7815e" + type: "users" + type: "user_defined_field" + schema: + $ref: "#/components/schemas/IncidentUserDefinedFieldResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "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 field + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: AND + 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/import: post: description: |- diff --git a/features/v2/incidents.feature b/features/v2/incidents.feature index 8b804137aff6..119fa0a284e9 100644 --- a/features/v2/incidents.feature +++ b/features/v2/incidents.feature @@ -186,6 +186,30 @@ Feature: Incidents When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app + Scenario: Create an incident user-defined field returns "Bad Request" response + Given operation "CreateIncidentUserDefinedField" enabled + And new "CreateIncidentUserDefinedField" request + And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "name": "root_cause", "ordinal": "1.5", "required": false, "tag_key": "datacenter", "type": 3, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}}, "type": "user_defined_field"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Create an incident user-defined field returns "CREATED" response + Given operation "CreateIncidentUserDefinedField" enabled + And new "CreateIncidentUserDefinedField" request + And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "name": "root_cause", "ordinal": "1.5", "required": false, "tag_key": "datacenter", "type": 3, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}}, "type": "user_defined_field"}} + When the request is sent + Then the response status is 201 CREATED + + @generated @skip @team:DataDog/incident-app + Scenario: Create an incident user-defined field returns "Not Found" response + Given operation "CreateIncidentUserDefinedField" enabled + And new "CreateIncidentUserDefinedField" request + And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "name": "root_cause", "ordinal": "1.5", "required": false, "tag_key": "datacenter", "type": 3, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}}, "type": "user_defined_field"}} + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app Scenario: Create global incident handle returns "Bad Request" response Given operation "CreateGlobalIncidentHandle" enabled @@ -482,6 +506,30 @@ Feature: Incidents When the request is sent Then the response status is 204 OK + @generated @skip @team:DataDog/incident-app + Scenario: Delete an incident user-defined field returns "Bad Request" response + Given operation "DeleteIncidentUserDefinedField" enabled + And new "DeleteIncidentUserDefinedField" request + And request contains "field_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Delete an incident user-defined field returns "No Content" response + Given operation "DeleteIncidentUserDefinedField" enabled + And new "DeleteIncidentUserDefinedField" request + And request contains "field_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/incident-app + Scenario: Delete an incident user-defined field returns "Not Found" response + Given operation "DeleteIncidentUserDefinedField" enabled + And new "DeleteIncidentUserDefinedField" request + And request contains "field_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app Scenario: Delete global incident handle returns "Bad Request" response Given operation "DeleteGlobalIncidentHandle" enabled @@ -647,6 +695,20 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app + Scenario: Get a list of incident user-defined fields returns "Bad Request" response + Given operation "ListIncidentUserDefinedFields" enabled + And new "ListIncidentUserDefinedFields" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Get a list of incident user-defined fields returns "OK" response + Given operation "ListIncidentUserDefinedFields" enabled + And new "ListIncidentUserDefinedFields" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app Scenario: Get a list of incidents returns "Bad Request" response Given operation "ListIncidents" enabled @@ -703,6 +765,22 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app + Scenario: Get an incident user-defined field returns "Not Found" response + Given operation "GetIncidentUserDefinedField" enabled + And new "GetIncidentUserDefinedField" request + And request contains "field_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/incident-app + Scenario: Get an incident user-defined field returns "OK" response + Given operation "GetIncidentUserDefinedField" enabled + And new "GetIncidentUserDefinedField" request + And request contains "field_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app Scenario: Get global incident settings returns "Bad Request" response Given operation "GetGlobalIncidentSettings" enabled @@ -1243,6 +1321,33 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app + Scenario: Update an incident user-defined field returns "Bad Request" response + Given operation "UpdateIncidentUserDefinedField" enabled + And new "UpdateIncidentUserDefinedField" request + And request contains "field_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "ordinal": "1.5", "required": false, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "id": "00000000-0000-0000-0000-000000000000", "type": "user_defined_field"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Update an incident user-defined field returns "Not Found" response + Given operation "UpdateIncidentUserDefinedField" enabled + And new "UpdateIncidentUserDefinedField" request + And request contains "field_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "ordinal": "1.5", "required": false, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "id": "00000000-0000-0000-0000-000000000000", "type": "user_defined_field"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/incident-app + Scenario: Update an incident user-defined field returns "OK" response + Given operation "UpdateIncidentUserDefinedField" enabled + And new "UpdateIncidentUserDefinedField" request + And request contains "field_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "ordinal": "1.5", "required": false, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "id": "00000000-0000-0000-0000-000000000000", "type": "user_defined_field"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app Scenario: Update global incident handle returns "Bad Request" response Given operation "UpdateGlobalIncidentHandle" enabled diff --git a/features/v2/undo.json b/features/v2/undo.json index dcdc0219f9ca..db6b7dedc5ec 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2110,6 +2110,43 @@ "type": "idempotent" } }, + "ListIncidentUserDefinedFields": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "CreateIncidentUserDefinedField": { + "tag": "Incidents", + "undo": { + "operationId": "DeleteIncidentUserDefinedField", + "parameters": [ + { + "name": "field_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteIncidentUserDefinedField": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, + "GetIncidentUserDefinedField": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "UpdateIncidentUserDefinedField": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, "ImportIncident": { "tag": "Incidents", "undo": { diff --git a/private/bdd_runner/src/support/scenarios_model_mapping.ts b/private/bdd_runner/src/support/scenarios_model_mapping.ts index 5d2887effac2..7c73993aa97f 100644 --- a/private/bdd_runner/src/support/scenarios_model_mapping.ts +++ b/private/bdd_runner/src/support/scenarios_model_mapping.ts @@ -6576,6 +6576,73 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "IncidentTypeResponse", }, + "IncidentsApi.V2.ListIncidentUserDefinedFields": { + pageSize: { + type: "number", + format: "int64", + }, + pageNumber: { + type: "number", + format: "int64", + }, + includeDeleted: { + type: "boolean", + format: "", + }, + filterIncidentType: { + type: "string", + format: "", + }, + include: { + type: "string", + format: "", + }, + operationResponseType: "IncidentUserDefinedFieldListResponse", + }, + "IncidentsApi.V2.CreateIncidentUserDefinedField": { + include: { + type: "string", + format: "", + }, + body: { + type: "IncidentUserDefinedFieldCreateRequest", + format: "", + }, + operationResponseType: "IncidentUserDefinedFieldResponse", + }, + "IncidentsApi.V2.GetIncidentUserDefinedField": { + fieldId: { + type: "string", + format: "", + }, + include: { + type: "string", + format: "", + }, + operationResponseType: "IncidentUserDefinedFieldResponse", + }, + "IncidentsApi.V2.DeleteIncidentUserDefinedField": { + fieldId: { + type: "string", + format: "", + }, + operationResponseType: "{}", + }, + "IncidentsApi.V2.UpdateIncidentUserDefinedField": { + fieldId: { + type: "string", + format: "", + }, + include: { + type: "string", + format: "", + }, + body: { + type: "IncidentUserDefinedFieldUpdateRequest", + format: "", + }, + operationResponseType: "IncidentUserDefinedFieldResponse", + }, "IncidentsApi.V2.ImportIncident": { include: { type: "Array", diff --git a/services/incidents/src/v2/IncidentsApi.ts b/services/incidents/src/v2/IncidentsApi.ts index 3ff552382a88..96d75582f8c0 100644 --- a/services/incidents/src/v2/IncidentsApi.ts +++ b/services/incidents/src/v2/IncidentsApi.ts @@ -65,6 +65,10 @@ import { IncidentTypeListResponse } from "./models/IncidentTypeListResponse"; import { IncidentTypePatchRequest } from "./models/IncidentTypePatchRequest"; import { IncidentTypeResponse } from "./models/IncidentTypeResponse"; import { IncidentUpdateRequest } from "./models/IncidentUpdateRequest"; +import { IncidentUserDefinedFieldCreateRequest } from "./models/IncidentUserDefinedFieldCreateRequest"; +import { IncidentUserDefinedFieldListResponse } from "./models/IncidentUserDefinedFieldListResponse"; +import { IncidentUserDefinedFieldResponse } from "./models/IncidentUserDefinedFieldResponse"; +import { IncidentUserDefinedFieldUpdateRequest } from "./models/IncidentUserDefinedFieldUpdateRequest"; import { JSONAPIErrorResponse } from "./models/JSONAPIErrorResponse"; import { PatchAttachmentRequest } from "./models/PatchAttachmentRequest"; import { PatchIncidentNotificationTemplateRequest } from "./models/PatchIncidentNotificationTemplateRequest"; @@ -820,6 +824,77 @@ export class IncidentsApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async createIncidentUserDefinedField( + body: IncidentUserDefinedFieldCreateRequest, + include?: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations[ + "IncidentsApi.v2.createIncidentUserDefinedField" + ] + ) { + throw new Error( + "Unstable operation 'createIncidentUserDefinedField' is disabled. Enable it by setting `configuration.unstableOperations['IncidentsApi.v2.createIncidentUserDefinedField'] = true`", + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "createIncidentUserDefinedField"); + } + + // Path Params + const localVarPath = "/api/v2/incidents/config/user-defined-fields"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "IncidentsApi.v2.createIncidentUserDefinedField", + IncidentsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.POST, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Query Params + if (include !== undefined) { + requestContext.setQueryParam( + "include", + serialize(include, TypingInfo, "string", ""), + "", + ); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "IncidentUserDefinedFieldCreateRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async deleteGlobalIncidentHandle( _options?: Configuration, ): Promise { @@ -1384,6 +1459,62 @@ export class IncidentsApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async deleteIncidentUserDefinedField( + fieldId: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations[ + "IncidentsApi.v2.deleteIncidentUserDefinedField" + ] + ) { + throw new Error( + "Unstable operation 'deleteIncidentUserDefinedField' is disabled. Enable it by setting `configuration.unstableOperations['IncidentsApi.v2.deleteIncidentUserDefinedField'] = true`", + ); + } + + // verify required parameter 'fieldId' is not null or undefined + if (fieldId === null || fieldId === undefined) { + throw new RequiredError("fieldId", "deleteIncidentUserDefinedField"); + } + + // Path Params + const localVarPath = + "/api/v2/incidents/config/user-defined-fields/{field_id}".replace( + "{field_id}", + encodeURIComponent(String(fieldId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "IncidentsApi.v2.deleteIncidentUserDefinedField", + IncidentsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.DELETE, + overrides, + ); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async getGlobalIncidentSettings( _options?: Configuration, ): Promise { @@ -1845,6 +1976,70 @@ export class IncidentsApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async getIncidentUserDefinedField( + fieldId: string, + include?: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations["IncidentsApi.v2.getIncidentUserDefinedField"] + ) { + throw new Error( + "Unstable operation 'getIncidentUserDefinedField' is disabled. Enable it by setting `configuration.unstableOperations['IncidentsApi.v2.getIncidentUserDefinedField'] = true`", + ); + } + + // verify required parameter 'fieldId' is not null or undefined + if (fieldId === null || fieldId === undefined) { + throw new RequiredError("fieldId", "getIncidentUserDefinedField"); + } + + // Path Params + const localVarPath = + "/api/v2/incidents/config/user-defined-fields/{field_id}".replace( + "{field_id}", + encodeURIComponent(String(fieldId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "IncidentsApi.v2.getIncidentUserDefinedField", + IncidentsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Query Params + if (include !== undefined) { + requestContext.setQueryParam( + "include", + serialize(include, TypingInfo, "string", ""), + "", + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async importIncident( body: IncidentImportRequest, include?: Array, @@ -2491,6 +2686,94 @@ export class IncidentsApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async listIncidentUserDefinedFields( + pageSize?: number, + pageNumber?: number, + includeDeleted?: boolean, + filterIncidentType?: string, + include?: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations[ + "IncidentsApi.v2.listIncidentUserDefinedFields" + ] + ) { + throw new Error( + "Unstable operation 'listIncidentUserDefinedFields' is disabled. Enable it by setting `configuration.unstableOperations['IncidentsApi.v2.listIncidentUserDefinedFields'] = true`", + ); + } + + // Path Params + const localVarPath = "/api/v2/incidents/config/user-defined-fields"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "IncidentsApi.v2.listIncidentUserDefinedFields", + IncidentsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Query Params + if (pageSize !== undefined) { + requestContext.setQueryParam( + "page[size]", + serialize(pageSize, TypingInfo, "number", "int64"), + "", + ); + } + if (pageNumber !== undefined) { + requestContext.setQueryParam( + "page[number]", + serialize(pageNumber, TypingInfo, "number", "int64"), + "", + ); + } + if (includeDeleted !== undefined) { + requestContext.setQueryParam( + "include-deleted", + serialize(includeDeleted, TypingInfo, "boolean", ""), + "", + ); + } + if (filterIncidentType !== undefined) { + requestContext.setQueryParam( + "filter[incident-type]", + serialize(filterIncidentType, TypingInfo, "string", ""), + "", + ); + } + if (include !== undefined) { + requestContext.setQueryParam( + "include", + serialize(include, TypingInfo, "string", ""), + "", + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + public async searchIncidents( query: string, include?: IncidentRelatedObject, @@ -3328,25 +3611,106 @@ export class IncidentsApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } -} -export class IncidentsApiResponseProcessor { - /** - * Unwraps the actual response sent by the server from the response context and deserializes the response content - * to the expected objects - * - * @params response Response returned by the server for a request to createGlobalIncidentHandle - * @throws ApiException if the response code was not in [200, 299] - */ - public async createGlobalIncidentHandle( - response: ResponseContext, - ): Promise { - const contentType = normalizeMediaType(response.headers["content-type"]); - if (response.httpStatusCode === 201) { - const body: IncidentHandleResponse = deserialize( - parse(await response.body.text(), contentType), - TypingInfo, - "IncidentHandleResponse", + public async updateIncidentUserDefinedField( + fieldId: string, + body: IncidentUserDefinedFieldUpdateRequest, + include?: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations[ + "IncidentsApi.v2.updateIncidentUserDefinedField" + ] + ) { + throw new Error( + "Unstable operation 'updateIncidentUserDefinedField' is disabled. Enable it by setting `configuration.unstableOperations['IncidentsApi.v2.updateIncidentUserDefinedField'] = true`", + ); + } + + // verify required parameter 'fieldId' is not null or undefined + if (fieldId === null || fieldId === undefined) { + throw new RequiredError("fieldId", "updateIncidentUserDefinedField"); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "updateIncidentUserDefinedField"); + } + + // Path Params + const localVarPath = + "/api/v2/incidents/config/user-defined-fields/{field_id}".replace( + "{field_id}", + encodeURIComponent(String(fieldId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "IncidentsApi.v2.updateIncidentUserDefinedField", + IncidentsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.PATCH, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Query Params + if (include !== undefined) { + requestContext.setQueryParam( + "include", + serialize(include, TypingInfo, "string", ""), + "", + ); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "IncidentUserDefinedFieldUpdateRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } +} + +export class IncidentsApiResponseProcessor { + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createGlobalIncidentHandle + * @throws ApiException if the response code was not in [200, 299] + */ + public async createGlobalIncidentHandle( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 201) { + const body: IncidentHandleResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "IncidentHandleResponse", ) as IncidentHandleResponse; return body; } @@ -4056,6 +4420,87 @@ export class IncidentsApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createIncidentUserDefinedField + * @throws ApiException if the response code was not in [200, 299] + */ + public async createIncidentUserDefinedField( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 201) { + const body: IncidentUserDefinedFieldResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "IncidentUserDefinedFieldResponse", + ) as IncidentUserDefinedFieldResponse; + return body; + } + if (response.httpStatusCode === 400 || response.httpStatusCode === 404) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if ( + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: IncidentUserDefinedFieldResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "IncidentUserDefinedFieldResponse", + "", + ) as IncidentUserDefinedFieldResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -4586,6 +5031,76 @@ export class IncidentsApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteIncidentUserDefinedField + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteIncidentUserDefinedField( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 204) { + return; + } + if (response.httpStatusCode === 400 || response.httpStatusCode === 404) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if ( + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -5112,6 +5627,87 @@ export class IncidentsApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getIncidentUserDefinedField + * @throws ApiException if the response code was not in [200, 299] + */ + public async getIncidentUserDefinedField( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: IncidentUserDefinedFieldResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "IncidentUserDefinedFieldResponse", + ) as IncidentUserDefinedFieldResponse; + return body; + } + if ( + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + if (response.httpStatusCode === 404) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: IncidentUserDefinedFieldResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "IncidentUserDefinedFieldResponse", + "", + ) as IncidentUserDefinedFieldResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -5743,9 +6339,70 @@ export class IncidentsApiResponseProcessor { const body: IncidentTodoListResponse = deserialize( parse(await response.body.text(), contentType), TypingInfo, - "IncidentTodoListResponse", + "IncidentTodoListResponse", + "", + ) as IncidentTodoListResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listIncidentTypes + * @throws ApiException if the response code was not in [200, 299] + */ + public async listIncidentTypes( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: IncidentTypeListResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "IncidentTypeListResponse", + ) as IncidentTypeListResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: IncidentTypeListResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "IncidentTypeListResponse", "", - ) as IncidentTodoListResponse; + ) as IncidentTypeListResponse; return body; } @@ -5760,23 +6417,43 @@ export class IncidentsApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to listIncidentTypes + * @params response Response returned by the server for a request to listIncidentUserDefinedFields * @throws ApiException if the response code was not in [200, 299] */ - public async listIncidentTypes( + public async listIncidentUserDefinedFields( response: ResponseContext, - ): Promise { + ): Promise { const contentType = normalizeMediaType(response.headers["content-type"]); if (response.httpStatusCode === 200) { - const body: IncidentTypeListResponse = deserialize( + const body: IncidentUserDefinedFieldListResponse = deserialize( parse(await response.body.text(), contentType), TypingInfo, - "IncidentTypeListResponse", - ) as IncidentTypeListResponse; + "IncidentUserDefinedFieldListResponse", + ) as IncidentUserDefinedFieldListResponse; return body; } + if (response.httpStatusCode === 400) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } if ( - response.httpStatusCode === 400 || response.httpStatusCode === 401 || response.httpStatusCode === 403 || response.httpStatusCode === 429 @@ -5801,12 +6478,12 @@ export class IncidentsApiResponseProcessor { // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { - const body: IncidentTypeListResponse = deserialize( + const body: IncidentUserDefinedFieldListResponse = deserialize( parse(await response.body.text(), contentType), TypingInfo, - "IncidentTypeListResponse", + "IncidentUserDefinedFieldListResponse", "", - ) as IncidentTypeListResponse; + ) as IncidentUserDefinedFieldListResponse; return body; } @@ -6542,6 +7219,87 @@ export class IncidentsApiResponseProcessor { 'Unknown API Status Code!\nBody: "' + body + '"', ); } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to updateIncidentUserDefinedField + * @throws ApiException if the response code was not in [200, 299] + */ + public async updateIncidentUserDefinedField( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: IncidentUserDefinedFieldResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "IncidentUserDefinedFieldResponse", + ) as IncidentUserDefinedFieldResponse; + return body; + } + if (response.httpStatusCode === 400 || response.httpStatusCode === 404) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if ( + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: IncidentUserDefinedFieldResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "IncidentUserDefinedFieldResponse", + "", + ) as IncidentUserDefinedFieldResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } } export interface IncidentsApiCreateGlobalIncidentHandleRequest { @@ -6666,6 +7424,19 @@ export interface IncidentsApiCreateIncidentTypeRequest { body: IncidentTypeCreateRequest; } +export interface IncidentsApiCreateIncidentUserDefinedFieldRequest { + /** + * Incident user-defined field payload. + * @type IncidentUserDefinedFieldCreateRequest + */ + body: IncidentUserDefinedFieldCreateRequest; + /** + * Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + * @type string + */ + include?: string; +} + export interface IncidentsApiDeleteIncidentRequest { /** * The UUID of the incident. @@ -6768,6 +7539,14 @@ export interface IncidentsApiDeleteIncidentTypeRequest { incidentTypeId: string; } +export interface IncidentsApiDeleteIncidentUserDefinedFieldRequest { + /** + * The ID of the incident user-defined field. + * @type string + */ + fieldId: string; +} + export interface IncidentsApiGetIncidentRequest { /** * The UUID of the incident. @@ -6849,6 +7628,19 @@ export interface IncidentsApiGetIncidentTypeRequest { incidentTypeId: string; } +export interface IncidentsApiGetIncidentUserDefinedFieldRequest { + /** + * The ID of the incident user-defined field. + * @type string + */ + fieldId: string; + /** + * Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + * @type string + */ + include?: string; +} + export interface IncidentsApiImportIncidentRequest { /** * Incident import payload. @@ -6964,6 +7756,34 @@ export interface IncidentsApiListIncidentTypesRequest { includeDeleted?: boolean; } +export interface IncidentsApiListIncidentUserDefinedFieldsRequest { + /** + * The number of results to return per page. Must be between 0 and 1000. + * @type number + */ + pageSize?: number; + /** + * The page number to retrieve, starting at 0. + * @type number + */ + pageNumber?: number; + /** + * When true, include soft-deleted fields in the response. + * @type boolean + */ + includeDeleted?: boolean; + /** + * Filter results to fields associated with the given incident type UUID. + * @type string + */ + filterIncidentType?: string; + /** + * Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + * @type string + */ + include?: string; +} + export interface IncidentsApiSearchIncidentsRequest { /** * Specifies which incidents should be returned. The query can contain any number of incident facets @@ -7148,6 +7968,24 @@ export interface IncidentsApiUpdateIncidentTypeRequest { body: IncidentTypePatchRequest; } +export interface IncidentsApiUpdateIncidentUserDefinedFieldRequest { + /** + * The ID of the incident user-defined field. + * @type string + */ + fieldId: string; + /** + * Incident user-defined field update payload. + * @type IncidentUserDefinedFieldUpdateRequest + */ + body: IncidentUserDefinedFieldUpdateRequest; + /** + * Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + * @type string + */ + include?: string; +} + export class IncidentsApi { private requestFactory: IncidentsApiRequestFactory; private responseProcessor: IncidentsApiResponseProcessor; @@ -7423,6 +8261,31 @@ export class IncidentsApi { }); } + /** + * Create an incident user-defined field. + * @param param The request object + */ + public createIncidentUserDefinedField( + param: IncidentsApiCreateIncidentUserDefinedFieldRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = + this.requestFactory.createIncidentUserDefinedField( + param.body, + param.include, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createIncidentUserDefinedField( + responseContext, + ); + }); + }); + } + /** * Delete a global incident handle. * @param param The request object @@ -7648,6 +8511,30 @@ export class IncidentsApi { }); } + /** + * Delete an incident user-defined field. + * @param param The request object + */ + public deleteIncidentUserDefinedField( + param: IncidentsApiDeleteIncidentUserDefinedFieldRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = + this.requestFactory.deleteIncidentUserDefinedField( + param.fieldId, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteIncidentUserDefinedField( + responseContext, + ); + }); + }); + } + /** * Retrieve global incident settings for the organization. * @param param The request object @@ -7829,6 +8716,31 @@ export class IncidentsApi { }); } + /** + * Get details of an incident user-defined field. + * @param param The request object + */ + public getIncidentUserDefinedField( + param: IncidentsApiGetIncidentUserDefinedFieldRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = + this.requestFactory.getIncidentUserDefinedField( + param.fieldId, + param.include, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getIncidentUserDefinedField( + responseContext, + ); + }); + }); + } + /** * 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. @@ -8120,6 +9032,34 @@ export class IncidentsApi { }); } + /** + * Get a list of all incident user-defined fields. + * @param param The request object + */ + public listIncidentUserDefinedFields( + param: IncidentsApiListIncidentUserDefinedFieldsRequest = {}, + options?: Configuration, + ): Promise { + const requestContextPromise = + this.requestFactory.listIncidentUserDefinedFields( + param.pageSize, + param.pageNumber, + param.includeDeleted, + param.filterIncidentType, + param.include, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listIncidentUserDefinedFields( + responseContext, + ); + }); + }); + } + /** * Search for incidents matching a certain query. * @param param The request object @@ -8438,4 +9378,30 @@ export class IncidentsApi { }); }); } + + /** + * Update an incident user-defined field. + * @param param The request object + */ + public updateIncidentUserDefinedField( + param: IncidentsApiUpdateIncidentUserDefinedFieldRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = + this.requestFactory.updateIncidentUserDefinedField( + param.fieldId, + param.body, + param.include, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.updateIncidentUserDefinedField( + responseContext, + ); + }); + }); + } } diff --git a/services/incidents/src/v2/index.ts b/services/incidents/src/v2/index.ts index 7f512c181bbf..2d0c002e2713 100644 --- a/services/incidents/src/v2/index.ts +++ b/services/incidents/src/v2/index.ts @@ -10,6 +10,7 @@ export { IncidentsApiCreateIncidentPostmortemTemplateRequest, IncidentsApiCreateIncidentTodoRequest, IncidentsApiCreateIncidentTypeRequest, + IncidentsApiCreateIncidentUserDefinedFieldRequest, IncidentsApiDeleteIncidentRequest, IncidentsApiDeleteIncidentAttachmentRequest, IncidentsApiDeleteIncidentImpactRequest, @@ -19,6 +20,7 @@ export { IncidentsApiDeleteIncidentPostmortemTemplateRequest, IncidentsApiDeleteIncidentTodoRequest, IncidentsApiDeleteIncidentTypeRequest, + IncidentsApiDeleteIncidentUserDefinedFieldRequest, IncidentsApiGetIncidentRequest, IncidentsApiGetIncidentIntegrationRequest, IncidentsApiGetIncidentNotificationRuleRequest, @@ -26,6 +28,7 @@ export { IncidentsApiGetIncidentPostmortemTemplateRequest, IncidentsApiGetIncidentTodoRequest, IncidentsApiGetIncidentTypeRequest, + IncidentsApiGetIncidentUserDefinedFieldRequest, IncidentsApiImportIncidentRequest, IncidentsApiListGlobalIncidentHandlesRequest, IncidentsApiListIncidentAttachmentsRequest, @@ -35,6 +38,7 @@ export { IncidentsApiListIncidentNotificationTemplatesRequest, IncidentsApiListIncidentTodosRequest, IncidentsApiListIncidentTypesRequest, + IncidentsApiListIncidentUserDefinedFieldsRequest, IncidentsApiListIncidentsRequest, IncidentsApiSearchIncidentsRequest, IncidentsApiUpdateGlobalIncidentHandleRequest, @@ -47,6 +51,7 @@ export { IncidentsApiUpdateIncidentPostmortemTemplateRequest, IncidentsApiUpdateIncidentTodoRequest, IncidentsApiUpdateIncidentTypeRequest, + IncidentsApiUpdateIncidentUserDefinedFieldRequest, IncidentsApi, } from "./IncidentsApi"; @@ -229,7 +234,25 @@ export { IncidentUpdateRelationships } from "./models/IncidentUpdateRelationship export { IncidentUpdateRequest } from "./models/IncidentUpdateRequest"; export { IncidentUserAttributes } from "./models/IncidentUserAttributes"; export { IncidentUserData } from "./models/IncidentUserData"; +export { IncidentUserDefinedFieldAttributesCreateRequest } from "./models/IncidentUserDefinedFieldAttributesCreateRequest"; +export { IncidentUserDefinedFieldAttributesResponse } from "./models/IncidentUserDefinedFieldAttributesResponse"; +export { IncidentUserDefinedFieldAttributesUpdateRequest } from "./models/IncidentUserDefinedFieldAttributesUpdateRequest"; +export { IncidentUserDefinedFieldCategory } from "./models/IncidentUserDefinedFieldCategory"; +export { IncidentUserDefinedFieldCollected } from "./models/IncidentUserDefinedFieldCollected"; +export { IncidentUserDefinedFieldCreateData } from "./models/IncidentUserDefinedFieldCreateData"; +export { IncidentUserDefinedFieldCreateRelationships } from "./models/IncidentUserDefinedFieldCreateRelationships"; +export { IncidentUserDefinedFieldCreateRequest } from "./models/IncidentUserDefinedFieldCreateRequest"; +export { IncidentUserDefinedFieldFieldType } from "./models/IncidentUserDefinedFieldFieldType"; +export { IncidentUserDefinedFieldListMeta } from "./models/IncidentUserDefinedFieldListMeta"; +export { IncidentUserDefinedFieldListResponse } from "./models/IncidentUserDefinedFieldListResponse"; +export { IncidentUserDefinedFieldMetadata } from "./models/IncidentUserDefinedFieldMetadata"; +export { IncidentUserDefinedFieldRelationships } from "./models/IncidentUserDefinedFieldRelationships"; +export { IncidentUserDefinedFieldResponse } from "./models/IncidentUserDefinedFieldResponse"; +export { IncidentUserDefinedFieldResponseData } from "./models/IncidentUserDefinedFieldResponseData"; export { IncidentUserDefinedFieldType } from "./models/IncidentUserDefinedFieldType"; +export { IncidentUserDefinedFieldUpdateData } from "./models/IncidentUserDefinedFieldUpdateData"; +export { IncidentUserDefinedFieldUpdateRequest } from "./models/IncidentUserDefinedFieldUpdateRequest"; +export { IncidentUserDefinedFieldValidValue } from "./models/IncidentUserDefinedFieldValidValue"; export { JiraIntegrationMetadata } from "./models/JiraIntegrationMetadata"; export { JiraIntegrationMetadataIssuesItem } from "./models/JiraIntegrationMetadataIssuesItem"; export { JSONAPIErrorItem } from "./models/JSONAPIErrorItem"; diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldAttributesCreateRequest.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldAttributesCreateRequest.ts new file mode 100644 index 000000000000..f628714f9584 --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldAttributesCreateRequest.ts @@ -0,0 +1,124 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { IncidentUserDefinedFieldCategory } from "./IncidentUserDefinedFieldCategory"; +import { IncidentUserDefinedFieldCollected } from "./IncidentUserDefinedFieldCollected"; +import { IncidentUserDefinedFieldFieldType } from "./IncidentUserDefinedFieldFieldType"; +import { IncidentUserDefinedFieldValidValue } from "./IncidentUserDefinedFieldValidValue"; + +/** + * Attributes for creating an incident user-defined field. + */ +export class IncidentUserDefinedFieldAttributesCreateRequest { + /** + * The section in which the field appears: "what_happened" or "why_it_happened". When null, the field appears in the Attributes section. + */ + "category"?: IncidentUserDefinedFieldCategory; + /** + * The lifecycle stage at which the app prompts users to fill out this field. Cannot be set on required fields. + */ + "collected"?: IncidentUserDefinedFieldCollected; + /** + * The default value for the field. Must be one of the valid values when valid_values is set. + */ + "defaultValue"?: string; + /** + * The human-readable name shown in the UI. Defaults to a formatted version of the name if not provided. + */ + "displayName"?: string; + /** + * The unique identifier of the field. Must start with a letter or digit and contain only letters, digits, underscores, or periods. + */ + "name": string; + /** + * A decimal string representing the field's display order in the UI. + */ + "ordinal"?: string; + /** + * When true, users must fill out this field on incidents. + */ + "required"?: boolean; + /** + * For metric tag-type fields only, the metric tag key that powers the autocomplete options. + */ + "tagKey"?: string; + /** + * The data type of the field. 1=dropdown, 2=multiselect, 3=textbox, 4=textarray, 5=metrictag, 6=autocomplete, 7=number, 8=datetime. + */ + "type": IncidentUserDefinedFieldFieldType; + /** + * The list of allowed values for dropdown and multiselect fields. Limited to 1000 values. + */ + "validValues"?: Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + category: { + baseName: "category", + type: "IncidentUserDefinedFieldCategory", + }, + collected: { + baseName: "collected", + type: "IncidentUserDefinedFieldCollected", + }, + defaultValue: { + baseName: "default_value", + type: "string", + }, + displayName: { + baseName: "display_name", + type: "string", + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + ordinal: { + baseName: "ordinal", + type: "string", + }, + required: { + baseName: "required", + type: "boolean", + }, + tagKey: { + baseName: "tag_key", + type: "string", + }, + type: { + baseName: "type", + type: "IncidentUserDefinedFieldFieldType", + required: true, + format: "int32", + }, + validValues: { + baseName: "valid_values", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return IncidentUserDefinedFieldAttributesCreateRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldAttributesResponse.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldAttributesResponse.ts new file mode 100644 index 000000000000..86966b531155 --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldAttributesResponse.ts @@ -0,0 +1,208 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { IncidentUserDefinedFieldCategory } from "./IncidentUserDefinedFieldCategory"; +import { IncidentUserDefinedFieldCollected } from "./IncidentUserDefinedFieldCollected"; +import { IncidentUserDefinedFieldMetadata } from "./IncidentUserDefinedFieldMetadata"; +import { IncidentUserDefinedFieldValidValue } from "./IncidentUserDefinedFieldValidValue"; + +/** + * Attributes of an incident user-defined field. + */ +export class IncidentUserDefinedFieldAttributesResponse { + /** + * The resource type this field is attached to. Always "incidents". + */ + "attachedTo": string; + /** + * The section in which the field appears: "what_happened" or "why_it_happened". When null, the field appears in the Attributes section. + */ + "category": IncidentUserDefinedFieldCategory | null; + /** + * The lifecycle stage at which the app prompts users to fill out this field. Cannot be set on required fields. + */ + "collected": IncidentUserDefinedFieldCollected | null; + /** + * Timestamp when the field was created. + */ + "created": Date; + /** + * The default value for the field. + */ + "defaultValue": string | null; + /** + * Timestamp when the field was soft-deleted, or null if not deleted. + */ + "deleted": Date | null; + /** + * The human-readable name shown in the UI. + */ + "displayName": string; + /** + * Metadata for autocomplete-type user-defined fields, describing how to populate autocomplete options. + */ + "metadata": IncidentUserDefinedFieldMetadata | null; + /** + * Timestamp when the field was last modified. + */ + "modified": Date | null; + /** + * The unique identifier of the field. + */ + "name": string; + /** + * A decimal string representing the field's display order in the UI. + */ + "ordinal": string | null; + /** + * Reserved for future use. Always null. + */ + "prerequisite": string | null; + /** + * When true, users must fill out this field on incidents. + */ + "required": boolean; + /** + * When true, this field is reserved for system use and cannot be deleted. + */ + "reserved": boolean; + /** + * Reserved for internal use. Always 0. + */ + "tableId": number; + /** + * For metric tag-type fields only, the metric tag key that powers the autocomplete options. + */ + "tagKey": string | null; + /** + * The data type of the field. 1=dropdown, 2=multiselect, 3=textbox, 4=textarray, 5=metrictag, 6=autocomplete, 7=number, 8=datetime. + */ + "type": number | null; + /** + * The list of allowed values for dropdown, multiselect, and autocomplete fields. + */ + "validValues": Array | null; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attachedTo: { + baseName: "attached_to", + type: "string", + required: true, + }, + category: { + baseName: "category", + type: "IncidentUserDefinedFieldCategory", + required: true, + }, + collected: { + baseName: "collected", + type: "IncidentUserDefinedFieldCollected", + required: true, + }, + created: { + baseName: "created", + type: "Date", + required: true, + format: "date-time", + }, + defaultValue: { + baseName: "default_value", + type: "string", + required: true, + }, + deleted: { + baseName: "deleted", + type: "Date", + required: true, + format: "date-time", + }, + displayName: { + baseName: "display_name", + type: "string", + required: true, + }, + metadata: { + baseName: "metadata", + type: "IncidentUserDefinedFieldMetadata", + required: true, + }, + modified: { + baseName: "modified", + type: "Date", + required: true, + format: "date-time", + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + ordinal: { + baseName: "ordinal", + type: "string", + required: true, + }, + prerequisite: { + baseName: "prerequisite", + type: "string", + required: true, + }, + required: { + baseName: "required", + type: "boolean", + required: true, + }, + reserved: { + baseName: "reserved", + type: "boolean", + required: true, + }, + tableId: { + baseName: "table_id", + type: "number", + required: true, + format: "int64", + }, + tagKey: { + baseName: "tag_key", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "number", + required: true, + format: "int32", + }, + validValues: { + baseName: "valid_values", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return IncidentUserDefinedFieldAttributesResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldAttributesUpdateRequest.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldAttributesUpdateRequest.ts new file mode 100644 index 000000000000..6f390855b85f --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldAttributesUpdateRequest.ts @@ -0,0 +1,96 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { IncidentUserDefinedFieldCategory } from "./IncidentUserDefinedFieldCategory"; +import { IncidentUserDefinedFieldCollected } from "./IncidentUserDefinedFieldCollected"; +import { IncidentUserDefinedFieldValidValue } from "./IncidentUserDefinedFieldValidValue"; + +/** + * Attributes for updating an incident user-defined field. All fields are optional. + */ +export class IncidentUserDefinedFieldAttributesUpdateRequest { + /** + * The section in which the field appears: "what_happened" or "why_it_happened". When null, the field appears in the Attributes section. + */ + "category"?: IncidentUserDefinedFieldCategory; + /** + * The lifecycle stage at which the app prompts users to fill out this field. Cannot be set on required fields. + */ + "collected"?: IncidentUserDefinedFieldCollected; + /** + * The default value for the field. Must be one of the valid values when valid_values is set. + */ + "defaultValue"?: string; + /** + * The human-readable name shown in the UI. + */ + "displayName"?: string; + /** + * A decimal string representing the field's display order in the UI. + */ + "ordinal"?: string; + /** + * When true, users must fill out this field on incidents. + */ + "required"?: boolean; + /** + * The list of allowed values for dropdown and multiselect fields. Limited to 1000 values. + */ + "validValues"?: Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + category: { + baseName: "category", + type: "IncidentUserDefinedFieldCategory", + }, + collected: { + baseName: "collected", + type: "IncidentUserDefinedFieldCollected", + }, + defaultValue: { + baseName: "default_value", + type: "string", + }, + displayName: { + baseName: "display_name", + type: "string", + }, + ordinal: { + baseName: "ordinal", + type: "string", + }, + required: { + baseName: "required", + type: "boolean", + }, + validValues: { + baseName: "valid_values", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return IncidentUserDefinedFieldAttributesUpdateRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldCategory.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldCategory.ts new file mode 100644 index 000000000000..b76046c88f79 --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldCategory.ts @@ -0,0 +1,11 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The section in which the field appears: "what_happened" or "why_it_happened". When null, the field appears in the Attributes section. + */ +export type IncidentUserDefinedFieldCategory = + | typeof WHAT_HAPPENED + | typeof WHY_IT_HAPPENED + | UnparsedObject; +export const WHAT_HAPPENED = "what_happened"; +export const WHY_IT_HAPPENED = "why_it_happened"; diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldCollected.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldCollected.ts new file mode 100644 index 000000000000..9c99683aeddc --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldCollected.ts @@ -0,0 +1,15 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The lifecycle stage at which the app prompts users to fill out this field. Cannot be set on required fields. + */ +export type IncidentUserDefinedFieldCollected = + | typeof ACTIVE + | typeof STABLE + | typeof RESOLVED + | typeof COMPLETED + | UnparsedObject; +export const ACTIVE = "active"; +export const STABLE = "stable"; +export const RESOLVED = "resolved"; +export const COMPLETED = "completed"; diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldCreateData.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldCreateData.ts new file mode 100644 index 000000000000..39c912b16ae0 --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldCreateData.ts @@ -0,0 +1,67 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { IncidentUserDefinedFieldAttributesCreateRequest } from "./IncidentUserDefinedFieldAttributesCreateRequest"; +import { IncidentUserDefinedFieldCreateRelationships } from "./IncidentUserDefinedFieldCreateRelationships"; +import { IncidentUserDefinedFieldType } from "./IncidentUserDefinedFieldType"; + +/** + * Data for creating an incident user-defined field. + */ +export class IncidentUserDefinedFieldCreateData { + /** + * Attributes for creating an incident user-defined field. + */ + "attributes": IncidentUserDefinedFieldAttributesCreateRequest; + /** + * Relationships for creating an incident user-defined field. + */ + "relationships": IncidentUserDefinedFieldCreateRelationships; + /** + * The incident user defined fields type. + */ + "type": IncidentUserDefinedFieldType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "IncidentUserDefinedFieldAttributesCreateRequest", + required: true, + }, + relationships: { + baseName: "relationships", + type: "IncidentUserDefinedFieldCreateRelationships", + required: true, + }, + type: { + baseName: "type", + type: "IncidentUserDefinedFieldType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return IncidentUserDefinedFieldCreateData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldCreateRelationships.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldCreateRelationships.ts new file mode 100644 index 000000000000..479eeeb45264 --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldCreateRelationships.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RelationshipToIncidentType } from "./RelationshipToIncidentType"; + +/** + * Relationships for creating an incident user-defined field. + */ +export class IncidentUserDefinedFieldCreateRelationships { + /** + * Relationship to an incident type. + */ + "incidentType": RelationshipToIncidentType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + incidentType: { + baseName: "incident_type", + type: "RelationshipToIncidentType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return IncidentUserDefinedFieldCreateRelationships.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldCreateRequest.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldCreateRequest.ts new file mode 100644 index 000000000000..0a5e7d2045ee --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldCreateRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { IncidentUserDefinedFieldCreateData } from "./IncidentUserDefinedFieldCreateData"; + +/** + * Request body for creating an incident user-defined field. + */ +export class IncidentUserDefinedFieldCreateRequest { + /** + * Data for creating an incident user-defined field. + */ + "data": IncidentUserDefinedFieldCreateData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "IncidentUserDefinedFieldCreateData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return IncidentUserDefinedFieldCreateRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldFieldType.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldFieldType.ts new file mode 100644 index 000000000000..1562c485efd1 --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldFieldType.ts @@ -0,0 +1,23 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The data type of the field. 1=dropdown, 2=multiselect, 3=textbox, 4=textarray, 5=metrictag, 6=autocomplete, 7=number, 8=datetime. + */ +export type IncidentUserDefinedFieldFieldType = + | typeof DROPDOWN + | typeof MULTISELECT + | typeof TEXTBOX + | typeof TEXTARRAY + | typeof METRICTAG + | typeof AUTOCOMPLETE + | typeof NUMBER + | typeof DATETIME + | UnparsedObject; +export const DROPDOWN = 1; +export const MULTISELECT = 2; +export const TEXTBOX = 3; +export const TEXTARRAY = 4; +export const METRICTAG = 5; +export const AUTOCOMPLETE = 6; +export const NUMBER = 7; +export const DATETIME = 8; diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldListMeta.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldListMeta.ts new file mode 100644 index 000000000000..5aa80d885b5c --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldListMeta.ts @@ -0,0 +1,54 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Pagination metadata for the user-defined field list response. + */ +export class IncidentUserDefinedFieldListMeta { + /** + * The offset of the current page. + */ + "offset"?: number; + /** + * The total number of items in the current page. + */ + "size"?: number; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + offset: { + baseName: "offset", + type: "number", + format: "int64", + }, + size: { + baseName: "size", + type: "number", + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return IncidentUserDefinedFieldListMeta.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldListResponse.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldListResponse.ts new file mode 100644 index 000000000000..f3ffee2660fd --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldListResponse.ts @@ -0,0 +1,57 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { IncidentUserDefinedFieldListMeta } from "./IncidentUserDefinedFieldListMeta"; +import { IncidentUserDefinedFieldResponseData } from "./IncidentUserDefinedFieldResponseData"; + +/** + * Response containing a list of incident user-defined fields. + */ +export class IncidentUserDefinedFieldListResponse { + /** + * An array of user-defined field objects. + */ + "data": Array; + /** + * Pagination metadata for the user-defined field list response. + */ + "meta": IncidentUserDefinedFieldListMeta; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + required: true, + }, + meta: { + baseName: "meta", + type: "IncidentUserDefinedFieldListMeta", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return IncidentUserDefinedFieldListResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldMetadata.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldMetadata.ts new file mode 100644 index 000000000000..2bf234549347 --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldMetadata.ts @@ -0,0 +1,90 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Metadata for autocomplete-type user-defined fields, describing how to populate autocomplete options. + */ +export class IncidentUserDefinedFieldMetadata { + /** + * The category of the autocomplete source. + */ + "category": string; + /** + * The query parameter used to limit the number of autocomplete results. + */ + "searchLimitParam": string; + /** + * Additional query parameters to include in the search URL. + */ + "searchParams": { [key: string]: any }; + /** + * The query parameter used to pass typed input to the search URL. + */ + "searchQueryParam": string; + /** + * The JSON path to the results in the response body. + */ + "searchResultPath": string; + /** + * The URL used to populate autocomplete options. + */ + "searchUrl": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + category: { + baseName: "category", + type: "string", + required: true, + }, + searchLimitParam: { + baseName: "search_limit_param", + type: "string", + required: true, + }, + searchParams: { + baseName: "search_params", + type: "{ [key: string]: any; }", + required: true, + }, + searchQueryParam: { + baseName: "search_query_param", + type: "string", + required: true, + }, + searchResultPath: { + baseName: "search_result_path", + type: "string", + required: true, + }, + searchUrl: { + baseName: "search_url", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return IncidentUserDefinedFieldMetadata.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldRelationships.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldRelationships.ts new file mode 100644 index 000000000000..f7a071fdf923 --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldRelationships.ts @@ -0,0 +1,66 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RelationshipToIncidentType } from "./RelationshipToIncidentType"; +import { RelationshipToUser } from "./RelationshipToUser"; + +/** + * Relationships of an incident user-defined field. + */ +export class IncidentUserDefinedFieldRelationships { + /** + * Relationship to user. + */ + "createdByUser": RelationshipToUser; + /** + * Relationship to an incident type. + */ + "incidentType": RelationshipToIncidentType; + /** + * Relationship to user. + */ + "lastModifiedByUser": RelationshipToUser; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + createdByUser: { + baseName: "created_by_user", + type: "RelationshipToUser", + required: true, + }, + incidentType: { + baseName: "incident_type", + type: "RelationshipToIncidentType", + required: true, + }, + lastModifiedByUser: { + baseName: "last_modified_by_user", + type: "RelationshipToUser", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return IncidentUserDefinedFieldRelationships.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldResponse.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldResponse.ts new file mode 100644 index 000000000000..59629762cf66 --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldResponse.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { IncidentUserDefinedFieldResponseData } from "./IncidentUserDefinedFieldResponseData"; + +/** + * Response containing a single incident user-defined field. + */ +export class IncidentUserDefinedFieldResponse { + /** + * Data object for an incident user-defined field response. + */ + "data": IncidentUserDefinedFieldResponseData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "IncidentUserDefinedFieldResponseData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return IncidentUserDefinedFieldResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldResponseData.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldResponseData.ts new file mode 100644 index 000000000000..be47aabbf6a2 --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldResponseData.ts @@ -0,0 +1,76 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { IncidentUserDefinedFieldAttributesResponse } from "./IncidentUserDefinedFieldAttributesResponse"; +import { IncidentUserDefinedFieldRelationships } from "./IncidentUserDefinedFieldRelationships"; +import { IncidentUserDefinedFieldType } from "./IncidentUserDefinedFieldType"; + +/** + * Data object for an incident user-defined field response. + */ +export class IncidentUserDefinedFieldResponseData { + /** + * Attributes of an incident user-defined field. + */ + "attributes": IncidentUserDefinedFieldAttributesResponse; + /** + * The unique identifier of the user-defined field. + */ + "id": string; + /** + * Relationships of an incident user-defined field. + */ + "relationships": IncidentUserDefinedFieldRelationships; + /** + * The incident user defined fields type. + */ + "type": IncidentUserDefinedFieldType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "IncidentUserDefinedFieldAttributesResponse", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + relationships: { + baseName: "relationships", + type: "IncidentUserDefinedFieldRelationships", + required: true, + }, + type: { + baseName: "type", + type: "IncidentUserDefinedFieldType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return IncidentUserDefinedFieldResponseData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldUpdateData.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldUpdateData.ts new file mode 100644 index 000000000000..efb03dceaec8 --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldUpdateData.ts @@ -0,0 +1,66 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { IncidentUserDefinedFieldAttributesUpdateRequest } from "./IncidentUserDefinedFieldAttributesUpdateRequest"; +import { IncidentUserDefinedFieldType } from "./IncidentUserDefinedFieldType"; + +/** + * Data for updating an incident user-defined field. + */ +export class IncidentUserDefinedFieldUpdateData { + /** + * Attributes for updating an incident user-defined field. All fields are optional. + */ + "attributes": IncidentUserDefinedFieldAttributesUpdateRequest; + /** + * The unique identifier of the user-defined field to update. + */ + "id": string; + /** + * The incident user defined fields type. + */ + "type": IncidentUserDefinedFieldType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "IncidentUserDefinedFieldAttributesUpdateRequest", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "IncidentUserDefinedFieldType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return IncidentUserDefinedFieldUpdateData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldUpdateRequest.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldUpdateRequest.ts new file mode 100644 index 000000000000..32389b8a7b31 --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldUpdateRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { IncidentUserDefinedFieldUpdateData } from "./IncidentUserDefinedFieldUpdateData"; + +/** + * Request body for updating an incident user-defined field. + */ +export class IncidentUserDefinedFieldUpdateRequest { + /** + * Data for updating an incident user-defined field. + */ + "data": IncidentUserDefinedFieldUpdateData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "IncidentUserDefinedFieldUpdateData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return IncidentUserDefinedFieldUpdateRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/incidents/src/v2/models/IncidentUserDefinedFieldValidValue.ts b/services/incidents/src/v2/models/IncidentUserDefinedFieldValidValue.ts new file mode 100644 index 000000000000..dadf5a014238 --- /dev/null +++ b/services/incidents/src/v2/models/IncidentUserDefinedFieldValidValue.ts @@ -0,0 +1,70 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * A valid value for an incident user-defined field. + */ +export class IncidentUserDefinedFieldValidValue { + /** + * A detailed description of the valid value. + */ + "description"?: string; + /** + * The human-readable display name for this value. + */ + "displayName": string; + /** + * A short description of the valid value. + */ + "shortDescription"?: string; + /** + * The identifier that is stored when this option is selected. + */ + "value": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + description: { + baseName: "description", + type: "string", + }, + displayName: { + baseName: "display_name", + type: "string", + required: true, + }, + shortDescription: { + baseName: "short_description", + type: "string", + }, + value: { + baseName: "value", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return IncidentUserDefinedFieldValidValue.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/incidents/src/v2/models/TypingInfo.ts b/services/incidents/src/v2/models/TypingInfo.ts index e9fadd4532b6..4cffe0a454c7 100644 --- a/services/incidents/src/v2/models/TypingInfo.ts +++ b/services/incidents/src/v2/models/TypingInfo.ts @@ -138,6 +138,21 @@ import { IncidentUpdateRelationships } from "./IncidentUpdateRelationships"; import { IncidentUpdateRequest } from "./IncidentUpdateRequest"; import { IncidentUserAttributes } from "./IncidentUserAttributes"; import { IncidentUserData } from "./IncidentUserData"; +import { IncidentUserDefinedFieldAttributesCreateRequest } from "./IncidentUserDefinedFieldAttributesCreateRequest"; +import { IncidentUserDefinedFieldAttributesResponse } from "./IncidentUserDefinedFieldAttributesResponse"; +import { IncidentUserDefinedFieldAttributesUpdateRequest } from "./IncidentUserDefinedFieldAttributesUpdateRequest"; +import { IncidentUserDefinedFieldCreateData } from "./IncidentUserDefinedFieldCreateData"; +import { IncidentUserDefinedFieldCreateRelationships } from "./IncidentUserDefinedFieldCreateRelationships"; +import { IncidentUserDefinedFieldCreateRequest } from "./IncidentUserDefinedFieldCreateRequest"; +import { IncidentUserDefinedFieldListMeta } from "./IncidentUserDefinedFieldListMeta"; +import { IncidentUserDefinedFieldListResponse } from "./IncidentUserDefinedFieldListResponse"; +import { IncidentUserDefinedFieldMetadata } from "./IncidentUserDefinedFieldMetadata"; +import { IncidentUserDefinedFieldRelationships } from "./IncidentUserDefinedFieldRelationships"; +import { IncidentUserDefinedFieldResponse } from "./IncidentUserDefinedFieldResponse"; +import { IncidentUserDefinedFieldResponseData } from "./IncidentUserDefinedFieldResponseData"; +import { IncidentUserDefinedFieldUpdateData } from "./IncidentUserDefinedFieldUpdateData"; +import { IncidentUserDefinedFieldUpdateRequest } from "./IncidentUserDefinedFieldUpdateRequest"; +import { IncidentUserDefinedFieldValidValue } from "./IncidentUserDefinedFieldValidValue"; import { IncidentsResponse } from "./IncidentsResponse"; import { JSONAPIErrorItem } from "./JSONAPIErrorItem"; import { JSONAPIErrorItemSource } from "./JSONAPIErrorItemSource"; @@ -263,6 +278,14 @@ export const TypingInfo: ModelTypingInfo = { IncidentTodoType: ["incident_todos"], IncidentType: ["incidents"], IncidentTypeType: ["incident_types"], + IncidentUserDefinedFieldCategory: ["what_happened", "why_it_happened"], + IncidentUserDefinedFieldCollected: [ + "active", + "stable", + "resolved", + "completed", + ], + IncidentUserDefinedFieldFieldType: [1, 2, 3, 4, 5, 6, 7, 8], IncidentUserDefinedFieldType: ["user_defined_field"], OrganizationsType: ["orgs"], PostmortemCellType: ["markdown"], @@ -480,6 +503,28 @@ export const TypingInfo: ModelTypingInfo = { IncidentUpdateRequest: IncidentUpdateRequest, IncidentUserAttributes: IncidentUserAttributes, IncidentUserData: IncidentUserData, + IncidentUserDefinedFieldAttributesCreateRequest: + IncidentUserDefinedFieldAttributesCreateRequest, + IncidentUserDefinedFieldAttributesResponse: + IncidentUserDefinedFieldAttributesResponse, + IncidentUserDefinedFieldAttributesUpdateRequest: + IncidentUserDefinedFieldAttributesUpdateRequest, + IncidentUserDefinedFieldCreateData: IncidentUserDefinedFieldCreateData, + IncidentUserDefinedFieldCreateRelationships: + IncidentUserDefinedFieldCreateRelationships, + IncidentUserDefinedFieldCreateRequest: + IncidentUserDefinedFieldCreateRequest, + IncidentUserDefinedFieldListMeta: IncidentUserDefinedFieldListMeta, + IncidentUserDefinedFieldListResponse: IncidentUserDefinedFieldListResponse, + IncidentUserDefinedFieldMetadata: IncidentUserDefinedFieldMetadata, + IncidentUserDefinedFieldRelationships: + IncidentUserDefinedFieldRelationships, + IncidentUserDefinedFieldResponse: IncidentUserDefinedFieldResponse, + IncidentUserDefinedFieldResponseData: IncidentUserDefinedFieldResponseData, + IncidentUserDefinedFieldUpdateData: IncidentUserDefinedFieldUpdateData, + IncidentUserDefinedFieldUpdateRequest: + IncidentUserDefinedFieldUpdateRequest, + IncidentUserDefinedFieldValidValue: IncidentUserDefinedFieldValidValue, IncidentsResponse: IncidentsResponse, JSONAPIErrorItem: JSONAPIErrorItem, JSONAPIErrorItemSource: JSONAPIErrorItemSource,