From 6a1d621d302eec8dd0145bda22e451caa5f0ebeb Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 1 Apr 2026 09:22:03 +0000 Subject: [PATCH] Regenerate client from commit be71df5 of spec repo --- .generator/schemas/v2/openapi.yaml | 863 ++++++++++++++++++ .../CreateIncidentUserDefinedField.rb | 41 + .../DeleteIncidentUserDefinedField.rb | 8 + .../incidents/GetIncidentUserDefinedField.rb | 8 + .../ListIncidentUserDefinedFields.rb | 8 + .../UpdateIncidentUserDefinedField.rb | 31 + features/scenarios_model_mapping.rb | 23 + features/v2/incidents.feature | 105 +++ features/v2/undo.json | 37 + lib/datadog_api_client/configuration.rb | 5 + lib/datadog_api_client/inflector.rb | 18 + .../v2/api/incidents_api.rb | 384 ++++++++ ...defined_field_attributes_create_request.rb | 238 +++++ ..._user_defined_field_attributes_response.rb | 394 ++++++++ ...defined_field_attributes_update_request.rb | 180 ++++ .../incident_user_defined_field_category.rb | 27 + .../incident_user_defined_field_collected.rb | 29 + ...incident_user_defined_field_create_data.rb | 165 ++++ ...user_defined_field_create_relationships.rb | 123 +++ ...ident_user_defined_field_create_request.rb | 123 +++ .../incident_user_defined_field_field_type.rb | 33 + .../incident_user_defined_field_list_meta.rb | 115 +++ ...cident_user_defined_field_list_response.rb | 146 +++ .../incident_user_defined_field_metadata.rb | 228 +++++ ...cident_user_defined_field_relationships.rb | 165 ++++ .../incident_user_defined_field_response.rb | 123 +++ ...cident_user_defined_field_response_data.rb | 186 ++++ ...incident_user_defined_field_update_data.rb | 165 ++++ ...ident_user_defined_field_update_request.rb | 123 +++ ...incident_user_defined_field_valid_value.rb | 164 ++++ 30 files changed, 4258 insertions(+) create mode 100644 examples/v2/incidents/CreateIncidentUserDefinedField.rb create mode 100644 examples/v2/incidents/DeleteIncidentUserDefinedField.rb create mode 100644 examples/v2/incidents/GetIncidentUserDefinedField.rb create mode 100644 examples/v2/incidents/ListIncidentUserDefinedFields.rb create mode 100644 examples/v2/incidents/UpdateIncidentUserDefinedField.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_attributes_create_request.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_attributes_response.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_attributes_update_request.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_category.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_collected.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_create_data.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_create_relationships.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_create_request.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_field_type.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_list_meta.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_list_response.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_metadata.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_relationships.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_response.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_response_data.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_update_data.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_update_request.rb create mode 100644 lib/datadog_api_client/v2/models/incident_user_defined_field_valid_value.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d14c3e4112d7..21a12e15ff98 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 @@ -32855,6 +32863,380 @@ components: type: $ref: "#/components/schemas/UsersType" type: object + IncidentUserDefinedFieldAttributesCreateRequest: + description: Attributes for creating an incident user-defined field. + properties: + category: + $ref: "#/components/schemas/IncidentUserDefinedFieldCategory" + collected: + $ref: "#/components/schemas/IncidentUserDefinedFieldCollected" + default_value: + description: The default value for the field. Must be one of the valid values when valid_values is set. + example: "critical" + nullable: true + type: string + display_name: + description: The human-readable name shown in the UI. Defaults to a formatted version of the name if not provided. + example: "Root Cause" + type: string + name: + description: The unique identifier of the field. Must start with a letter or digit and contain only letters, digits, underscores, or periods. + example: "root_cause" + type: string + ordinal: + description: A decimal string representing the field's display order in the UI. + example: "1.5" + nullable: true + type: string + required: + description: When true, users must fill out this field on incidents. + example: false + type: boolean + tag_key: + description: For metric tag-type fields only, the metric tag key that powers the autocomplete options. + example: "datacenter" + nullable: true + type: string + type: + $ref: "#/components/schemas/IncidentUserDefinedFieldFieldType" + valid_values: + description: The list of allowed values for dropdown and multiselect fields. Limited to 1000 values. + items: + $ref: "#/components/schemas/IncidentUserDefinedFieldValidValue" + type: array + required: + - name + - type + type: object + IncidentUserDefinedFieldAttributesResponse: + description: Attributes of an incident user-defined field. + properties: + attached_to: + description: The resource type this field is attached to. Always "incidents". + example: "incidents" + readOnly: true + type: string + category: + $ref: "#/components/schemas/IncidentUserDefinedFieldCategory" + collected: + $ref: "#/components/schemas/IncidentUserDefinedFieldCollected" + created: + description: Timestamp when the field was created. + example: "2026-03-18T08:40:05.185406Z" + format: date-time + readOnly: true + type: string + default_value: + description: The default value for the field. + example: "critical" + nullable: true + type: string + deleted: + description: Timestamp when the field was soft-deleted, or null if not deleted. + example: + format: date-time + nullable: true + readOnly: true + type: string + display_name: + description: The human-readable name shown in the UI. + example: "Root Cause" + type: string + metadata: + $ref: "#/components/schemas/IncidentUserDefinedFieldMetadata" + modified: + description: Timestamp when the field was last modified. + example: "2026-03-18T08:40:05.185406Z" + format: date-time + nullable: true + readOnly: true + type: string + name: + description: The unique identifier of the field. + example: "root_cause" + type: string + ordinal: + description: A decimal string representing the field's display order in the UI. + example: "1.5" + nullable: true + type: string + prerequisite: + description: Reserved for future use. Always null. + example: + nullable: true + readOnly: true + type: string + required: + description: When true, users must fill out this field on incidents. + example: false + type: boolean + reserved: + description: When true, this field is reserved for system use and cannot be deleted. + example: false + readOnly: true + type: boolean + table_id: + description: Reserved for internal use. Always 0. + example: 0 + format: int64 + readOnly: true + type: integer + tag_key: + description: For metric tag-type fields only, the metric tag key that powers the autocomplete options. + example: + nullable: true + type: string + type: + description: The data type of the field. 1=dropdown, 2=multiselect, 3=textbox, 4=textarray, 5=metrictag, 6=autocomplete, 7=number, 8=datetime. + example: 3 + format: int32 + maximum: 8 + minimum: 1 + nullable: true + type: integer + valid_values: + description: The list of allowed values for dropdown, multiselect, and autocomplete fields. + items: + $ref: "#/components/schemas/IncidentUserDefinedFieldValidValue" + nullable: true + type: array + required: + - attached_to + - category + - collected + - created + - default_value + - deleted + - display_name + - metadata + - modified + - name + - ordinal + - prerequisite + - required + - reserved + - table_id + - tag_key + - type + - valid_values + type: object + IncidentUserDefinedFieldAttributesUpdateRequest: + description: Attributes for updating an incident user-defined field. All fields are optional. + properties: + category: + $ref: "#/components/schemas/IncidentUserDefinedFieldCategory" + collected: + $ref: "#/components/schemas/IncidentUserDefinedFieldCollected" + default_value: + description: The default value for the field. Must be one of the valid values when valid_values is set. + example: "critical" + nullable: true + type: string + display_name: + description: The human-readable name shown in the UI. + example: "Root Cause" + type: string + ordinal: + description: A decimal string representing the field's display order in the UI. + example: "1.5" + nullable: true + type: string + required: + description: When true, users must fill out this field on incidents. + example: false + nullable: true + type: boolean + valid_values: + description: The list of allowed values for dropdown and multiselect fields. Limited to 1000 values. + items: + $ref: "#/components/schemas/IncidentUserDefinedFieldValidValue" + nullable: true + type: array + type: object + IncidentUserDefinedFieldCategory: + description: 'The section in which the field appears: "what_happened" or "why_it_happened". When null, the field appears in the Attributes section.' + enum: + - what_happened + - why_it_happened + example: what_happened + nullable: true + type: string + x-enum-varnames: + - WHAT_HAPPENED + - WHY_IT_HAPPENED + IncidentUserDefinedFieldCollected: + description: The lifecycle stage at which the app prompts users to fill out this field. Cannot be set on required fields. + enum: + - active + - stable + - resolved + - completed + example: active + nullable: true + type: string + x-enum-varnames: + - ACTIVE + - STABLE + - RESOLVED + - COMPLETED + IncidentUserDefinedFieldCreateData: + description: Data for creating an incident user-defined field. + properties: + attributes: + $ref: "#/components/schemas/IncidentUserDefinedFieldAttributesCreateRequest" + relationships: + $ref: "#/components/schemas/IncidentUserDefinedFieldCreateRelationships" + type: + $ref: "#/components/schemas/IncidentUserDefinedFieldType" + required: + - type + - attributes + - relationships + type: object + IncidentUserDefinedFieldCreateRelationships: + description: Relationships for creating an incident user-defined field. + properties: + incident_type: + $ref: "#/components/schemas/RelationshipToIncidentType" + required: + - incident_type + type: object + IncidentUserDefinedFieldCreateRequest: + description: Request body for creating an incident user-defined field. + properties: + data: + $ref: "#/components/schemas/IncidentUserDefinedFieldCreateData" + required: + - data + type: object + IncidentUserDefinedFieldFieldType: + description: The data type of the field. 1=dropdown, 2=multiselect, 3=textbox, 4=textarray, 5=metrictag, 6=autocomplete, 7=number, 8=datetime. + enum: + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + example: 3 + format: int32 + type: integer + x-enum-varnames: + - DROPDOWN + - MULTISELECT + - TEXTBOX + - TEXTARRAY + - METRICTAG + - AUTOCOMPLETE + - NUMBER + - DATETIME + IncidentUserDefinedFieldListMeta: + description: Pagination metadata for the user-defined field list response. + properties: + offset: + description: The offset of the current page. + example: 0 + format: int64 + type: integer + size: + description: The total number of items in the current page. + example: 5 + format: int64 + type: integer + type: object + IncidentUserDefinedFieldListResponse: + description: Response containing a list of incident user-defined fields. + properties: + data: + description: An array of user-defined field objects. + items: + $ref: "#/components/schemas/IncidentUserDefinedFieldResponseData" + type: array + meta: + $ref: "#/components/schemas/IncidentUserDefinedFieldListMeta" + required: + - data + - meta + type: object + IncidentUserDefinedFieldMetadata: + description: Metadata for autocomplete-type user-defined fields, describing how to populate autocomplete options. + nullable: true + properties: + category: + description: The category of the autocomplete source. + example: "teams_and_services" + type: string + search_limit_param: + description: The query parameter used to limit the number of autocomplete results. + example: "page[size]" + type: string + search_params: + additionalProperties: {} + description: Additional query parameters to include in the search URL. + type: object + search_query_param: + description: The query parameter used to pass typed input to the search URL. + example: "filter" + type: string + search_result_path: + description: The JSON path to the results in the response body. + example: "$.data[*].attributes.name" + type: string + search_url: + description: The URL used to populate autocomplete options. + example: "/api/v2/incidents/config/services" + type: string + required: + - category + - search_url + - search_query_param + - search_limit_param + - search_result_path + - search_params + type: object + IncidentUserDefinedFieldRelationships: + description: Relationships of an incident user-defined field. + properties: + created_by_user: + $ref: "#/components/schemas/RelationshipToUser" + incident_type: + $ref: "#/components/schemas/RelationshipToIncidentType" + last_modified_by_user: + $ref: "#/components/schemas/RelationshipToUser" + required: + - created_by_user + - last_modified_by_user + - incident_type + type: object + IncidentUserDefinedFieldResponse: + description: Response containing a single incident user-defined field. + properties: + data: + $ref: "#/components/schemas/IncidentUserDefinedFieldResponseData" + required: + - data + type: object + IncidentUserDefinedFieldResponseData: + description: Data object for an incident user-defined field response. + properties: + attributes: + $ref: "#/components/schemas/IncidentUserDefinedFieldAttributesResponse" + id: + description: The unique identifier of the user-defined field. + example: "00000000-0000-0000-0000-000000000000" + type: string + relationships: + $ref: "#/components/schemas/IncidentUserDefinedFieldRelationships" + type: + $ref: "#/components/schemas/IncidentUserDefinedFieldType" + required: + - id + - type + - attributes + - relationships + type: object IncidentUserDefinedFieldType: description: The incident user defined fields type. enum: @@ -32863,6 +33245,53 @@ components: type: string x-enum-varnames: - USER_DEFINED_FIELD + IncidentUserDefinedFieldUpdateData: + description: Data for updating an incident user-defined field. + properties: + attributes: + $ref: "#/components/schemas/IncidentUserDefinedFieldAttributesUpdateRequest" + id: + description: The unique identifier of the user-defined field to update. + example: "00000000-0000-0000-0000-000000000000" + type: string + type: + $ref: "#/components/schemas/IncidentUserDefinedFieldType" + required: + - id + - type + - attributes + type: object + IncidentUserDefinedFieldUpdateRequest: + description: Request body for updating an incident user-defined field. + properties: + data: + $ref: "#/components/schemas/IncidentUserDefinedFieldUpdateData" + required: + - data + type: object + IncidentUserDefinedFieldValidValue: + description: A valid value for an incident user-defined field. + properties: + description: + description: A detailed description of the valid value. + example: "A critical severity incident." + type: string + display_name: + description: The human-readable display name for this value. + example: "Critical" + type: string + short_description: + description: A short description of the valid value. + example: "Critical" + type: string + value: + description: The identifier that is stored when this option is selected. + example: "critical" + type: string + required: + - display_name + - value + type: object IncidentsResponse: description: Response with a list of incidents. properties: @@ -85722,6 +86151,440 @@ paths: x-unstable: |- **Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/config/user-defined-fields: + get: + description: Get a list of all incident user-defined fields. + operationId: ListIncidentUserDefinedFields + parameters: + - description: The number of results to return per page. Must be between 0 and 1000. + in: query + name: page[size] + schema: + default: 1000 + format: int64 + maximum: 1000 + minimum: 0 + type: integer + - description: The page number to retrieve, starting at 0. + in: query + name: page[number] + schema: + default: 0 + format: int64 + minimum: 0 + type: integer + - description: When true, include soft-deleted fields in the response. + in: query + name: include-deleted + schema: + default: false + type: boolean + - description: Filter results to fields associated with the given incident type UUID. + in: query + name: filter[incident-type] + schema: + type: string + - description: Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + in: query + name: include + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + attached_to: "incidents" + category: "what_happened" + collected: "active" + created: "2026-03-18T08:40:04.437887Z" + default_value: + deleted: + display_name: "Root Cause" + metadata: + modified: "2026-03-18T08:40:04.437887Z" + name: "root_cause" + ordinal: "1.1" + prerequisite: + required: false + reserved: false + table_id: 0 + tag_key: + type: 1 + valid_values: + - description: "A bug in the service code." + display_name: "Service Bug" + value: "service_bug" + id: "6f8f42e0-6a84-4495-9a24-6decb0a87de0" + relationships: + created_by_user: + data: + id: "00000000-0000-0000-0000-000000000001" + type: "users" + incident_type: + data: + id: "7459c30c-c661-4171-9474-db3a486377b2" + type: "incident_types" + last_modified_by_user: + data: + id: "00000000-0000-0000-0000-000000000001" + type: "users" + type: "user_defined_field" + meta: + offset: 0 + size: 1 + schema: + $ref: "#/components/schemas/IncidentUserDefinedFieldListResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_read + summary: Get a list of incident user-defined fields + tags: + - Incidents + x-permission: + operator: AND + permissions: + - incident_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Create an incident user-defined field. + operationId: CreateIncidentUserDefinedField + parameters: + - description: Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + in: query + name: include + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/IncidentUserDefinedFieldCreateRequest" + description: Incident user-defined field payload. + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + attached_to: "incidents" + category: + collected: + created: "2026-03-18T08:40:05.185406Z" + default_value: + deleted: + display_name: "Root Cause" + metadata: + modified: "2026-03-18T08:40:05.185406Z" + name: "root_cause" + ordinal: "9" + prerequisite: + required: false + reserved: false + table_id: 0 + tag_key: + type: 3 + valid_values: + id: "82263487-b540-4c12-8797-58ac1d4fed17" + relationships: + created_by_user: + data: + id: "2f2c94fe-cd6e-4f8e-b9c7-d5755aca09a6" + type: "users" + incident_type: + data: + id: "7459c30c-c661-4171-9474-db3a486377b2" + type: "incident_types" + last_modified_by_user: + data: + id: "2f2c94fe-cd6e-4f8e-b9c7-d5755aca09a6" + type: "users" + type: "user_defined_field" + schema: + $ref: "#/components/schemas/IncidentUserDefinedFieldResponse" + description: CREATED + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Create an incident user-defined field + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: AND + permissions: + - incident_settings_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/config/user-defined-fields/{field_id}: + delete: + description: Delete an incident user-defined field. + operationId: DeleteIncidentUserDefinedField + parameters: + - $ref: "#/components/parameters/IncidentUserDefinedFieldIDPathParameter" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Delete an incident user-defined field + tags: + - Incidents + x-permission: + operator: AND + permissions: + - incident_settings_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Get details of an incident user-defined field. + operationId: GetIncidentUserDefinedField + parameters: + - $ref: "#/components/parameters/IncidentUserDefinedFieldIDPathParameter" + - description: Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + in: query + name: include + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + attached_to: "incidents" + category: "what_happened" + collected: "active" + created: "2026-03-18T08:40:04.437887Z" + default_value: + deleted: + display_name: "Root Cause" + metadata: + modified: "2026-03-18T08:40:04.437887Z" + name: "root_cause" + ordinal: "1.1" + prerequisite: + required: false + reserved: false + table_id: 0 + tag_key: + type: 1 + valid_values: + - description: "A bug in the service code." + display_name: "Service Bug" + value: "service_bug" + id: "6f8f42e0-6a84-4495-9a24-6decb0a87de0" + relationships: + created_by_user: + data: + id: "00000000-0000-0000-0000-000000000001" + type: "users" + incident_type: + data: + id: "7459c30c-c661-4171-9474-db3a486377b2" + type: "incident_types" + last_modified_by_user: + data: + id: "00000000-0000-0000-0000-000000000001" + type: "users" + type: "user_defined_field" + schema: + $ref: "#/components/schemas/IncidentUserDefinedFieldResponse" + description: OK + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_read + summary: Get an incident user-defined field + tags: + - Incidents + x-permission: + operator: AND + permissions: + - incident_read + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + patch: + description: Update an incident user-defined field. + operationId: UpdateIncidentUserDefinedField + parameters: + - $ref: "#/components/parameters/IncidentUserDefinedFieldIDPathParameter" + - description: Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + in: query + name: include + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/IncidentUserDefinedFieldUpdateRequest" + description: Incident user-defined field update payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + attached_to: "incidents" + category: "what_happened" + collected: + created: "2026-03-18T08:39:49.913895Z" + default_value: + deleted: + display_name: "Root Cause" + metadata: + modified: "2026-03-18T08:39:49.922909Z" + name: "root_cause" + ordinal: "8" + prerequisite: + required: false + reserved: false + table_id: 0 + tag_key: + type: 3 + valid_values: + id: "13a731a3-a010-450e-b6a3-3d450a26170c" + relationships: + created_by_user: + data: + id: "8e7d4859-0916-4df8-b51c-5f5a4ea7815e" + type: "users" + incident_type: + data: + id: "95edc42f-c55d-46fa-92a1-a182646454af" + type: "incident_types" + last_modified_by_user: + data: + id: "8e7d4859-0916-4df8-b51c-5f5a4ea7815e" + type: "users" + type: "user_defined_field" + schema: + $ref: "#/components/schemas/IncidentUserDefinedFieldResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + $ref: "#/components/responses/UnauthorizedResponse" + "403": + $ref: "#/components/responses/ForbiddenResponse" + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Update an incident user-defined field + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: AND + permissions: + - incident_settings_write + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/incidents/import: post: description: |- diff --git a/examples/v2/incidents/CreateIncidentUserDefinedField.rb b/examples/v2/incidents/CreateIncidentUserDefinedField.rb new file mode 100644 index 000000000000..7ebfc7afd952 --- /dev/null +++ b/examples/v2/incidents/CreateIncidentUserDefinedField.rb @@ -0,0 +1,41 @@ +# Create an incident user-defined field returns "CREATED" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_incident_user_defined_field".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +body = DatadogAPIClient::V2::IncidentUserDefinedFieldCreateRequest.new({ + data: DatadogAPIClient::V2::IncidentUserDefinedFieldCreateData.new({ + attributes: DatadogAPIClient::V2::IncidentUserDefinedFieldAttributesCreateRequest.new({ + category: DatadogAPIClient::V2::IncidentUserDefinedFieldCategory::WHAT_HAPPENED, + collected: DatadogAPIClient::V2::IncidentUserDefinedFieldCollected::ACTIVE, + default_value: "critical", + display_name: "Root Cause", + name: "root_cause", + ordinal: "1.5", + required: false, + tag_key: "datacenter", + type: DatadogAPIClient::V2::IncidentUserDefinedFieldFieldType::TEXTBOX, + valid_values: [ + DatadogAPIClient::V2::IncidentUserDefinedFieldValidValue.new({ + description: "A critical severity incident.", + display_name: "Critical", + short_description: "Critical", + value: "critical", + }), + ], + }), + relationships: DatadogAPIClient::V2::IncidentUserDefinedFieldCreateRelationships.new({ + incident_type: DatadogAPIClient::V2::RelationshipToIncidentType.new({ + data: DatadogAPIClient::V2::RelationshipToIncidentTypeData.new({ + id: "00000000-0000-0000-0000-000000000000", + type: DatadogAPIClient::V2::IncidentTypeType::INCIDENT_TYPES, + }), + }), + }), + type: DatadogAPIClient::V2::IncidentUserDefinedFieldType::USER_DEFINED_FIELD, + }), +}) +p api_instance.create_incident_user_defined_field(body) diff --git a/examples/v2/incidents/DeleteIncidentUserDefinedField.rb b/examples/v2/incidents/DeleteIncidentUserDefinedField.rb new file mode 100644 index 000000000000..962c4c1ef550 --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentUserDefinedField.rb @@ -0,0 +1,8 @@ +# Delete an incident user-defined field returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_incident_user_defined_field".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new +api_instance.delete_incident_user_defined_field("00000000-0000-0000-0000-000000000000") diff --git a/examples/v2/incidents/GetIncidentUserDefinedField.rb b/examples/v2/incidents/GetIncidentUserDefinedField.rb new file mode 100644 index 000000000000..d00ed9560dfd --- /dev/null +++ b/examples/v2/incidents/GetIncidentUserDefinedField.rb @@ -0,0 +1,8 @@ +# Get an incident user-defined field returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_incident_user_defined_field".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new +p api_instance.get_incident_user_defined_field("00000000-0000-0000-0000-000000000000") diff --git a/examples/v2/incidents/ListIncidentUserDefinedFields.rb b/examples/v2/incidents/ListIncidentUserDefinedFields.rb new file mode 100644 index 000000000000..9e11ee0d359b --- /dev/null +++ b/examples/v2/incidents/ListIncidentUserDefinedFields.rb @@ -0,0 +1,8 @@ +# Get a list of incident user-defined fields returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_incident_user_defined_fields".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new +p api_instance.list_incident_user_defined_fields() diff --git a/examples/v2/incidents/UpdateIncidentUserDefinedField.rb b/examples/v2/incidents/UpdateIncidentUserDefinedField.rb new file mode 100644 index 000000000000..86195fbacadc --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentUserDefinedField.rb @@ -0,0 +1,31 @@ +# Update an incident user-defined field returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_incident_user_defined_field".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +body = DatadogAPIClient::V2::IncidentUserDefinedFieldUpdateRequest.new({ + data: DatadogAPIClient::V2::IncidentUserDefinedFieldUpdateData.new({ + attributes: DatadogAPIClient::V2::IncidentUserDefinedFieldAttributesUpdateRequest.new({ + category: DatadogAPIClient::V2::IncidentUserDefinedFieldCategory::WHAT_HAPPENED, + collected: DatadogAPIClient::V2::IncidentUserDefinedFieldCollected::ACTIVE, + default_value: "critical", + display_name: "Root Cause", + ordinal: "1.5", + required: false, + valid_values: [ + DatadogAPIClient::V2::IncidentUserDefinedFieldValidValue.new({ + description: "A critical severity incident.", + display_name: "Critical", + short_description: "Critical", + value: "critical", + }), + ], + }), + id: "00000000-0000-0000-0000-000000000000", + type: DatadogAPIClient::V2::IncidentUserDefinedFieldType::USER_DEFINED_FIELD, + }), +}) +p api_instance.update_incident_user_defined_field("00000000-0000-0000-0000-000000000000", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index df090cea2c0a..93e59da018a3 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2321,6 +2321,29 @@ "incident_type_id" => "String", "body" => "IncidentTypePatchRequest", }, + "v2.ListIncidentUserDefinedFields" => { + "page_size" => "Integer", + "page_number" => "Integer", + "include_deleted" => "Boolean", + "filter_incident_type" => "String", + "include" => "String", + }, + "v2.CreateIncidentUserDefinedField" => { + "include" => "String", + "body" => "IncidentUserDefinedFieldCreateRequest", + }, + "v2.DeleteIncidentUserDefinedField" => { + "field_id" => "String", + }, + "v2.GetIncidentUserDefinedField" => { + "field_id" => "String", + "include" => "String", + }, + "v2.UpdateIncidentUserDefinedField" => { + "field_id" => "String", + "include" => "String", + "body" => "IncidentUserDefinedFieldUpdateRequest", + }, "v2.ImportIncident" => { "include" => "Array", "body" => "IncidentImportRequest", diff --git a/features/v2/incidents.feature b/features/v2/incidents.feature index 8b804137aff6..119fa0a284e9 100644 --- a/features/v2/incidents.feature +++ b/features/v2/incidents.feature @@ -186,6 +186,30 @@ Feature: Incidents When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app + Scenario: Create an incident user-defined field returns "Bad Request" response + Given operation "CreateIncidentUserDefinedField" enabled + And new "CreateIncidentUserDefinedField" request + And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "name": "root_cause", "ordinal": "1.5", "required": false, "tag_key": "datacenter", "type": 3, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}}, "type": "user_defined_field"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Create an incident user-defined field returns "CREATED" response + Given operation "CreateIncidentUserDefinedField" enabled + And new "CreateIncidentUserDefinedField" request + And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "name": "root_cause", "ordinal": "1.5", "required": false, "tag_key": "datacenter", "type": 3, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}}, "type": "user_defined_field"}} + When the request is sent + Then the response status is 201 CREATED + + @generated @skip @team:DataDog/incident-app + Scenario: Create an incident user-defined field returns "Not Found" response + Given operation "CreateIncidentUserDefinedField" enabled + And new "CreateIncidentUserDefinedField" request + And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "name": "root_cause", "ordinal": "1.5", "required": false, "tag_key": "datacenter", "type": 3, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}}, "type": "user_defined_field"}} + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app Scenario: Create global incident handle returns "Bad Request" response Given operation "CreateGlobalIncidentHandle" enabled @@ -482,6 +506,30 @@ Feature: Incidents When the request is sent Then the response status is 204 OK + @generated @skip @team:DataDog/incident-app + Scenario: Delete an incident user-defined field returns "Bad Request" response + Given operation "DeleteIncidentUserDefinedField" enabled + And new "DeleteIncidentUserDefinedField" request + And request contains "field_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Delete an incident user-defined field returns "No Content" response + Given operation "DeleteIncidentUserDefinedField" enabled + And new "DeleteIncidentUserDefinedField" request + And request contains "field_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/incident-app + Scenario: Delete an incident user-defined field returns "Not Found" response + Given operation "DeleteIncidentUserDefinedField" enabled + And new "DeleteIncidentUserDefinedField" request + And request contains "field_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app Scenario: Delete global incident handle returns "Bad Request" response Given operation "DeleteGlobalIncidentHandle" enabled @@ -647,6 +695,20 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app + Scenario: Get a list of incident user-defined fields returns "Bad Request" response + Given operation "ListIncidentUserDefinedFields" enabled + And new "ListIncidentUserDefinedFields" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Get a list of incident user-defined fields returns "OK" response + Given operation "ListIncidentUserDefinedFields" enabled + And new "ListIncidentUserDefinedFields" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app Scenario: Get a list of incidents returns "Bad Request" response Given operation "ListIncidents" enabled @@ -703,6 +765,22 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app + Scenario: Get an incident user-defined field returns "Not Found" response + Given operation "GetIncidentUserDefinedField" enabled + And new "GetIncidentUserDefinedField" request + And request contains "field_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/incident-app + Scenario: Get an incident user-defined field returns "OK" response + Given operation "GetIncidentUserDefinedField" enabled + And new "GetIncidentUserDefinedField" request + And request contains "field_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app Scenario: Get global incident settings returns "Bad Request" response Given operation "GetGlobalIncidentSettings" enabled @@ -1243,6 +1321,33 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app + Scenario: Update an incident user-defined field returns "Bad Request" response + Given operation "UpdateIncidentUserDefinedField" enabled + And new "UpdateIncidentUserDefinedField" request + And request contains "field_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "ordinal": "1.5", "required": false, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "id": "00000000-0000-0000-0000-000000000000", "type": "user_defined_field"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Update an incident user-defined field returns "Not Found" response + Given operation "UpdateIncidentUserDefinedField" enabled + And new "UpdateIncidentUserDefinedField" request + And request contains "field_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "ordinal": "1.5", "required": false, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "id": "00000000-0000-0000-0000-000000000000", "type": "user_defined_field"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/incident-app + Scenario: Update an incident user-defined field returns "OK" response + Given operation "UpdateIncidentUserDefinedField" enabled + And new "UpdateIncidentUserDefinedField" request + And request contains "field_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "what_happened", "collected": "active", "default_value": "critical", "display_name": "Root Cause", "ordinal": "1.5", "required": false, "valid_values": [{"description": "A critical severity incident.", "display_name": "Critical", "short_description": "Critical", "value": "critical"}]}, "id": "00000000-0000-0000-0000-000000000000", "type": "user_defined_field"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app Scenario: Update global incident handle returns "Bad Request" response Given operation "UpdateGlobalIncidentHandle" enabled diff --git a/features/v2/undo.json b/features/v2/undo.json index 29b9dc1ab270..0bb78f6685bc 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -2110,6 +2110,43 @@ "type": "idempotent" } }, + "ListIncidentUserDefinedFields": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "CreateIncidentUserDefinedField": { + "tag": "Incidents", + "undo": { + "operationId": "DeleteIncidentUserDefinedField", + "parameters": [ + { + "name": "field_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteIncidentUserDefinedField": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, + "GetIncidentUserDefinedField": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "UpdateIncidentUserDefinedField": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, "ImportIncident": { "tag": "Incidents", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 95f167323cbc..74df85e5c1a9 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -286,6 +286,7 @@ def initialize "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, @@ -295,6 +296,7 @@ def initialize "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, @@ -303,6 +305,7 @@ def initialize "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.list_global_incident_handles": false, "v2.list_incident_attachments": false, @@ -313,6 +316,7 @@ def initialize "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, @@ -324,6 +328,7 @@ def initialize "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/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 1ad2605d59ac..86f2c533a8a7 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3065,7 +3065,25 @@ def overrides "v2.incident_update_request" => "IncidentUpdateRequest", "v2.incident_user_attributes" => "IncidentUserAttributes", "v2.incident_user_data" => "IncidentUserData", + "v2.incident_user_defined_field_attributes_create_request" => "IncidentUserDefinedFieldAttributesCreateRequest", + "v2.incident_user_defined_field_attributes_response" => "IncidentUserDefinedFieldAttributesResponse", + "v2.incident_user_defined_field_attributes_update_request" => "IncidentUserDefinedFieldAttributesUpdateRequest", + "v2.incident_user_defined_field_category" => "IncidentUserDefinedFieldCategory", + "v2.incident_user_defined_field_collected" => "IncidentUserDefinedFieldCollected", + "v2.incident_user_defined_field_create_data" => "IncidentUserDefinedFieldCreateData", + "v2.incident_user_defined_field_create_relationships" => "IncidentUserDefinedFieldCreateRelationships", + "v2.incident_user_defined_field_create_request" => "IncidentUserDefinedFieldCreateRequest", + "v2.incident_user_defined_field_field_type" => "IncidentUserDefinedFieldFieldType", + "v2.incident_user_defined_field_list_meta" => "IncidentUserDefinedFieldListMeta", + "v2.incident_user_defined_field_list_response" => "IncidentUserDefinedFieldListResponse", + "v2.incident_user_defined_field_metadata" => "IncidentUserDefinedFieldMetadata", + "v2.incident_user_defined_field_relationships" => "IncidentUserDefinedFieldRelationships", + "v2.incident_user_defined_field_response" => "IncidentUserDefinedFieldResponse", + "v2.incident_user_defined_field_response_data" => "IncidentUserDefinedFieldResponseData", "v2.incident_user_defined_field_type" => "IncidentUserDefinedFieldType", + "v2.incident_user_defined_field_update_data" => "IncidentUserDefinedFieldUpdateData", + "v2.incident_user_defined_field_update_request" => "IncidentUserDefinedFieldUpdateRequest", + "v2.incident_user_defined_field_valid_value" => "IncidentUserDefinedFieldValidValue", "v2.include_type" => "IncludeType", "v2.input_schema" => "InputSchema", "v2.input_schema_parameters" => "InputSchemaParameters", diff --git a/lib/datadog_api_client/v2/api/incidents_api.rb b/lib/datadog_api_client/v2/api/incidents_api.rb index 98f50a4e6594..e5ea4e02b73e 100644 --- a/lib/datadog_api_client/v2/api/incidents_api.rb +++ b/lib/datadog_api_client/v2/api/incidents_api.rb @@ -855,6 +855,81 @@ def create_incident_type_with_http_info(body, opts = {}) return data, status_code, headers end + # Create an incident user-defined field. + # + # @see #create_incident_user_defined_field_with_http_info + def create_incident_user_defined_field(body, opts = {}) + data, _status_code, _headers = create_incident_user_defined_field_with_http_info(body, opts) + data + end + + # Create an incident user-defined field. + # + # Create an incident user-defined field. + # + # @param body [IncidentUserDefinedFieldCreateRequest] Incident user-defined field payload. + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + # @return [Array<(IncidentUserDefinedFieldResponse, Integer, Hash)>] IncidentUserDefinedFieldResponse data, response status code and response headers + def create_incident_user_defined_field_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_incident_user_defined_field".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_incident_user_defined_field") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_incident_user_defined_field")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.create_incident_user_defined_field ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling IncidentsAPI.create_incident_user_defined_field" + end + # resource path + local_var_path = '/api/v2/incidents/config/user-defined-fields' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'IncidentUserDefinedFieldResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_incident_user_defined_field, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#create_incident_user_defined_field\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete global incident handle. # # @see #delete_global_incident_handle_with_http_info @@ -1575,6 +1650,77 @@ def delete_incident_type_with_http_info(incident_type_id, opts = {}) return data, status_code, headers end + # Delete an incident user-defined field. + # + # @see #delete_incident_user_defined_field_with_http_info + def delete_incident_user_defined_field(field_id, opts = {}) + delete_incident_user_defined_field_with_http_info(field_id, opts) + nil + end + + # Delete an incident user-defined field. + # + # Delete an incident user-defined field. + # + # @param field_id [String] The ID of the incident user-defined field. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_incident_user_defined_field_with_http_info(field_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_incident_user_defined_field".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_incident_user_defined_field") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_incident_user_defined_field")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.delete_incident_user_defined_field ...' + end + # verify the required parameter 'field_id' is set + if @api_client.config.client_side_validation && field_id.nil? + fail ArgumentError, "Missing the required parameter 'field_id' when calling IncidentsAPI.delete_incident_user_defined_field" + end + # resource path + local_var_path = '/api/v2/incidents/config/user-defined-fields/{field_id}'.sub('{field_id}', CGI.escape(field_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :delete_incident_user_defined_field, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#delete_incident_user_defined_field\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get global incident settings. # # @see #get_global_incident_settings_with_http_info @@ -2154,6 +2300,79 @@ def get_incident_type_with_http_info(incident_type_id, opts = {}) return data, status_code, headers end + # Get an incident user-defined field. + # + # @see #get_incident_user_defined_field_with_http_info + def get_incident_user_defined_field(field_id, opts = {}) + data, _status_code, _headers = get_incident_user_defined_field_with_http_info(field_id, opts) + data + end + + # Get an incident user-defined field. + # + # Get details of an incident user-defined field. + # + # @param field_id [String] The ID of the incident user-defined field. + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + # @return [Array<(IncidentUserDefinedFieldResponse, Integer, Hash)>] IncidentUserDefinedFieldResponse data, response status code and response headers + def get_incident_user_defined_field_with_http_info(field_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_incident_user_defined_field".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_incident_user_defined_field") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_incident_user_defined_field")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.get_incident_user_defined_field ...' + end + # verify the required parameter 'field_id' is set + if @api_client.config.client_side_validation && field_id.nil? + fail ArgumentError, "Missing the required parameter 'field_id' when calling IncidentsAPI.get_incident_user_defined_field" + end + # resource path + local_var_path = '/api/v2/incidents/config/user-defined-fields/{field_id}'.sub('{field_id}', CGI.escape(field_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'IncidentUserDefinedFieldResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_incident_user_defined_field, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#get_incident_user_defined_field\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Import an incident. # # @see #import_incident_with_http_info @@ -2948,6 +3167,91 @@ def list_incident_types_with_http_info(opts = {}) return data, status_code, headers end + # Get a list of incident user-defined fields. + # + # @see #list_incident_user_defined_fields_with_http_info + def list_incident_user_defined_fields(opts = {}) + data, _status_code, _headers = list_incident_user_defined_fields_with_http_info(opts) + data + end + + # Get a list of incident user-defined fields. + # + # Get a list of all incident user-defined fields. + # + # @param opts [Hash] the optional parameters + # @option opts [Integer] :page_size The number of results to return per page. Must be between 0 and 1000. + # @option opts [Integer] :page_number The page number to retrieve, starting at 0. + # @option opts [Boolean] :include_deleted When true, include soft-deleted fields in the response. + # @option opts [String] :filter_incident_type Filter results to fields associated with the given incident type UUID. + # @option opts [String] :include Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + # @return [Array<(IncidentUserDefinedFieldListResponse, Integer, Hash)>] IncidentUserDefinedFieldListResponse data, response status code and response headers + def list_incident_user_defined_fields_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_incident_user_defined_fields".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_incident_user_defined_fields") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_incident_user_defined_fields")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.list_incident_user_defined_fields ...' + end + if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000 + fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling IncidentsAPI.list_incident_user_defined_fields, must be smaller than or equal to 1000.' + end + if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0 + fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling IncidentsAPI.list_incident_user_defined_fields, must be greater than or equal to 0.' + end + if @api_client.config.client_side_validation && !opts[:'page_number'].nil? && opts[:'page_number'] < 0 + fail ArgumentError, 'invalid value for "opts[:"page_number"]" when calling IncidentsAPI.list_incident_user_defined_fields, must be greater than or equal to 0.' + end + # resource path + local_var_path = '/api/v2/incidents/config/user-defined-fields' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? + query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil? + query_params[:'include-deleted'] = opts[:'include_deleted'] if !opts[:'include_deleted'].nil? + query_params[:'filter[incident-type]'] = opts[:'filter_incident_type'] if !opts[:'filter_incident_type'].nil? + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'IncidentUserDefinedFieldListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_incident_user_defined_fields, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#list_incident_user_defined_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Search for incidents. # # @see #search_incidents_with_http_info @@ -3848,5 +4152,85 @@ def update_incident_type_with_http_info(incident_type_id, body, opts = {}) end return data, status_code, headers end + + # Update an incident user-defined field. + # + # @see #update_incident_user_defined_field_with_http_info + def update_incident_user_defined_field(field_id, body, opts = {}) + data, _status_code, _headers = update_incident_user_defined_field_with_http_info(field_id, body, opts) + data + end + + # Update an incident user-defined field. + # + # Update an incident user-defined field. + # + # @param field_id [String] The ID of the incident user-defined field. + # @param body [IncidentUserDefinedFieldUpdateRequest] Incident user-defined field update payload. + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of related resources to include. Supported values are "last_modified_by_user", "created_by_user", and "incident_type". + # @return [Array<(IncidentUserDefinedFieldResponse, Integer, Hash)>] IncidentUserDefinedFieldResponse data, response status code and response headers + def update_incident_user_defined_field_with_http_info(field_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_incident_user_defined_field".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_incident_user_defined_field") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_incident_user_defined_field")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.update_incident_user_defined_field ...' + end + # verify the required parameter 'field_id' is set + if @api_client.config.client_side_validation && field_id.nil? + fail ArgumentError, "Missing the required parameter 'field_id' when calling IncidentsAPI.update_incident_user_defined_field" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling IncidentsAPI.update_incident_user_defined_field" + end + # resource path + local_var_path = '/api/v2/incidents/config/user-defined-fields/{field_id}'.sub('{field_id}', CGI.escape(field_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'IncidentUserDefinedFieldResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_incident_user_defined_field, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#update_incident_user_defined_field\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_attributes_create_request.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_attributes_create_request.rb new file mode 100644 index 000000000000..1ac7cf5cce32 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_attributes_create_request.rb @@ -0,0 +1,238 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for creating an incident user-defined field. + class IncidentUserDefinedFieldAttributesCreateRequest + include BaseGenericModel + + # The section in which the field appears: "what_happened" or "why_it_happened". When null, the field appears in the Attributes section. + attr_accessor :category + + # The lifecycle stage at which the app prompts users to fill out this field. Cannot be set on required fields. + attr_accessor :collected + + # The default value for the field. Must be one of the valid values when valid_values is set. + attr_accessor :default_value + + # The human-readable name shown in the UI. Defaults to a formatted version of the name if not provided. + attr_accessor :display_name + + # The unique identifier of the field. Must start with a letter or digit and contain only letters, digits, underscores, or periods. + attr_reader :name + + # A decimal string representing the field's display order in the UI. + attr_accessor :ordinal + + # When true, users must fill out this field on incidents. + attr_accessor :required + + # For metric tag-type fields only, the metric tag key that powers the autocomplete options. + attr_accessor :tag_key + + # The data type of the field. 1=dropdown, 2=multiselect, 3=textbox, 4=textarray, 5=metrictag, 6=autocomplete, 7=number, 8=datetime. + attr_reader :type + + # The list of allowed values for dropdown and multiselect fields. Limited to 1000 values. + attr_accessor :valid_values + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.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' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'category' => :'IncidentUserDefinedFieldCategory', + :'collected' => :'IncidentUserDefinedFieldCollected', + :'default_value' => :'String', + :'display_name' => :'String', + :'name' => :'String', + :'ordinal' => :'String', + :'required' => :'Boolean', + :'tag_key' => :'String', + :'type' => :'IncidentUserDefinedFieldFieldType', + :'valid_values' => :'Array' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'category', + :'collected', + :'default_value', + :'ordinal', + :'tag_key', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentUserDefinedFieldAttributesCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'collected') + self.collected = attributes[:'collected'] + end + + if attributes.key?(:'default_value') + self.default_value = attributes[:'default_value'] + end + + if attributes.key?(:'display_name') + self.display_name = attributes[:'display_name'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'ordinal') + self.ordinal = attributes[:'ordinal'] + end + + if attributes.key?(:'required') + self.required = attributes[:'required'] + end + + if attributes.key?(:'tag_key') + self.tag_key = attributes[:'tag_key'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'valid_values') + if (value = attributes[:'valid_values']).is_a?(Array) + self.valid_values = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @name.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + category == o.category && + collected == o.collected && + default_value == o.default_value && + display_name == o.display_name && + name == o.name && + ordinal == o.ordinal && + required == o.required && + tag_key == o.tag_key && + type == o.type && + valid_values == o.valid_values && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [category, collected, default_value, display_name, name, ordinal, required, tag_key, type, valid_values, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_attributes_response.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_attributes_response.rb new file mode 100644 index 000000000000..525f05b232b5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_attributes_response.rb @@ -0,0 +1,394 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of an incident user-defined field. + class IncidentUserDefinedFieldAttributesResponse + include BaseGenericModel + + # The resource type this field is attached to. Always "incidents". + attr_reader :attached_to + + # The section in which the field appears: "what_happened" or "why_it_happened". When null, the field appears in the Attributes section. + attr_accessor :category + + # The lifecycle stage at which the app prompts users to fill out this field. Cannot be set on required fields. + attr_accessor :collected + + # Timestamp when the field was created. + attr_reader :created + + # The default value for the field. + attr_accessor :default_value + + # Timestamp when the field was soft-deleted, or null if not deleted. + attr_accessor :deleted + + # The human-readable name shown in the UI. + attr_reader :display_name + + # Metadata for autocomplete-type user-defined fields, describing how to populate autocomplete options. + attr_accessor :metadata + + # Timestamp when the field was last modified. + attr_accessor :modified + + # The unique identifier of the field. + attr_reader :name + + # A decimal string representing the field's display order in the UI. + attr_accessor :ordinal + + # Reserved for future use. Always null. + attr_accessor :prerequisite + + # When true, users must fill out this field on incidents. + attr_reader :required + + # When true, this field is reserved for system use and cannot be deleted. + attr_reader :reserved + + # Reserved for internal use. Always 0. + attr_reader :table_id + + # For metric tag-type fields only, the metric tag key that powers the autocomplete options. + attr_accessor :tag_key + + # The data type of the field. 1=dropdown, 2=multiselect, 3=textbox, 4=textarray, 5=metrictag, 6=autocomplete, 7=number, 8=datetime. + attr_reader :type + + # The list of allowed values for dropdown, multiselect, and autocomplete fields. + attr_accessor :valid_values + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.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' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attached_to' => :'String', + :'category' => :'IncidentUserDefinedFieldCategory', + :'collected' => :'IncidentUserDefinedFieldCollected', + :'created' => :'Time', + :'default_value' => :'String', + :'deleted' => :'Time', + :'display_name' => :'String', + :'metadata' => :'IncidentUserDefinedFieldMetadata', + :'modified' => :'Time', + :'name' => :'String', + :'ordinal' => :'String', + :'prerequisite' => :'String', + :'required' => :'Boolean', + :'reserved' => :'Boolean', + :'table_id' => :'Integer', + :'tag_key' => :'String', + :'type' => :'Integer', + :'valid_values' => :'Array' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'category', + :'collected', + :'default_value', + :'deleted', + :'metadata', + :'modified', + :'ordinal', + :'prerequisite', + :'tag_key', + :'type', + :'valid_values', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentUserDefinedFieldAttributesResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attached_to') + self.attached_to = attributes[:'attached_to'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'collected') + self.collected = attributes[:'collected'] + end + + if attributes.key?(:'created') + self.created = attributes[:'created'] + end + + if attributes.key?(:'default_value') + self.default_value = attributes[:'default_value'] + end + + if attributes.key?(:'deleted') + self.deleted = attributes[:'deleted'] + end + + if attributes.key?(:'display_name') + self.display_name = attributes[:'display_name'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'modified') + self.modified = attributes[:'modified'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'ordinal') + self.ordinal = attributes[:'ordinal'] + end + + if attributes.key?(:'prerequisite') + self.prerequisite = attributes[:'prerequisite'] + end + + if attributes.key?(:'required') + self.required = attributes[:'required'] + end + + if attributes.key?(:'reserved') + self.reserved = attributes[:'reserved'] + end + + if attributes.key?(:'table_id') + self.table_id = attributes[:'table_id'] + end + + if attributes.key?(:'tag_key') + self.tag_key = attributes[:'tag_key'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'valid_values') + if (value = attributes[:'valid_values']).is_a?(Array) + self.valid_values = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attached_to.nil? + return false if @created.nil? + return false if @display_name.nil? + return false if @name.nil? + return false if @required.nil? + return false if @reserved.nil? + return false if @table_id.nil? + return false if @type > 8 + return false if @type < 1 + true + end + + # Custom attribute writer method with validation + # @param attached_to [Object] Object to be assigned + # @!visibility private + def attached_to=(attached_to) + if attached_to.nil? + fail ArgumentError, 'invalid value for "attached_to", attached_to cannot be nil.' + end + @attached_to = attached_to + end + + # Custom attribute writer method with validation + # @param created [Object] Object to be assigned + # @!visibility private + def created=(created) + if created.nil? + fail ArgumentError, 'invalid value for "created", created cannot be nil.' + end + @created = created + end + + # Custom attribute writer method with validation + # @param display_name [Object] Object to be assigned + # @!visibility private + def display_name=(display_name) + if display_name.nil? + fail ArgumentError, 'invalid value for "display_name", display_name cannot be nil.' + end + @display_name = display_name + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param required [Object] Object to be assigned + # @!visibility private + def required=(required) + if required.nil? + fail ArgumentError, 'invalid value for "required", required cannot be nil.' + end + @required = required + end + + # Custom attribute writer method with validation + # @param reserved [Object] Object to be assigned + # @!visibility private + def reserved=(reserved) + if reserved.nil? + fail ArgumentError, 'invalid value for "reserved", reserved cannot be nil.' + end + @reserved = reserved + end + + # Custom attribute writer method with validation + # @param table_id [Object] Object to be assigned + # @!visibility private + def table_id=(table_id) + if table_id.nil? + fail ArgumentError, 'invalid value for "table_id", table_id cannot be nil.' + end + @table_id = table_id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type > 8 + fail ArgumentError, 'invalid value for "type", must be smaller than or equal to 8.' + end + if type < 1 + fail ArgumentError, 'invalid value for "type", must be greater than or equal to 1.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attached_to == o.attached_to && + category == o.category && + collected == o.collected && + created == o.created && + default_value == o.default_value && + deleted == o.deleted && + display_name == o.display_name && + metadata == o.metadata && + modified == o.modified && + name == o.name && + ordinal == o.ordinal && + prerequisite == o.prerequisite && + required == o.required && + reserved == o.reserved && + table_id == o.table_id && + tag_key == o.tag_key && + type == o.type && + valid_values == o.valid_values && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attached_to, category, collected, created, default_value, deleted, display_name, metadata, modified, name, ordinal, prerequisite, required, reserved, table_id, tag_key, type, valid_values, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_attributes_update_request.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_attributes_update_request.rb new file mode 100644 index 000000000000..a5be83259f5a --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_attributes_update_request.rb @@ -0,0 +1,180 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for updating an incident user-defined field. All fields are optional. + class IncidentUserDefinedFieldAttributesUpdateRequest + include BaseGenericModel + + # The section in which the field appears: "what_happened" or "why_it_happened". When null, the field appears in the Attributes section. + attr_accessor :category + + # The lifecycle stage at which the app prompts users to fill out this field. Cannot be set on required fields. + attr_accessor :collected + + # The default value for the field. Must be one of the valid values when valid_values is set. + attr_accessor :default_value + + # The human-readable name shown in the UI. + attr_accessor :display_name + + # A decimal string representing the field's display order in the UI. + attr_accessor :ordinal + + # When true, users must fill out this field on incidents. + attr_accessor :required + + # The list of allowed values for dropdown and multiselect fields. Limited to 1000 values. + attr_accessor :valid_values + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'category' => :'category', + :'collected' => :'collected', + :'default_value' => :'default_value', + :'display_name' => :'display_name', + :'ordinal' => :'ordinal', + :'required' => :'required', + :'valid_values' => :'valid_values' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'category' => :'IncidentUserDefinedFieldCategory', + :'collected' => :'IncidentUserDefinedFieldCollected', + :'default_value' => :'String', + :'display_name' => :'String', + :'ordinal' => :'String', + :'required' => :'Boolean', + :'valid_values' => :'Array' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'category', + :'collected', + :'default_value', + :'ordinal', + :'required', + :'valid_values', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentUserDefinedFieldAttributesUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'collected') + self.collected = attributes[:'collected'] + end + + if attributes.key?(:'default_value') + self.default_value = attributes[:'default_value'] + end + + if attributes.key?(:'display_name') + self.display_name = attributes[:'display_name'] + end + + if attributes.key?(:'ordinal') + self.ordinal = attributes[:'ordinal'] + end + + if attributes.key?(:'required') + self.required = attributes[:'required'] + end + + if attributes.key?(:'valid_values') + if (value = attributes[:'valid_values']).is_a?(Array) + self.valid_values = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + category == o.category && + collected == o.collected && + default_value == o.default_value && + display_name == o.display_name && + ordinal == o.ordinal && + required == o.required && + valid_values == o.valid_values && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [category, collected, default_value, display_name, ordinal, required, valid_values, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_category.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_category.rb new file mode 100644 index 000000000000..c014e575bf1c --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_category.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The section in which the field appears: "what_happened" or "why_it_happened". When null, the field appears in the Attributes section. + class IncidentUserDefinedFieldCategory + include BaseEnumModel + + WHAT_HAPPENED = "what_happened".freeze + WHY_IT_HAPPENED = "why_it_happened".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_collected.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_collected.rb new file mode 100644 index 000000000000..877b75c15e4b --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_collected.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The lifecycle stage at which the app prompts users to fill out this field. Cannot be set on required fields. + class IncidentUserDefinedFieldCollected + include BaseEnumModel + + ACTIVE = "active".freeze + STABLE = "stable".freeze + RESOLVED = "resolved".freeze + COMPLETED = "completed".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_create_data.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_create_data.rb new file mode 100644 index 000000000000..42f4873aaa98 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_create_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data for creating an incident user-defined field. + class IncidentUserDefinedFieldCreateData + include BaseGenericModel + + # Attributes for creating an incident user-defined field. + attr_reader :attributes + + # Relationships for creating an incident user-defined field. + attr_reader :relationships + + # The incident user defined fields type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'IncidentUserDefinedFieldAttributesCreateRequest', + :'relationships' => :'IncidentUserDefinedFieldCreateRelationships', + :'type' => :'IncidentUserDefinedFieldType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentUserDefinedFieldCreateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @relationships.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param relationships [Object] Object to be assigned + # @!visibility private + def relationships=(relationships) + if relationships.nil? + fail ArgumentError, 'invalid value for "relationships", relationships cannot be nil.' + end + @relationships = relationships + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_create_relationships.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_create_relationships.rb new file mode 100644 index 000000000000..940fd1546031 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_create_relationships.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationships for creating an incident user-defined field. + class IncidentUserDefinedFieldCreateRelationships + include BaseGenericModel + + # Relationship to an incident type. + attr_reader :incident_type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'incident_type' => :'incident_type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'incident_type' => :'RelationshipToIncidentType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentUserDefinedFieldCreateRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'incident_type') + self.incident_type = attributes[:'incident_type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @incident_type.nil? + true + end + + # Custom attribute writer method with validation + # @param incident_type [Object] Object to be assigned + # @!visibility private + def incident_type=(incident_type) + if incident_type.nil? + fail ArgumentError, 'invalid value for "incident_type", incident_type cannot be nil.' + end + @incident_type = incident_type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + incident_type == o.incident_type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [incident_type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_create_request.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_create_request.rb new file mode 100644 index 000000000000..48bebd7b87dc --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request body for creating an incident user-defined field. + class IncidentUserDefinedFieldCreateRequest + include BaseGenericModel + + # Data for creating an incident user-defined field. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'IncidentUserDefinedFieldCreateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentUserDefinedFieldCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_field_type.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_field_type.rb new file mode 100644 index 000000000000..7d8ec7940031 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_field_type.rb @@ -0,0 +1,33 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The data type of the field. 1=dropdown, 2=multiselect, 3=textbox, 4=textarray, 5=metrictag, 6=autocomplete, 7=number, 8=datetime. + class IncidentUserDefinedFieldFieldType + include BaseEnumModel + + DROPDOWN = 1.freeze + MULTISELECT = 2.freeze + TEXTBOX = 3.freeze + TEXTARRAY = 4.freeze + METRICTAG = 5.freeze + AUTOCOMPLETE = 6.freeze + NUMBER = 7.freeze + DATETIME = 8.freeze + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_list_meta.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_list_meta.rb new file mode 100644 index 000000000000..da29880337d4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_list_meta.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Pagination metadata for the user-defined field list response. + class IncidentUserDefinedFieldListMeta + include BaseGenericModel + + # The offset of the current page. + attr_accessor :offset + + # The total number of items in the current page. + attr_accessor :size + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'offset' => :'offset', + :'size' => :'size' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'offset' => :'Integer', + :'size' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentUserDefinedFieldListMeta` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'offset') + self.offset = attributes[:'offset'] + end + + if attributes.key?(:'size') + self.size = attributes[:'size'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + offset == o.offset && + size == o.size && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [offset, size, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_list_response.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_list_response.rb new file mode 100644 index 000000000000..61ecd16b2f59 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_list_response.rb @@ -0,0 +1,146 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a list of incident user-defined fields. + class IncidentUserDefinedFieldListResponse + include BaseGenericModel + + # An array of user-defined field objects. + attr_reader :data + + # Pagination metadata for the user-defined field list response. + attr_reader :meta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'meta' => :'IncidentUserDefinedFieldListMeta' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentUserDefinedFieldListResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + return false if @meta.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Custom attribute writer method with validation + # @param meta [Object] Object to be assigned + # @!visibility private + def meta=(meta) + if meta.nil? + fail ArgumentError, 'invalid value for "meta", meta cannot be nil.' + end + @meta = meta + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + meta == o.meta && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, meta, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_metadata.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_metadata.rb new file mode 100644 index 000000000000..64bf9e92cbe0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_metadata.rb @@ -0,0 +1,228 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Metadata for autocomplete-type user-defined fields, describing how to populate autocomplete options. + class IncidentUserDefinedFieldMetadata + include BaseGenericModel + + # The category of the autocomplete source. + attr_reader :category + + # The query parameter used to limit the number of autocomplete results. + attr_reader :search_limit_param + + # Additional query parameters to include in the search URL. + attr_reader :search_params + + # The query parameter used to pass typed input to the search URL. + attr_reader :search_query_param + + # The JSON path to the results in the response body. + attr_reader :search_result_path + + # The URL used to populate autocomplete options. + attr_reader :search_url + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.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' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'category' => :'String', + :'search_limit_param' => :'String', + :'search_params' => :'Hash', + :'search_query_param' => :'String', + :'search_result_path' => :'String', + :'search_url' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentUserDefinedFieldMetadata` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'search_limit_param') + self.search_limit_param = attributes[:'search_limit_param'] + end + + if attributes.key?(:'search_params') + self.search_params = attributes[:'search_params'] + end + + if attributes.key?(:'search_query_param') + self.search_query_param = attributes[:'search_query_param'] + end + + if attributes.key?(:'search_result_path') + self.search_result_path = attributes[:'search_result_path'] + end + + if attributes.key?(:'search_url') + self.search_url = attributes[:'search_url'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @category.nil? + return false if @search_limit_param.nil? + return false if @search_params.nil? + return false if @search_query_param.nil? + return false if @search_result_path.nil? + return false if @search_url.nil? + true + end + + # Custom attribute writer method with validation + # @param category [Object] Object to be assigned + # @!visibility private + def category=(category) + if category.nil? + fail ArgumentError, 'invalid value for "category", category cannot be nil.' + end + @category = category + end + + # Custom attribute writer method with validation + # @param search_limit_param [Object] Object to be assigned + # @!visibility private + def search_limit_param=(search_limit_param) + if search_limit_param.nil? + fail ArgumentError, 'invalid value for "search_limit_param", search_limit_param cannot be nil.' + end + @search_limit_param = search_limit_param + end + + # Custom attribute writer method with validation + # @param search_params [Object] Object to be assigned + # @!visibility private + def search_params=(search_params) + if search_params.nil? + fail ArgumentError, 'invalid value for "search_params", search_params cannot be nil.' + end + @search_params = search_params + end + + # Custom attribute writer method with validation + # @param search_query_param [Object] Object to be assigned + # @!visibility private + def search_query_param=(search_query_param) + if search_query_param.nil? + fail ArgumentError, 'invalid value for "search_query_param", search_query_param cannot be nil.' + end + @search_query_param = search_query_param + end + + # Custom attribute writer method with validation + # @param search_result_path [Object] Object to be assigned + # @!visibility private + def search_result_path=(search_result_path) + if search_result_path.nil? + fail ArgumentError, 'invalid value for "search_result_path", search_result_path cannot be nil.' + end + @search_result_path = search_result_path + end + + # Custom attribute writer method with validation + # @param search_url [Object] Object to be assigned + # @!visibility private + def search_url=(search_url) + if search_url.nil? + fail ArgumentError, 'invalid value for "search_url", search_url cannot be nil.' + end + @search_url = search_url + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + category == o.category && + search_limit_param == o.search_limit_param && + search_params == o.search_params && + search_query_param == o.search_query_param && + search_result_path == o.search_result_path && + search_url == o.search_url && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [category, search_limit_param, search_params, search_query_param, search_result_path, search_url, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_relationships.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_relationships.rb new file mode 100644 index 000000000000..007515b7916b --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_relationships.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationships of an incident user-defined field. + class IncidentUserDefinedFieldRelationships + include BaseGenericModel + + # Relationship to user. + attr_reader :created_by_user + + # Relationship to an incident type. + attr_reader :incident_type + + # Relationship to user. + attr_reader :last_modified_by_user + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_by_user' => :'created_by_user', + :'incident_type' => :'incident_type', + :'last_modified_by_user' => :'last_modified_by_user' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_by_user' => :'RelationshipToUser', + :'incident_type' => :'RelationshipToIncidentType', + :'last_modified_by_user' => :'RelationshipToUser' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentUserDefinedFieldRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'created_by_user') + self.created_by_user = attributes[:'created_by_user'] + end + + if attributes.key?(:'incident_type') + self.incident_type = attributes[:'incident_type'] + end + + if attributes.key?(:'last_modified_by_user') + self.last_modified_by_user = attributes[:'last_modified_by_user'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @created_by_user.nil? + return false if @incident_type.nil? + return false if @last_modified_by_user.nil? + true + end + + # Custom attribute writer method with validation + # @param created_by_user [Object] Object to be assigned + # @!visibility private + def created_by_user=(created_by_user) + if created_by_user.nil? + fail ArgumentError, 'invalid value for "created_by_user", created_by_user cannot be nil.' + end + @created_by_user = created_by_user + end + + # Custom attribute writer method with validation + # @param incident_type [Object] Object to be assigned + # @!visibility private + def incident_type=(incident_type) + if incident_type.nil? + fail ArgumentError, 'invalid value for "incident_type", incident_type cannot be nil.' + end + @incident_type = incident_type + end + + # Custom attribute writer method with validation + # @param last_modified_by_user [Object] Object to be assigned + # @!visibility private + def last_modified_by_user=(last_modified_by_user) + if last_modified_by_user.nil? + fail ArgumentError, 'invalid value for "last_modified_by_user", last_modified_by_user cannot be nil.' + end + @last_modified_by_user = last_modified_by_user + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_by_user == o.created_by_user && + incident_type == o.incident_type && + last_modified_by_user == o.last_modified_by_user && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_by_user, incident_type, last_modified_by_user, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_response.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_response.rb new file mode 100644 index 000000000000..bfe1f3d55556 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a single incident user-defined field. + class IncidentUserDefinedFieldResponse + include BaseGenericModel + + # Data object for an incident user-defined field response. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'IncidentUserDefinedFieldResponseData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentUserDefinedFieldResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_response_data.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_response_data.rb new file mode 100644 index 000000000000..cd0d3b0b8feb --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_response_data.rb @@ -0,0 +1,186 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data object for an incident user-defined field response. + class IncidentUserDefinedFieldResponseData + include BaseGenericModel + + # Attributes of an incident user-defined field. + attr_reader :attributes + + # The unique identifier of the user-defined field. + attr_reader :id + + # Relationships of an incident user-defined field. + attr_reader :relationships + + # The incident user defined fields type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'IncidentUserDefinedFieldAttributesResponse', + :'id' => :'String', + :'relationships' => :'IncidentUserDefinedFieldRelationships', + :'type' => :'IncidentUserDefinedFieldType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentUserDefinedFieldResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @relationships.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param relationships [Object] Object to be assigned + # @!visibility private + def relationships=(relationships) + if relationships.nil? + fail ArgumentError, 'invalid value for "relationships", relationships cannot be nil.' + end + @relationships = relationships + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_update_data.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_update_data.rb new file mode 100644 index 000000000000..48d620affcf0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_update_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data for updating an incident user-defined field. + class IncidentUserDefinedFieldUpdateData + include BaseGenericModel + + # Attributes for updating an incident user-defined field. All fields are optional. + attr_reader :attributes + + # The unique identifier of the user-defined field to update. + attr_reader :id + + # The incident user defined fields type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'IncidentUserDefinedFieldAttributesUpdateRequest', + :'id' => :'String', + :'type' => :'IncidentUserDefinedFieldType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentUserDefinedFieldUpdateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_update_request.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_update_request.rb new file mode 100644 index 000000000000..b9181b8b6d53 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_update_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request body for updating an incident user-defined field. + class IncidentUserDefinedFieldUpdateRequest + include BaseGenericModel + + # Data for updating an incident user-defined field. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'IncidentUserDefinedFieldUpdateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentUserDefinedFieldUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_field_valid_value.rb b/lib/datadog_api_client/v2/models/incident_user_defined_field_valid_value.rb new file mode 100644 index 000000000000..10633f718049 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_field_valid_value.rb @@ -0,0 +1,164 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A valid value for an incident user-defined field. + class IncidentUserDefinedFieldValidValue + include BaseGenericModel + + # A detailed description of the valid value. + attr_accessor :description + + # The human-readable display name for this value. + attr_reader :display_name + + # A short description of the valid value. + attr_accessor :short_description + + # The identifier that is stored when this option is selected. + attr_reader :value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'display_name' => :'display_name', + :'short_description' => :'short_description', + :'value' => :'value' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'display_name' => :'String', + :'short_description' => :'String', + :'value' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentUserDefinedFieldValidValue` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'display_name') + self.display_name = attributes[:'display_name'] + end + + if attributes.key?(:'short_description') + self.short_description = attributes[:'short_description'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @display_name.nil? + return false if @value.nil? + true + end + + # Custom attribute writer method with validation + # @param display_name [Object] Object to be assigned + # @!visibility private + def display_name=(display_name) + if display_name.nil? + fail ArgumentError, 'invalid value for "display_name", display_name cannot be nil.' + end + @display_name = display_name + end + + # Custom attribute writer method with validation + # @param value [Object] Object to be assigned + # @!visibility private + def value=(value) + if value.nil? + fail ArgumentError, 'invalid value for "value", value cannot be nil.' + end + @value = value + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + display_name == o.display_name && + short_description == o.short_description && + value == o.value && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, display_name, short_description, value, additional_properties].hash + end + end +end