From 633839914e7c86e7264df60d71b34c693b7df370 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 20 Mar 2026 10:14:13 +0000 Subject: [PATCH] Regenerate client from commit 71ce972 of spec repo --- .generator/schemas/v2/openapi.yaml | 978 ++++++++++++++++++ docs/datadog_api_client.v2.model.rst | 133 +++ .../CreateIncidentUserDefinedField.py | 63 ++ .../DeleteIncidentUserDefinedField.py | 14 + .../incidents/GetIncidentUserDefinedField.py | 16 + .../ImportIncidentUserDefinedFieldValues.py | 16 + .../ListIncidentUserDefinedFields.py | 14 + .../UpdateIncidentUserDefinedField.py | 48 + src/datadog_api_client/configuration.py | 6 + .../v2/api/incidents_api.py | 359 +++++++ ...defined_field_attributes_create_request.py | 126 +++ ..._user_defined_field_attributes_response.py | 189 ++++ ...defined_field_attributes_update_request.py | 101 ++ .../incident_user_defined_field_category.py | 40 + .../incident_user_defined_field_collected.py | 46 + ...incident_user_defined_field_create_data.py | 70 ++ ...user_defined_field_create_relationships.py | 40 + ...ident_user_defined_field_create_request.py | 42 + .../incident_user_defined_field_field_type.py | 56 + ...ident_user_defined_field_import_request.py | 37 + .../incident_user_defined_field_list_meta.py | 39 + ...cident_user_defined_field_list_response.py | 54 + .../incident_user_defined_field_metadata.py | 94 ++ ...cident_user_defined_field_relationships.py | 60 ++ .../incident_user_defined_field_response.py | 44 + ...cident_user_defined_field_response_data.py | 77 ++ ...incident_user_defined_field_update_data.py | 64 ++ ...ident_user_defined_field_update_request.py | 42 + ...incident_user_defined_field_valid_value.py | 62 ++ src/datadog_api_client/v2/models/__init__.py | 46 + tests/v2/features/incidents.feature | 129 +++ tests/v2/features/undo.json | 43 + 32 files changed, 3148 insertions(+) create mode 100644 examples/v2/incidents/CreateIncidentUserDefinedField.py create mode 100644 examples/v2/incidents/DeleteIncidentUserDefinedField.py create mode 100644 examples/v2/incidents/GetIncidentUserDefinedField.py create mode 100644 examples/v2/incidents/ImportIncidentUserDefinedFieldValues.py create mode 100644 examples/v2/incidents/ListIncidentUserDefinedFields.py create mode 100644 examples/v2/incidents/UpdateIncidentUserDefinedField.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_attributes_create_request.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_attributes_response.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_attributes_update_request.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_category.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_collected.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_create_data.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_create_relationships.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_create_request.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_field_type.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_import_request.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_list_meta.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_list_response.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_metadata.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_relationships.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_response.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_response_data.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_update_data.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_update_request.py create mode 100644 src/datadog_api_client/v2/model/incident_user_defined_field_valid_value.py diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d22c0abd58..7fb28933e2 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 @@ -31636,6 +31644,391 @@ 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 machine-readable name 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, multiselect, and autocomplete 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 machine-readable name 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. Use "what_happened" for impact-related fields or "why_it_happened" for root cause fields. 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 + IncidentUserDefinedFieldImportRequest: + description: Multipart form data for importing valid values for an incident user-defined field from a CSV file. + properties: + file: + description: A CSV file where each distinct value in the first column is imported as a valid value. + format: binary + type: string + type: object + IncidentUserDefinedFieldListMeta: + description: Pagination metadata for the user-defined field list response. + properties: + page_offset: + description: The offset of the current page. + example: 0 + format: int64 + type: integer + total: + description: The total number of items in the current page. + example: 5 + format: int64 + type: integer + required: + - page_offset + - total + 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: @@ -31644,6 +32037,54 @@ 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 machine-readable value stored when this option is selected. + example: "critical" + type: string + required: + - display_name + - value + - description + type: object IncidentsResponse: description: Response with a list of incidents. properties: @@ -80471,6 +80912,109 @@ 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/fields/{field_id}/values/import: + post: + description: Import valid values for an incident user-defined field from a CSV file. Only supported for dropdown, multiselect, and autocomplete field types. + operationId: ImportIncidentUserDefinedFieldValues + parameters: + - $ref: "#/components/parameters/IncidentUserDefinedFieldIDPathParameter" + - description: When "true", "True", or "1", replaces all existing valid values with the imported values. Otherwise, appends the imported values to the existing list. + in: query + name: replace_values + schema: + example: "true" + type: string + requestBody: + content: + multipart/form-data: + schema: + $ref: "#/components/schemas/IncidentUserDefinedFieldImportRequest" + description: CSV file containing the values to import. + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + attached_to: "incidents" + category: "what_happened" + collected: + created: "2026-03-18T08:40:04.437887Z" + default_value: + deleted: + display_name: "Root Cause" + metadata: + modified: "2026-03-18T08:40:05.000000Z" + 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" + - description: "An error caused by a human." + display_name: "Human Error" + value: "human_error" + 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: 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: Import values for an incident user-defined field + tags: + - Incidents + x-permission: + operator: OR + permissions: + - incident_settings_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/incidents/config/global/incident-handles: delete: description: Delete a global incident handle. @@ -81428,6 +81972,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: + page_offset: 0 + total: 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/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 7a83d1c7c6..a9f37fae2e 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -13997,6 +13997,118 @@ datadog\_api\_client.v2.model.incident\_user\_data module :members: :show-inheritance: +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_attributes\_create\_request module +------------------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_attributes_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_attributes\_response module +----------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_attributes_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_attributes\_update\_request module +------------------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_attributes_update_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_category module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_category + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_collected module +------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_collected + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_create\_data module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_create_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_create\_relationships module +------------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_create_relationships + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_create\_request module +------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_field\_type module +-------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_field_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_import\_request module +------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_import_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_list\_meta module +------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_list_meta + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_list\_response module +----------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_list_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_metadata module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_metadata + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_relationships module +---------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_relationships + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_response module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_response\_data module +----------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_response_data + :members: + :show-inheritance: + datadog\_api\_client.v2.model.incident\_user\_defined\_field\_type module ------------------------------------------------------------------------- @@ -14004,6 +14116,27 @@ datadog\_api\_client.v2.model.incident\_user\_defined\_field\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_update\_data module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_update_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_update\_request module +------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_update_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.incident\_user\_defined\_field\_valid\_value module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.incident_user_defined_field_valid_value + :members: + :show-inheritance: + datadog\_api\_client.v2.model.incidents\_response module -------------------------------------------------------- diff --git a/examples/v2/incidents/CreateIncidentUserDefinedField.py b/examples/v2/incidents/CreateIncidentUserDefinedField.py new file mode 100644 index 0000000000..78806b5ed2 --- /dev/null +++ b/examples/v2/incidents/CreateIncidentUserDefinedField.py @@ -0,0 +1,63 @@ +""" +Create an incident user-defined field returns "CREATED" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.incidents_api import IncidentsApi +from datadog_api_client.v2.model.incident_type_type import IncidentTypeType +from datadog_api_client.v2.model.incident_user_defined_field_attributes_create_request import ( + IncidentUserDefinedFieldAttributesCreateRequest, +) +from datadog_api_client.v2.model.incident_user_defined_field_category import IncidentUserDefinedFieldCategory +from datadog_api_client.v2.model.incident_user_defined_field_collected import IncidentUserDefinedFieldCollected +from datadog_api_client.v2.model.incident_user_defined_field_create_data import IncidentUserDefinedFieldCreateData +from datadog_api_client.v2.model.incident_user_defined_field_create_relationships import ( + IncidentUserDefinedFieldCreateRelationships, +) +from datadog_api_client.v2.model.incident_user_defined_field_create_request import IncidentUserDefinedFieldCreateRequest +from datadog_api_client.v2.model.incident_user_defined_field_field_type import IncidentUserDefinedFieldFieldType +from datadog_api_client.v2.model.incident_user_defined_field_type import IncidentUserDefinedFieldType +from datadog_api_client.v2.model.incident_user_defined_field_valid_value import IncidentUserDefinedFieldValidValue +from datadog_api_client.v2.model.relationship_to_incident_type import RelationshipToIncidentType +from datadog_api_client.v2.model.relationship_to_incident_type_data import RelationshipToIncidentTypeData + +body = IncidentUserDefinedFieldCreateRequest( + data=IncidentUserDefinedFieldCreateData( + attributes=IncidentUserDefinedFieldAttributesCreateRequest( + category=IncidentUserDefinedFieldCategory.WHAT_HAPPENED, + collected=IncidentUserDefinedFieldCollected.ACTIVE, + default_value="critical", + display_name="Root Cause", + name="root_cause", + ordinal="1.5", + required=False, + tag_key="datacenter", + type=IncidentUserDefinedFieldFieldType.TEXTBOX, + valid_values=[ + IncidentUserDefinedFieldValidValue( + description="A critical severity incident.", + display_name="Critical", + short_description="Critical", + value="critical", + ), + ], + ), + relationships=IncidentUserDefinedFieldCreateRelationships( + incident_type=RelationshipToIncidentType( + data=RelationshipToIncidentTypeData( + id="00000000-0000-0000-0000-000000000000", + type=IncidentTypeType.INCIDENT_TYPES, + ), + ), + ), + type=IncidentUserDefinedFieldType.USER_DEFINED_FIELD, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_incident_user_defined_field"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + response = api_instance.create_incident_user_defined_field(body=body) + + print(response) diff --git a/examples/v2/incidents/DeleteIncidentUserDefinedField.py b/examples/v2/incidents/DeleteIncidentUserDefinedField.py new file mode 100644 index 0000000000..9cdbaebba3 --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentUserDefinedField.py @@ -0,0 +1,14 @@ +""" +Delete an incident user-defined field returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.incidents_api import IncidentsApi + +configuration = Configuration() +configuration.unstable_operations["delete_incident_user_defined_field"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + api_instance.delete_incident_user_defined_field( + field_id="00000000-0000-0000-0000-000000000000", + ) diff --git a/examples/v2/incidents/GetIncidentUserDefinedField.py b/examples/v2/incidents/GetIncidentUserDefinedField.py new file mode 100644 index 0000000000..a9ccdb82de --- /dev/null +++ b/examples/v2/incidents/GetIncidentUserDefinedField.py @@ -0,0 +1,16 @@ +""" +Get an incident user-defined field returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.incidents_api import IncidentsApi + +configuration = Configuration() +configuration.unstable_operations["get_incident_user_defined_field"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + response = api_instance.get_incident_user_defined_field( + field_id="00000000-0000-0000-0000-000000000000", + ) + + print(response) diff --git a/examples/v2/incidents/ImportIncidentUserDefinedFieldValues.py b/examples/v2/incidents/ImportIncidentUserDefinedFieldValues.py new file mode 100644 index 0000000000..768f43807a --- /dev/null +++ b/examples/v2/incidents/ImportIncidentUserDefinedFieldValues.py @@ -0,0 +1,16 @@ +""" +Import values for an incident user-defined field returns "CREATED" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.incidents_api import IncidentsApi + +configuration = Configuration() +configuration.unstable_operations["import_incident_user_defined_field_values"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + response = api_instance.import_incident_user_defined_field_values( + field_id="00000000-0000-0000-0000-000000000000", + ) + + print(response) diff --git a/examples/v2/incidents/ListIncidentUserDefinedFields.py b/examples/v2/incidents/ListIncidentUserDefinedFields.py new file mode 100644 index 0000000000..ca4c255a8b --- /dev/null +++ b/examples/v2/incidents/ListIncidentUserDefinedFields.py @@ -0,0 +1,14 @@ +""" +Get a list of incident user-defined fields returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.incidents_api import IncidentsApi + +configuration = Configuration() +configuration.unstable_operations["list_incident_user_defined_fields"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + response = api_instance.list_incident_user_defined_fields() + + print(response) diff --git a/examples/v2/incidents/UpdateIncidentUserDefinedField.py b/examples/v2/incidents/UpdateIncidentUserDefinedField.py new file mode 100644 index 0000000000..b81f21e415 --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentUserDefinedField.py @@ -0,0 +1,48 @@ +""" +Update an incident user-defined field returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.incidents_api import IncidentsApi +from datadog_api_client.v2.model.incident_user_defined_field_attributes_update_request import ( + IncidentUserDefinedFieldAttributesUpdateRequest, +) +from datadog_api_client.v2.model.incident_user_defined_field_category import IncidentUserDefinedFieldCategory +from datadog_api_client.v2.model.incident_user_defined_field_collected import IncidentUserDefinedFieldCollected +from datadog_api_client.v2.model.incident_user_defined_field_type import IncidentUserDefinedFieldType +from datadog_api_client.v2.model.incident_user_defined_field_update_data import IncidentUserDefinedFieldUpdateData +from datadog_api_client.v2.model.incident_user_defined_field_update_request import IncidentUserDefinedFieldUpdateRequest +from datadog_api_client.v2.model.incident_user_defined_field_valid_value import IncidentUserDefinedFieldValidValue + +body = IncidentUserDefinedFieldUpdateRequest( + data=IncidentUserDefinedFieldUpdateData( + attributes=IncidentUserDefinedFieldAttributesUpdateRequest( + category=IncidentUserDefinedFieldCategory.WHAT_HAPPENED, + collected=IncidentUserDefinedFieldCollected.ACTIVE, + default_value="critical", + display_name="Root Cause", + ordinal="1.5", + required=False, + valid_values=[ + IncidentUserDefinedFieldValidValue( + description="A critical severity incident.", + display_name="Critical", + short_description="Critical", + value="critical", + ), + ], + ), + id="00000000-0000-0000-0000-000000000000", + type=IncidentUserDefinedFieldType.USER_DEFINED_FIELD, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_incident_user_defined_field"] = True +with ApiClient(configuration) as api_client: + api_instance = IncidentsApi(api_client) + response = api_instance.update_incident_user_defined_field( + field_id="00000000-0000-0000-0000-000000000000", body=body + ) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 5cedd11cae..79f02e0715 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -336,6 +336,7 @@ def __init__( "v2.create_incident_postmortem_template": False, "v2.create_incident_todo": False, "v2.create_incident_type": False, + "v2.create_incident_user_defined_field": False, "v2.delete_global_incident_handle": False, "v2.delete_incident": False, "v2.delete_incident_attachment": False, @@ -345,6 +346,7 @@ def __init__( "v2.delete_incident_postmortem_template": False, "v2.delete_incident_todo": False, "v2.delete_incident_type": False, + "v2.delete_incident_user_defined_field": False, "v2.get_global_incident_settings": False, "v2.get_incident": False, "v2.get_incident_integration": False, @@ -353,7 +355,9 @@ def __init__( "v2.get_incident_postmortem_template": False, "v2.get_incident_todo": False, "v2.get_incident_type": False, + "v2.get_incident_user_defined_field": False, "v2.import_incident": False, + "v2.import_incident_user_defined_field_values": False, "v2.list_global_incident_handles": False, "v2.list_incident_attachments": False, "v2.list_incident_integrations": False, @@ -363,6 +367,7 @@ def __init__( "v2.list_incidents": False, "v2.list_incident_todos": False, "v2.list_incident_types": False, + "v2.list_incident_user_defined_fields": False, "v2.search_incidents": False, "v2.update_global_incident_handle": False, "v2.update_global_incident_settings": False, @@ -374,6 +379,7 @@ def __init__( "v2.update_incident_postmortem_template": False, "v2.update_incident_todo": False, "v2.update_incident_type": False, + "v2.update_incident_user_defined_field": False, "v2.create_aws_account_ccm_config": False, "v2.delete_aws_account_ccm_config": False, "v2.get_aws_account_ccm_config": False, diff --git a/src/datadog_api_client/v2/api/incidents_api.py b/src/datadog_api_client/v2/api/incidents_api.py index 053acd26df..15e0d58c89 100644 --- a/src/datadog_api_client/v2/api/incidents_api.py +++ b/src/datadog_api_client/v2/api/incidents_api.py @@ -11,6 +11,7 @@ from datadog_api_client.model_utils import ( set_attribute_from_path, get_attribute_from_path, + file_type, UnsetType, unset, UUID, @@ -20,6 +21,7 @@ from datadog_api_client.v2.model.incident_response_data import IncidentResponseData from datadog_api_client.v2.model.incident_response import IncidentResponse from datadog_api_client.v2.model.incident_create_request import IncidentCreateRequest +from datadog_api_client.v2.model.incident_user_defined_field_response import IncidentUserDefinedFieldResponse from datadog_api_client.v2.model.incident_handles_response import IncidentHandlesResponse from datadog_api_client.v2.model.incident_handle_response import IncidentHandleResponse from datadog_api_client.v2.model.incident_handle_request import IncidentHandleRequest @@ -44,6 +46,9 @@ from datadog_api_client.v2.model.incident_type_response import IncidentTypeResponse from datadog_api_client.v2.model.incident_type_create_request import IncidentTypeCreateRequest from datadog_api_client.v2.model.incident_type_patch_request import IncidentTypePatchRequest +from datadog_api_client.v2.model.incident_user_defined_field_list_response import IncidentUserDefinedFieldListResponse +from datadog_api_client.v2.model.incident_user_defined_field_create_request import IncidentUserDefinedFieldCreateRequest +from datadog_api_client.v2.model.incident_user_defined_field_update_request import IncidentUserDefinedFieldUpdateRequest from datadog_api_client.v2.model.incident_import_response import IncidentImportResponse from datadog_api_client.v2.model.incident_import_related_object import IncidentImportRelatedObject from datadog_api_client.v2.model.incident_import_request import IncidentImportRequest @@ -352,6 +357,31 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_incident_user_defined_field_endpoint = _Endpoint( + settings={ + "response_type": (IncidentUserDefinedFieldResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/incidents/config/user-defined-fields", + "operation_id": "create_incident_user_defined_field", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "include": { + "openapi_types": (str,), + "attribute": "include", + "location": "query", + }, + "body": { + "required": True, + "openapi_types": (IncidentUserDefinedFieldCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._delete_global_incident_handle_endpoint = _Endpoint( settings={ "response_type": None, @@ -609,6 +639,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_incident_user_defined_field_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/incidents/config/user-defined-fields/{field_id}", + "operation_id": "delete_incident_user_defined_field", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "field_id": { + "required": True, + "openapi_types": (str,), + "attribute": "field_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._get_global_incident_settings_endpoint = _Endpoint( settings={ "response_type": (GlobalIncidentSettingsResponse,), @@ -814,6 +867,34 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_incident_user_defined_field_endpoint = _Endpoint( + settings={ + "response_type": (IncidentUserDefinedFieldResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/incidents/config/user-defined-fields/{field_id}", + "operation_id": "get_incident_user_defined_field", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "field_id": { + "required": True, + "openapi_types": (str,), + "attribute": "field_id", + "location": "path", + }, + "include": { + "openapi_types": (str,), + "attribute": "include", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._import_incident_endpoint = _Endpoint( settings={ "response_type": (IncidentImportResponse,), @@ -840,6 +921,37 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._import_incident_user_defined_field_values_endpoint = _Endpoint( + settings={ + "response_type": (IncidentUserDefinedFieldResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/incidents/config/fields/{field_id}/values/import", + "operation_id": "import_incident_user_defined_field_values", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "field_id": { + "required": True, + "openapi_types": (str,), + "attribute": "field_id", + "location": "path", + }, + "replace_values": { + "openapi_types": (str,), + "attribute": "replace_values", + "location": "query", + }, + "file": { + "openapi_types": (file_type,), + "attribute": "file", + "location": "form", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["multipart/form-data"]}, + api_client=api_client, + ) + self._list_global_incident_handles_endpoint = _Endpoint( settings={ "response_type": (IncidentHandlesResponse,), @@ -1090,6 +1202,55 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_incident_user_defined_fields_endpoint = _Endpoint( + settings={ + "response_type": (IncidentUserDefinedFieldListResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/incidents/config/user-defined-fields", + "operation_id": "list_incident_user_defined_fields", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "page_size": { + "validation": { + "inclusive_maximum": 1000, + "inclusive_minimum": 0, + }, + "openapi_types": (int,), + "attribute": "page[size]", + "location": "query", + }, + "page_number": { + "validation": { + "inclusive_minimum": 0, + }, + "openapi_types": (int,), + "attribute": "page[number]", + "location": "query", + }, + "include_deleted": { + "openapi_types": (bool,), + "attribute": "include-deleted", + "location": "query", + }, + "filter_incident_type": { + "openapi_types": (str,), + "attribute": "filter[incident-type]", + "location": "query", + }, + "include": { + "openapi_types": (str,), + "attribute": "include", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._search_incidents_endpoint = _Endpoint( settings={ "response_type": (IncidentSearchResponse,), @@ -1425,6 +1586,37 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._update_incident_user_defined_field_endpoint = _Endpoint( + settings={ + "response_type": (IncidentUserDefinedFieldResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/incidents/config/user-defined-fields/{field_id}", + "operation_id": "update_incident_user_defined_field", + "http_method": "PATCH", + "version": "v2", + }, + params_map={ + "field_id": { + "required": True, + "openapi_types": (str,), + "attribute": "field_id", + "location": "path", + }, + "include": { + "openapi_types": (str,), + "attribute": "include", + "location": "query", + }, + "body": { + "required": True, + "openapi_types": (IncidentUserDefinedFieldUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + def create_global_incident_handle( self, body: IncidentHandleRequest, @@ -1656,6 +1848,30 @@ def create_incident_type( return self._create_incident_type_endpoint.call_with_http_info(**kwargs) + def create_incident_user_defined_field( + self, + body: IncidentUserDefinedFieldCreateRequest, + *, + include: Union[str, UnsetType] = unset, + ) -> IncidentUserDefinedFieldResponse: + """Create an incident user-defined field. + + Create an incident user-defined field. + + :param body: Incident user-defined field payload. + :type body: IncidentUserDefinedFieldCreateRequest + :param include: Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + :type include: str, optional + :rtype: IncidentUserDefinedFieldResponse + """ + kwargs: Dict[str, Any] = {} + if include is not unset: + kwargs["include"] = include + + kwargs["body"] = body + + return self._create_incident_user_defined_field_endpoint.call_with_http_info(**kwargs) + def delete_global_incident_handle( self, ) -> None: @@ -1853,6 +2069,23 @@ def delete_incident_type( return self._delete_incident_type_endpoint.call_with_http_info(**kwargs) + def delete_incident_user_defined_field( + self, + field_id: str, + ) -> None: + """Delete an incident user-defined field. + + Delete an incident user-defined field. + + :param field_id: The ID of the incident user-defined field. + :type field_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["field_id"] = field_id + + return self._delete_incident_user_defined_field_endpoint.call_with_http_info(**kwargs) + def get_global_incident_settings( self, ) -> GlobalIncidentSettingsResponse: @@ -2015,6 +2248,30 @@ def get_incident_type( return self._get_incident_type_endpoint.call_with_http_info(**kwargs) + def get_incident_user_defined_field( + self, + field_id: str, + *, + include: Union[str, UnsetType] = unset, + ) -> IncidentUserDefinedFieldResponse: + """Get an incident user-defined field. + + Get details of an incident user-defined field. + + :param field_id: The ID of the incident user-defined field. + :type field_id: str + :param include: Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + :type include: str, optional + :rtype: IncidentUserDefinedFieldResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["field_id"] = field_id + + if include is not unset: + kwargs["include"] = include + + return self._get_incident_user_defined_field_endpoint.call_with_http_info(**kwargs) + def import_incident( self, body: IncidentImportRequest, @@ -2041,6 +2298,36 @@ def import_incident( return self._import_incident_endpoint.call_with_http_info(**kwargs) + def import_incident_user_defined_field_values( + self, + field_id: str, + *, + replace_values: Union[str, UnsetType] = unset, + file: Union[file_type, UnsetType] = unset, + ) -> IncidentUserDefinedFieldResponse: + """Import values for an incident user-defined field. + + Import valid values for an incident user-defined field from a CSV file. Only supported for dropdown, multiselect, and autocomplete field types. + + :param field_id: The ID of the incident user-defined field. + :type field_id: str + :param replace_values: When "true", "True", or "1", replaces all existing valid values with the imported values. Otherwise, appends the imported values to the existing list. + :type replace_values: str, optional + :param file: A CSV file where each distinct value in the first column is imported as a valid value. + :type file: file_type, optional + :rtype: IncidentUserDefinedFieldResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["field_id"] = field_id + + if replace_values is not unset: + kwargs["replace_values"] = replace_values + + if file is not unset: + kwargs["file"] = file + + return self._import_incident_user_defined_field_values_endpoint.call_with_http_info(**kwargs) + def list_global_incident_handles( self, *, @@ -2297,6 +2584,49 @@ def list_incident_types( return self._list_incident_types_endpoint.call_with_http_info(**kwargs) + def list_incident_user_defined_fields( + self, + *, + page_size: Union[int, UnsetType] = unset, + page_number: Union[int, UnsetType] = unset, + include_deleted: Union[bool, UnsetType] = unset, + filter_incident_type: Union[str, UnsetType] = unset, + include: Union[str, UnsetType] = unset, + ) -> IncidentUserDefinedFieldListResponse: + """Get a list of incident user-defined fields. + + Get a list of all incident user-defined fields. + + :param page_size: The number of results to return per page. Must be between 0 and 1000. + :type page_size: int, optional + :param page_number: The page number to retrieve, starting at 0. + :type page_number: int, optional + :param include_deleted: When true, include soft-deleted fields in the response. + :type include_deleted: bool, optional + :param filter_incident_type: Filter results to fields associated with the given incident type UUID. + :type filter_incident_type: str, optional + :param include: Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + :type include: str, optional + :rtype: IncidentUserDefinedFieldListResponse + """ + kwargs: Dict[str, Any] = {} + if page_size is not unset: + kwargs["page_size"] = page_size + + if page_number is not unset: + kwargs["page_number"] = page_number + + if include_deleted is not unset: + kwargs["include_deleted"] = include_deleted + + if filter_incident_type is not unset: + kwargs["filter_incident_type"] = filter_incident_type + + if include is not unset: + kwargs["include"] = include + + return self._list_incident_user_defined_fields_endpoint.call_with_http_info(**kwargs) + def search_incidents( self, query: str, @@ -2648,3 +2978,32 @@ def update_incident_type( kwargs["body"] = body return self._update_incident_type_endpoint.call_with_http_info(**kwargs) + + def update_incident_user_defined_field( + self, + field_id: str, + body: IncidentUserDefinedFieldUpdateRequest, + *, + include: Union[str, UnsetType] = unset, + ) -> IncidentUserDefinedFieldResponse: + """Update an incident user-defined field. + + Update an incident user-defined field. + + :param field_id: The ID of the incident user-defined field. + :type field_id: str + :param body: Incident user-defined field update payload. + :type body: IncidentUserDefinedFieldUpdateRequest + :param include: Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + :type include: str, optional + :rtype: IncidentUserDefinedFieldResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["field_id"] = field_id + + if include is not unset: + kwargs["include"] = include + + kwargs["body"] = body + + return self._update_incident_user_defined_field_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_attributes_create_request.py b/src/datadog_api_client/v2/model/incident_user_defined_field_attributes_create_request.py new file mode 100644 index 0000000000..a590b1235b --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_attributes_create_request.py @@ -0,0 +1,126 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_user_defined_field_category import IncidentUserDefinedFieldCategory + from datadog_api_client.v2.model.incident_user_defined_field_collected import IncidentUserDefinedFieldCollected + from datadog_api_client.v2.model.incident_user_defined_field_field_type import IncidentUserDefinedFieldFieldType + from datadog_api_client.v2.model.incident_user_defined_field_valid_value import IncidentUserDefinedFieldValidValue + + +class IncidentUserDefinedFieldAttributesCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_user_defined_field_category import IncidentUserDefinedFieldCategory + from datadog_api_client.v2.model.incident_user_defined_field_collected import IncidentUserDefinedFieldCollected + from datadog_api_client.v2.model.incident_user_defined_field_field_type import IncidentUserDefinedFieldFieldType + from datadog_api_client.v2.model.incident_user_defined_field_valid_value import ( + IncidentUserDefinedFieldValidValue, + ) + + return { + "category": (IncidentUserDefinedFieldCategory,), + "collected": (IncidentUserDefinedFieldCollected,), + "default_value": (str, none_type), + "display_name": (str,), + "name": (str,), + "ordinal": (str, none_type), + "required": (bool,), + "tag_key": (str, none_type), + "type": (IncidentUserDefinedFieldFieldType,), + "valid_values": ([IncidentUserDefinedFieldValidValue],), + } + + attribute_map = { + "category": "category", + "collected": "collected", + "default_value": "default_value", + "display_name": "display_name", + "name": "name", + "ordinal": "ordinal", + "required": "required", + "tag_key": "tag_key", + "type": "type", + "valid_values": "valid_values", + } + + def __init__( + self_, + name: str, + type: IncidentUserDefinedFieldFieldType, + category: Union[IncidentUserDefinedFieldCategory, none_type, UnsetType] = unset, + collected: Union[IncidentUserDefinedFieldCollected, none_type, UnsetType] = unset, + default_value: Union[str, none_type, UnsetType] = unset, + display_name: Union[str, UnsetType] = unset, + ordinal: Union[str, none_type, UnsetType] = unset, + required: Union[bool, UnsetType] = unset, + tag_key: Union[str, none_type, UnsetType] = unset, + valid_values: Union[List[IncidentUserDefinedFieldValidValue], UnsetType] = unset, + **kwargs, + ): + """ + Attributes for creating an incident user-defined field. + + :param category: The section in which the field appears. Use "what_happened" for impact-related fields or "why_it_happened" for root cause fields. When null, the field appears in the Attributes section. + :type category: IncidentUserDefinedFieldCategory, none_type, optional + + :param collected: The lifecycle stage at which the app prompts users to fill out this field. Cannot be set on required fields. + :type collected: IncidentUserDefinedFieldCollected, none_type, optional + + :param default_value: The default value for the field. Must be one of the valid values when valid_values is set. + :type default_value: str, none_type, optional + + :param display_name: The human-readable name shown in the UI. Defaults to a formatted version of the name if not provided. + :type display_name: str, optional + + :param name: The unique machine-readable name of the field. Must start with a letter or digit and contain only letters, digits, underscores, or periods. + :type name: str + + :param ordinal: A decimal string representing the field's display order in the UI. + :type ordinal: str, none_type, optional + + :param required: When true, users must fill out this field on incidents. + :type required: bool, optional + + :param tag_key: For metric tag-type fields only, the metric tag key that powers the autocomplete options. + :type tag_key: str, none_type, optional + + :param type: The data type of the field. 1=dropdown, 2=multiselect, 3=textbox, 4=textarray, 5=metrictag, 6=autocomplete, 7=number, 8=datetime. + :type type: IncidentUserDefinedFieldFieldType + + :param valid_values: The list of allowed values for dropdown, multiselect, and autocomplete fields. Limited to 1000 values. + :type valid_values: [IncidentUserDefinedFieldValidValue], optional + """ + if category is not unset: + kwargs["category"] = category + if collected is not unset: + kwargs["collected"] = collected + if default_value is not unset: + kwargs["default_value"] = default_value + if display_name is not unset: + kwargs["display_name"] = display_name + if ordinal is not unset: + kwargs["ordinal"] = ordinal + if required is not unset: + kwargs["required"] = required + if tag_key is not unset: + kwargs["tag_key"] = tag_key + if valid_values is not unset: + kwargs["valid_values"] = valid_values + super().__init__(kwargs) + + self_.name = name + self_.type = type diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_attributes_response.py b/src/datadog_api_client/v2/model/incident_user_defined_field_attributes_response.py new file mode 100644 index 0000000000..dac2599b0c --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_attributes_response.py @@ -0,0 +1,189 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_user_defined_field_category import IncidentUserDefinedFieldCategory + from datadog_api_client.v2.model.incident_user_defined_field_collected import IncidentUserDefinedFieldCollected + from datadog_api_client.v2.model.incident_user_defined_field_metadata import IncidentUserDefinedFieldMetadata + from datadog_api_client.v2.model.incident_user_defined_field_valid_value import IncidentUserDefinedFieldValidValue + + +class IncidentUserDefinedFieldAttributesResponse(ModelNormal): + validations = { + "type": { + "inclusive_maximum": 8, + "inclusive_minimum": 1, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_user_defined_field_category import IncidentUserDefinedFieldCategory + from datadog_api_client.v2.model.incident_user_defined_field_collected import IncidentUserDefinedFieldCollected + from datadog_api_client.v2.model.incident_user_defined_field_metadata import IncidentUserDefinedFieldMetadata + from datadog_api_client.v2.model.incident_user_defined_field_valid_value import ( + IncidentUserDefinedFieldValidValue, + ) + + return { + "attached_to": (str,), + "category": (IncidentUserDefinedFieldCategory,), + "collected": (IncidentUserDefinedFieldCollected,), + "created": (datetime,), + "default_value": (str, none_type), + "deleted": (datetime, none_type), + "display_name": (str,), + "metadata": (IncidentUserDefinedFieldMetadata,), + "modified": (datetime, none_type), + "name": (str,), + "ordinal": (str, none_type), + "prerequisite": (str, none_type), + "required": (bool,), + "reserved": (bool,), + "table_id": (int,), + "tag_key": (str, none_type), + "type": (int, none_type), + "valid_values": ([IncidentUserDefinedFieldValidValue], none_type), + } + + attribute_map = { + "attached_to": "attached_to", + "category": "category", + "collected": "collected", + "created": "created", + "default_value": "default_value", + "deleted": "deleted", + "display_name": "display_name", + "metadata": "metadata", + "modified": "modified", + "name": "name", + "ordinal": "ordinal", + "prerequisite": "prerequisite", + "required": "required", + "reserved": "reserved", + "table_id": "table_id", + "tag_key": "tag_key", + "type": "type", + "valid_values": "valid_values", + } + read_only_vars = { + "attached_to", + "created", + "deleted", + "modified", + "prerequisite", + "reserved", + "table_id", + } + + def __init__( + self_, + attached_to: str, + category: Union[IncidentUserDefinedFieldCategory, none_type], + collected: Union[IncidentUserDefinedFieldCollected, none_type], + created: datetime, + default_value: Union[str, none_type], + deleted: Union[datetime, none_type], + display_name: str, + metadata: Union[IncidentUserDefinedFieldMetadata, none_type], + modified: Union[datetime, none_type], + name: str, + ordinal: Union[str, none_type], + prerequisite: Union[str, none_type], + required: bool, + reserved: bool, + table_id: int, + tag_key: Union[str, none_type], + type: Union[int, none_type], + valid_values: Union[List[IncidentUserDefinedFieldValidValue], none_type], + **kwargs, + ): + """ + Attributes of an incident user-defined field. + + :param attached_to: The resource type this field is attached to. Always "incidents". + :type attached_to: str + + :param category: The section in which the field appears. Use "what_happened" for impact-related fields or "why_it_happened" for root cause fields. When null, the field appears in the Attributes section. + :type category: IncidentUserDefinedFieldCategory, none_type + + :param collected: The lifecycle stage at which the app prompts users to fill out this field. Cannot be set on required fields. + :type collected: IncidentUserDefinedFieldCollected, none_type + + :param created: Timestamp when the field was created. + :type created: datetime + + :param default_value: The default value for the field. + :type default_value: str, none_type + + :param deleted: Timestamp when the field was soft-deleted, or null if not deleted. + :type deleted: datetime, none_type + + :param display_name: The human-readable name shown in the UI. + :type display_name: str + + :param metadata: Metadata for autocomplete-type user-defined fields, describing how to populate autocomplete options. + :type metadata: IncidentUserDefinedFieldMetadata, none_type + + :param modified: Timestamp when the field was last modified. + :type modified: datetime, none_type + + :param name: The unique machine-readable name of the field. + :type name: str + + :param ordinal: A decimal string representing the field's display order in the UI. + :type ordinal: str, none_type + + :param prerequisite: Reserved for future use. Always null. + :type prerequisite: str, none_type + + :param required: When true, users must fill out this field on incidents. + :type required: bool + + :param reserved: When true, this field is reserved for system use and cannot be deleted. + :type reserved: bool + + :param table_id: Reserved for internal use. Always 0. + :type table_id: int + + :param tag_key: For metric tag-type fields only, the metric tag key that powers the autocomplete options. + :type tag_key: str, none_type + + :param type: The data type of the field. 1=dropdown, 2=multiselect, 3=textbox, 4=textarray, 5=metrictag, 6=autocomplete, 7=number, 8=datetime. + :type type: int, none_type + + :param valid_values: The list of allowed values for dropdown, multiselect, and autocomplete fields. + :type valid_values: [IncidentUserDefinedFieldValidValue], none_type + """ + super().__init__(kwargs) + + self_.attached_to = attached_to + self_.category = category + self_.collected = collected + self_.created = created + self_.default_value = default_value + self_.deleted = deleted + self_.display_name = display_name + self_.metadata = metadata + self_.modified = modified + self_.name = name + self_.ordinal = ordinal + self_.prerequisite = prerequisite + self_.required = required + self_.reserved = reserved + self_.table_id = table_id + self_.tag_key = tag_key + self_.type = type + self_.valid_values = valid_values diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_attributes_update_request.py b/src/datadog_api_client/v2/model/incident_user_defined_field_attributes_update_request.py new file mode 100644 index 0000000000..d082e8a079 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_attributes_update_request.py @@ -0,0 +1,101 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_user_defined_field_category import IncidentUserDefinedFieldCategory + from datadog_api_client.v2.model.incident_user_defined_field_collected import IncidentUserDefinedFieldCollected + from datadog_api_client.v2.model.incident_user_defined_field_valid_value import IncidentUserDefinedFieldValidValue + + +class IncidentUserDefinedFieldAttributesUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_user_defined_field_category import IncidentUserDefinedFieldCategory + from datadog_api_client.v2.model.incident_user_defined_field_collected import IncidentUserDefinedFieldCollected + from datadog_api_client.v2.model.incident_user_defined_field_valid_value import ( + IncidentUserDefinedFieldValidValue, + ) + + return { + "category": (IncidentUserDefinedFieldCategory,), + "collected": (IncidentUserDefinedFieldCollected,), + "default_value": (str, none_type), + "display_name": (str,), + "ordinal": (str, none_type), + "required": (bool, none_type), + "valid_values": ([IncidentUserDefinedFieldValidValue], none_type), + } + + attribute_map = { + "category": "category", + "collected": "collected", + "default_value": "default_value", + "display_name": "display_name", + "ordinal": "ordinal", + "required": "required", + "valid_values": "valid_values", + } + + def __init__( + self_, + category: Union[IncidentUserDefinedFieldCategory, none_type, UnsetType] = unset, + collected: Union[IncidentUserDefinedFieldCollected, none_type, UnsetType] = unset, + default_value: Union[str, none_type, UnsetType] = unset, + display_name: Union[str, UnsetType] = unset, + ordinal: Union[str, none_type, UnsetType] = unset, + required: Union[bool, none_type, UnsetType] = unset, + valid_values: Union[List[IncidentUserDefinedFieldValidValue], none_type, UnsetType] = unset, + **kwargs, + ): + """ + Attributes for updating an incident user-defined field. All fields are optional. + + :param category: The section in which the field appears. Use "what_happened" for impact-related fields or "why_it_happened" for root cause fields. When null, the field appears in the Attributes section. + :type category: IncidentUserDefinedFieldCategory, none_type, optional + + :param collected: The lifecycle stage at which the app prompts users to fill out this field. Cannot be set on required fields. + :type collected: IncidentUserDefinedFieldCollected, none_type, optional + + :param default_value: The default value for the field. Must be one of the valid values when valid_values is set. + :type default_value: str, none_type, optional + + :param display_name: The human-readable name shown in the UI. + :type display_name: str, optional + + :param ordinal: A decimal string representing the field's display order in the UI. + :type ordinal: str, none_type, optional + + :param required: When true, users must fill out this field on incidents. + :type required: bool, none_type, optional + + :param valid_values: The list of allowed values for dropdown and multiselect fields. Limited to 1000 values. + :type valid_values: [IncidentUserDefinedFieldValidValue], none_type, optional + """ + if category is not unset: + kwargs["category"] = category + if collected is not unset: + kwargs["collected"] = collected + if default_value is not unset: + kwargs["default_value"] = default_value + if display_name is not unset: + kwargs["display_name"] = display_name + if ordinal is not unset: + kwargs["ordinal"] = ordinal + if required is not unset: + kwargs["required"] = required + if valid_values is not unset: + kwargs["valid_values"] = valid_values + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_category.py b/src/datadog_api_client/v2/model/incident_user_defined_field_category.py new file mode 100644 index 0000000000..36f83c3fbf --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_category.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class IncidentUserDefinedFieldCategory(ModelSimple): + """ + The section in which the field appears. Use "what_happened" for impact-related fields or "why_it_happened" for root cause fields. When null, the field appears in the Attributes section. + + :param value: Must be one of ["what_happened", "why_it_happened"]. + :type value: str + """ + + allowed_values = { + "what_happened", + "why_it_happened", + } + WHAT_HAPPENED: ClassVar["IncidentUserDefinedFieldCategory"] + WHY_IT_HAPPENED: ClassVar["IncidentUserDefinedFieldCategory"] + + _nullable = True + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +IncidentUserDefinedFieldCategory.WHAT_HAPPENED = IncidentUserDefinedFieldCategory("what_happened") +IncidentUserDefinedFieldCategory.WHY_IT_HAPPENED = IncidentUserDefinedFieldCategory("why_it_happened") diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_collected.py b/src/datadog_api_client/v2/model/incident_user_defined_field_collected.py new file mode 100644 index 0000000000..3eafb5bbea --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_collected.py @@ -0,0 +1,46 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class IncidentUserDefinedFieldCollected(ModelSimple): + """ + The lifecycle stage at which the app prompts users to fill out this field. Cannot be set on required fields. + + :param value: Must be one of ["active", "stable", "resolved", "completed"]. + :type value: str + """ + + allowed_values = { + "active", + "stable", + "resolved", + "completed", + } + ACTIVE: ClassVar["IncidentUserDefinedFieldCollected"] + STABLE: ClassVar["IncidentUserDefinedFieldCollected"] + RESOLVED: ClassVar["IncidentUserDefinedFieldCollected"] + COMPLETED: ClassVar["IncidentUserDefinedFieldCollected"] + + _nullable = True + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +IncidentUserDefinedFieldCollected.ACTIVE = IncidentUserDefinedFieldCollected("active") +IncidentUserDefinedFieldCollected.STABLE = IncidentUserDefinedFieldCollected("stable") +IncidentUserDefinedFieldCollected.RESOLVED = IncidentUserDefinedFieldCollected("resolved") +IncidentUserDefinedFieldCollected.COMPLETED = IncidentUserDefinedFieldCollected("completed") diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_create_data.py b/src/datadog_api_client/v2/model/incident_user_defined_field_create_data.py new file mode 100644 index 0000000000..a36aa073b2 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_create_data.py @@ -0,0 +1,70 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_user_defined_field_attributes_create_request import ( + IncidentUserDefinedFieldAttributesCreateRequest, + ) + from datadog_api_client.v2.model.incident_user_defined_field_create_relationships import ( + IncidentUserDefinedFieldCreateRelationships, + ) + from datadog_api_client.v2.model.incident_user_defined_field_type import IncidentUserDefinedFieldType + + +class IncidentUserDefinedFieldCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_user_defined_field_attributes_create_request import ( + IncidentUserDefinedFieldAttributesCreateRequest, + ) + from datadog_api_client.v2.model.incident_user_defined_field_create_relationships import ( + IncidentUserDefinedFieldCreateRelationships, + ) + from datadog_api_client.v2.model.incident_user_defined_field_type import IncidentUserDefinedFieldType + + return { + "attributes": (IncidentUserDefinedFieldAttributesCreateRequest,), + "relationships": (IncidentUserDefinedFieldCreateRelationships,), + "type": (IncidentUserDefinedFieldType,), + } + + attribute_map = { + "attributes": "attributes", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + attributes: IncidentUserDefinedFieldAttributesCreateRequest, + relationships: IncidentUserDefinedFieldCreateRelationships, + type: IncidentUserDefinedFieldType, + **kwargs, + ): + """ + Data for creating an incident user-defined field. + + :param attributes: Attributes for creating an incident user-defined field. + :type attributes: IncidentUserDefinedFieldAttributesCreateRequest + + :param relationships: Relationships for creating an incident user-defined field. + :type relationships: IncidentUserDefinedFieldCreateRelationships + + :param type: The incident user defined fields type. + :type type: IncidentUserDefinedFieldType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.relationships = relationships + self_.type = type diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_create_relationships.py b/src/datadog_api_client/v2/model/incident_user_defined_field_create_relationships.py new file mode 100644 index 0000000000..58f025982f --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_create_relationships.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.relationship_to_incident_type import RelationshipToIncidentType + + +class IncidentUserDefinedFieldCreateRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.relationship_to_incident_type import RelationshipToIncidentType + + return { + "incident_type": (RelationshipToIncidentType,), + } + + attribute_map = { + "incident_type": "incident_type", + } + + def __init__(self_, incident_type: RelationshipToIncidentType, **kwargs): + """ + Relationships for creating an incident user-defined field. + + :param incident_type: Relationship to an incident type. + :type incident_type: RelationshipToIncidentType + """ + super().__init__(kwargs) + + self_.incident_type = incident_type diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_create_request.py b/src/datadog_api_client/v2/model/incident_user_defined_field_create_request.py new file mode 100644 index 0000000000..f44cf5a588 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_create_request.py @@ -0,0 +1,42 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_user_defined_field_create_data import IncidentUserDefinedFieldCreateData + + +class IncidentUserDefinedFieldCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_user_defined_field_create_data import ( + IncidentUserDefinedFieldCreateData, + ) + + return { + "data": (IncidentUserDefinedFieldCreateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: IncidentUserDefinedFieldCreateData, **kwargs): + """ + Request body for creating an incident user-defined field. + + :param data: Data for creating an incident user-defined field. + :type data: IncidentUserDefinedFieldCreateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_field_type.py b/src/datadog_api_client/v2/model/incident_user_defined_field_field_type.py new file mode 100644 index 0000000000..48f110cd85 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_field_type.py @@ -0,0 +1,56 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class IncidentUserDefinedFieldFieldType(ModelSimple): + """ + The data type of the field. 1=dropdown, 2=multiselect, 3=textbox, 4=textarray, 5=metrictag, 6=autocomplete, 7=number, 8=datetime. + + :param value: Must be one of [1, 2, 3, 4, 5, 6, 7, 8]. + :type value: int + """ + + allowed_values = { + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + } + DROPDOWN: ClassVar["IncidentUserDefinedFieldFieldType"] + MULTISELECT: ClassVar["IncidentUserDefinedFieldFieldType"] + TEXTBOX: ClassVar["IncidentUserDefinedFieldFieldType"] + TEXTARRAY: ClassVar["IncidentUserDefinedFieldFieldType"] + METRICTAG: ClassVar["IncidentUserDefinedFieldFieldType"] + AUTOCOMPLETE: ClassVar["IncidentUserDefinedFieldFieldType"] + NUMBER: ClassVar["IncidentUserDefinedFieldFieldType"] + DATETIME: ClassVar["IncidentUserDefinedFieldFieldType"] + + @cached_property + def openapi_types(_): + return { + "value": (int,), + } + + +IncidentUserDefinedFieldFieldType.DROPDOWN = IncidentUserDefinedFieldFieldType(1) +IncidentUserDefinedFieldFieldType.MULTISELECT = IncidentUserDefinedFieldFieldType(2) +IncidentUserDefinedFieldFieldType.TEXTBOX = IncidentUserDefinedFieldFieldType(3) +IncidentUserDefinedFieldFieldType.TEXTARRAY = IncidentUserDefinedFieldFieldType(4) +IncidentUserDefinedFieldFieldType.METRICTAG = IncidentUserDefinedFieldFieldType(5) +IncidentUserDefinedFieldFieldType.AUTOCOMPLETE = IncidentUserDefinedFieldFieldType(6) +IncidentUserDefinedFieldFieldType.NUMBER = IncidentUserDefinedFieldFieldType(7) +IncidentUserDefinedFieldFieldType.DATETIME = IncidentUserDefinedFieldFieldType(8) diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_import_request.py b/src/datadog_api_client/v2/model/incident_user_defined_field_import_request.py new file mode 100644 index 0000000000..598f4896be --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_import_request.py @@ -0,0 +1,37 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + file_type, + unset, + UnsetType, +) + + +class IncidentUserDefinedFieldImportRequest(ModelNormal): + @cached_property + def openapi_types(_): + return { + "file": (file_type,), + } + + attribute_map = { + "file": "file", + } + + def __init__(self_, file: Union[file_type, UnsetType] = unset, **kwargs): + """ + Multipart form data for importing valid values for an incident user-defined field from a CSV file. + + :param file: A CSV file where each distinct value in the first column is imported as a valid value. + :type file: file_type, optional + """ + if file is not unset: + kwargs["file"] = file + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_list_meta.py b/src/datadog_api_client/v2/model/incident_user_defined_field_list_meta.py new file mode 100644 index 0000000000..e5648840d2 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_list_meta.py @@ -0,0 +1,39 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class IncidentUserDefinedFieldListMeta(ModelNormal): + @cached_property + def openapi_types(_): + return { + "page_offset": (int,), + "total": (int,), + } + + attribute_map = { + "page_offset": "page_offset", + "total": "total", + } + + def __init__(self_, page_offset: int, total: int, **kwargs): + """ + Pagination metadata for the user-defined field list response. + + :param page_offset: The offset of the current page. + :type page_offset: int + + :param total: The total number of items in the current page. + :type total: int + """ + super().__init__(kwargs) + + self_.page_offset = page_offset + self_.total = total diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_list_response.py b/src/datadog_api_client/v2/model/incident_user_defined_field_list_response.py new file mode 100644 index 0000000000..b6592f20c2 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_list_response.py @@ -0,0 +1,54 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_user_defined_field_response_data import ( + IncidentUserDefinedFieldResponseData, + ) + from datadog_api_client.v2.model.incident_user_defined_field_list_meta import IncidentUserDefinedFieldListMeta + + +class IncidentUserDefinedFieldListResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_user_defined_field_response_data import ( + IncidentUserDefinedFieldResponseData, + ) + from datadog_api_client.v2.model.incident_user_defined_field_list_meta import IncidentUserDefinedFieldListMeta + + return { + "data": ([IncidentUserDefinedFieldResponseData],), + "meta": (IncidentUserDefinedFieldListMeta,), + } + + attribute_map = { + "data": "data", + "meta": "meta", + } + + def __init__( + self_, data: List[IncidentUserDefinedFieldResponseData], meta: IncidentUserDefinedFieldListMeta, **kwargs + ): + """ + Response containing a list of incident user-defined fields. + + :param data: An array of user-defined field objects. + :type data: [IncidentUserDefinedFieldResponseData] + + :param meta: Pagination metadata for the user-defined field list response. + :type meta: IncidentUserDefinedFieldListMeta + """ + super().__init__(kwargs) + + self_.data = data + self_.meta = meta diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_metadata.py b/src/datadog_api_client/v2/model/incident_user_defined_field_metadata.py new file mode 100644 index 0000000000..6fd152bcc3 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_metadata.py @@ -0,0 +1,94 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + UUID, +) + + +class IncidentUserDefinedFieldMetadata(ModelNormal): + _nullable = True + + @cached_property + def openapi_types(_): + return { + "category": (str,), + "search_limit_param": (str,), + "search_params": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + "search_query_param": (str,), + "search_result_path": (str,), + "search_url": (str,), + } + + attribute_map = { + "category": "category", + "search_limit_param": "search_limit_param", + "search_params": "search_params", + "search_query_param": "search_query_param", + "search_result_path": "search_result_path", + "search_url": "search_url", + } + + def __init__( + self_, + category: str, + search_limit_param: str, + search_params: Dict[str, Any], + search_query_param: str, + search_result_path: str, + search_url: str, + **kwargs, + ): + """ + Metadata for autocomplete-type user-defined fields, describing how to populate autocomplete options. + + :param category: The category of the autocomplete source. + :type category: str + + :param search_limit_param: The query parameter used to limit the number of autocomplete results. + :type search_limit_param: str + + :param search_params: Additional query parameters to include in the search URL. + :type search_params: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)} + + :param search_query_param: The query parameter used to pass typed input to the search URL. + :type search_query_param: str + + :param search_result_path: The JSON path to the results in the response body. + :type search_result_path: str + + :param search_url: The URL used to populate autocomplete options. + :type search_url: str + """ + super().__init__(kwargs) + + self_.category = category + self_.search_limit_param = search_limit_param + self_.search_params = search_params + self_.search_query_param = search_query_param + self_.search_result_path = search_result_path + self_.search_url = search_url diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_relationships.py b/src/datadog_api_client/v2/model/incident_user_defined_field_relationships.py new file mode 100644 index 0000000000..37c6847c50 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_relationships.py @@ -0,0 +1,60 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.relationship_to_user import RelationshipToUser + from datadog_api_client.v2.model.relationship_to_incident_type import RelationshipToIncidentType + + +class IncidentUserDefinedFieldRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.relationship_to_user import RelationshipToUser + from datadog_api_client.v2.model.relationship_to_incident_type import RelationshipToIncidentType + + return { + "created_by_user": (RelationshipToUser,), + "incident_type": (RelationshipToIncidentType,), + "last_modified_by_user": (RelationshipToUser,), + } + + attribute_map = { + "created_by_user": "created_by_user", + "incident_type": "incident_type", + "last_modified_by_user": "last_modified_by_user", + } + + def __init__( + self_, + created_by_user: RelationshipToUser, + incident_type: RelationshipToIncidentType, + last_modified_by_user: RelationshipToUser, + **kwargs, + ): + """ + Relationships of an incident user-defined field. + + :param created_by_user: Relationship to user. + :type created_by_user: RelationshipToUser + + :param incident_type: Relationship to an incident type. + :type incident_type: RelationshipToIncidentType + + :param last_modified_by_user: Relationship to user. + :type last_modified_by_user: RelationshipToUser + """ + super().__init__(kwargs) + + self_.created_by_user = created_by_user + self_.incident_type = incident_type + self_.last_modified_by_user = last_modified_by_user diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_response.py b/src/datadog_api_client/v2/model/incident_user_defined_field_response.py new file mode 100644 index 0000000000..362876ecd4 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_response.py @@ -0,0 +1,44 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_user_defined_field_response_data import ( + IncidentUserDefinedFieldResponseData, + ) + + +class IncidentUserDefinedFieldResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_user_defined_field_response_data import ( + IncidentUserDefinedFieldResponseData, + ) + + return { + "data": (IncidentUserDefinedFieldResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: IncidentUserDefinedFieldResponseData, **kwargs): + """ + Response containing a single incident user-defined field. + + :param data: Data object for an incident user-defined field response. + :type data: IncidentUserDefinedFieldResponseData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_response_data.py b/src/datadog_api_client/v2/model/incident_user_defined_field_response_data.py new file mode 100644 index 0000000000..51fe9902ba --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_response_data.py @@ -0,0 +1,77 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_user_defined_field_attributes_response import ( + IncidentUserDefinedFieldAttributesResponse, + ) + from datadog_api_client.v2.model.incident_user_defined_field_relationships import ( + IncidentUserDefinedFieldRelationships, + ) + from datadog_api_client.v2.model.incident_user_defined_field_type import IncidentUserDefinedFieldType + + +class IncidentUserDefinedFieldResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_user_defined_field_attributes_response import ( + IncidentUserDefinedFieldAttributesResponse, + ) + from datadog_api_client.v2.model.incident_user_defined_field_relationships import ( + IncidentUserDefinedFieldRelationships, + ) + from datadog_api_client.v2.model.incident_user_defined_field_type import IncidentUserDefinedFieldType + + return { + "attributes": (IncidentUserDefinedFieldAttributesResponse,), + "id": (str,), + "relationships": (IncidentUserDefinedFieldRelationships,), + "type": (IncidentUserDefinedFieldType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + attributes: IncidentUserDefinedFieldAttributesResponse, + id: str, + relationships: IncidentUserDefinedFieldRelationships, + type: IncidentUserDefinedFieldType, + **kwargs, + ): + """ + Data object for an incident user-defined field response. + + :param attributes: Attributes of an incident user-defined field. + :type attributes: IncidentUserDefinedFieldAttributesResponse + + :param id: The unique identifier of the user-defined field. + :type id: str + + :param relationships: Relationships of an incident user-defined field. + :type relationships: IncidentUserDefinedFieldRelationships + + :param type: The incident user defined fields type. + :type type: IncidentUserDefinedFieldType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.relationships = relationships + self_.type = type diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_update_data.py b/src/datadog_api_client/v2/model/incident_user_defined_field_update_data.py new file mode 100644 index 0000000000..0adc4725e0 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_update_data.py @@ -0,0 +1,64 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_user_defined_field_attributes_update_request import ( + IncidentUserDefinedFieldAttributesUpdateRequest, + ) + from datadog_api_client.v2.model.incident_user_defined_field_type import IncidentUserDefinedFieldType + + +class IncidentUserDefinedFieldUpdateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_user_defined_field_attributes_update_request import ( + IncidentUserDefinedFieldAttributesUpdateRequest, + ) + from datadog_api_client.v2.model.incident_user_defined_field_type import IncidentUserDefinedFieldType + + return { + "attributes": (IncidentUserDefinedFieldAttributesUpdateRequest,), + "id": (str,), + "type": (IncidentUserDefinedFieldType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: IncidentUserDefinedFieldAttributesUpdateRequest, + id: str, + type: IncidentUserDefinedFieldType, + **kwargs, + ): + """ + Data for updating an incident user-defined field. + + :param attributes: Attributes for updating an incident user-defined field. All fields are optional. + :type attributes: IncidentUserDefinedFieldAttributesUpdateRequest + + :param id: The unique identifier of the user-defined field to update. + :type id: str + + :param type: The incident user defined fields type. + :type type: IncidentUserDefinedFieldType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_update_request.py b/src/datadog_api_client/v2/model/incident_user_defined_field_update_request.py new file mode 100644 index 0000000000..6f16bc4dcf --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_update_request.py @@ -0,0 +1,42 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.incident_user_defined_field_update_data import IncidentUserDefinedFieldUpdateData + + +class IncidentUserDefinedFieldUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.incident_user_defined_field_update_data import ( + IncidentUserDefinedFieldUpdateData, + ) + + return { + "data": (IncidentUserDefinedFieldUpdateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: IncidentUserDefinedFieldUpdateData, **kwargs): + """ + Request body for updating an incident user-defined field. + + :param data: Data for updating an incident user-defined field. + :type data: IncidentUserDefinedFieldUpdateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/incident_user_defined_field_valid_value.py b/src/datadog_api_client/v2/model/incident_user_defined_field_valid_value.py new file mode 100644 index 0000000000..abc52f2fb7 --- /dev/null +++ b/src/datadog_api_client/v2/model/incident_user_defined_field_valid_value.py @@ -0,0 +1,62 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class IncidentUserDefinedFieldValidValue(ModelNormal): + @cached_property + def openapi_types(_): + return { + "description": (str,), + "display_name": (str,), + "short_description": (str,), + "value": (str,), + } + + attribute_map = { + "description": "description", + "display_name": "display_name", + "short_description": "short_description", + "value": "value", + } + + def __init__( + self_, + description: str, + display_name: str, + value: str, + short_description: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + A valid value for an incident user-defined field. + + :param description: A detailed description of the valid value. + :type description: str + + :param display_name: The human-readable display name for this value. + :type display_name: str + + :param short_description: A short description of the valid value. + :type short_description: str, optional + + :param value: The machine-readable value stored when this option is selected. + :type value: str + """ + if short_description is not unset: + kwargs["short_description"] = short_description + super().__init__(kwargs) + + self_.description = description + self_.display_name = display_name + self_.value = value diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 93bc532cfa..57fac211b5 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -2685,7 +2685,34 @@ from datadog_api_client.v2.model.incident_update_request import IncidentUpdateRequest from datadog_api_client.v2.model.incident_user_attributes import IncidentUserAttributes from datadog_api_client.v2.model.incident_user_data import IncidentUserData +from datadog_api_client.v2.model.incident_user_defined_field_attributes_create_request import ( + IncidentUserDefinedFieldAttributesCreateRequest, +) +from datadog_api_client.v2.model.incident_user_defined_field_attributes_response import ( + IncidentUserDefinedFieldAttributesResponse, +) +from datadog_api_client.v2.model.incident_user_defined_field_attributes_update_request import ( + IncidentUserDefinedFieldAttributesUpdateRequest, +) +from datadog_api_client.v2.model.incident_user_defined_field_category import IncidentUserDefinedFieldCategory +from datadog_api_client.v2.model.incident_user_defined_field_collected import IncidentUserDefinedFieldCollected +from datadog_api_client.v2.model.incident_user_defined_field_create_data import IncidentUserDefinedFieldCreateData +from datadog_api_client.v2.model.incident_user_defined_field_create_relationships import ( + IncidentUserDefinedFieldCreateRelationships, +) +from datadog_api_client.v2.model.incident_user_defined_field_create_request import IncidentUserDefinedFieldCreateRequest +from datadog_api_client.v2.model.incident_user_defined_field_field_type import IncidentUserDefinedFieldFieldType +from datadog_api_client.v2.model.incident_user_defined_field_import_request import IncidentUserDefinedFieldImportRequest +from datadog_api_client.v2.model.incident_user_defined_field_list_meta import IncidentUserDefinedFieldListMeta +from datadog_api_client.v2.model.incident_user_defined_field_list_response import IncidentUserDefinedFieldListResponse +from datadog_api_client.v2.model.incident_user_defined_field_metadata import IncidentUserDefinedFieldMetadata +from datadog_api_client.v2.model.incident_user_defined_field_relationships import IncidentUserDefinedFieldRelationships +from datadog_api_client.v2.model.incident_user_defined_field_response import IncidentUserDefinedFieldResponse +from datadog_api_client.v2.model.incident_user_defined_field_response_data import IncidentUserDefinedFieldResponseData from datadog_api_client.v2.model.incident_user_defined_field_type import IncidentUserDefinedFieldType +from datadog_api_client.v2.model.incident_user_defined_field_update_data import IncidentUserDefinedFieldUpdateData +from datadog_api_client.v2.model.incident_user_defined_field_update_request import IncidentUserDefinedFieldUpdateRequest +from datadog_api_client.v2.model.incident_user_defined_field_valid_value import IncidentUserDefinedFieldValidValue from datadog_api_client.v2.model.incidents_response import IncidentsResponse from datadog_api_client.v2.model.include_type import IncludeType from datadog_api_client.v2.model.input_schema import InputSchema @@ -8519,7 +8546,26 @@ "IncidentUpdateRequest", "IncidentUserAttributes", "IncidentUserData", + "IncidentUserDefinedFieldAttributesCreateRequest", + "IncidentUserDefinedFieldAttributesResponse", + "IncidentUserDefinedFieldAttributesUpdateRequest", + "IncidentUserDefinedFieldCategory", + "IncidentUserDefinedFieldCollected", + "IncidentUserDefinedFieldCreateData", + "IncidentUserDefinedFieldCreateRelationships", + "IncidentUserDefinedFieldCreateRequest", + "IncidentUserDefinedFieldFieldType", + "IncidentUserDefinedFieldImportRequest", + "IncidentUserDefinedFieldListMeta", + "IncidentUserDefinedFieldListResponse", + "IncidentUserDefinedFieldMetadata", + "IncidentUserDefinedFieldRelationships", + "IncidentUserDefinedFieldResponse", + "IncidentUserDefinedFieldResponseData", "IncidentUserDefinedFieldType", + "IncidentUserDefinedFieldUpdateData", + "IncidentUserDefinedFieldUpdateRequest", + "IncidentUserDefinedFieldValidValue", "IncidentsResponse", "IncludeType", "InputSchema", diff --git a/tests/v2/features/incidents.feature b/tests/v2/features/incidents.feature index 8b804137af..1a9d0863a8 100644 --- a/tests/v2/features/incidents.feature +++ b/tests/v2/features/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 @@ -927,6 +1005,30 @@ Feature: Incidents When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app + Scenario: Import values for an incident user-defined field returns "Bad Request" response + Given operation "ImportIncidentUserDefinedFieldValues" enabled + And new "ImportIncidentUserDefinedFieldValues" 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: Import values for an incident user-defined field returns "CREATED" response + Given operation "ImportIncidentUserDefinedFieldValues" enabled + And new "ImportIncidentUserDefinedFieldValues" request + And request contains "field_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 201 CREATED + + @generated @skip @team:DataDog/incident-app + Scenario: Import values for an incident user-defined field returns "Not Found" response + Given operation "ImportIncidentUserDefinedFieldValues" enabled + And new "ImportIncidentUserDefinedFieldValues" 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: List an incident's impacts returns "Bad Request" response Given new "ListIncidentImpacts" request @@ -1243,6 +1345,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/tests/v2/features/undo.json b/tests/v2/features/undo.json index a04c9b283b..c6a4a578ac 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -1782,6 +1782,12 @@ "type": "unsafe" } }, + "ImportIncidentUserDefinedFieldValues": { + "tag": "Incidents", + "undo": { + "type": "unsafe" + } + }, "DeleteGlobalIncidentHandle": { "tag": "Incidents", "undo": { @@ -1968,6 +1974,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": {