diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index fa9ffba15741..2d6b6c945a6e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -861,6 +861,15 @@ components: schema: example: "00000000-0000-0000-0000-000000000000" type: string + IncidentUserDefinedRoleIDPathParameter: + description: The UUID of the incident user-defined role. + in: path + name: role_id + required: true + schema: + example: "00000000-0000-0000-0000-000000000002" + format: uuid + type: string Include: description: Include relationship data. explode: true @@ -47808,6 +47817,229 @@ components: - display_name - value type: object + IncidentUserDefinedRoleDataAttributesRequest: + description: Attributes for creating an incident user-defined role. + properties: + description: + description: A description of the user-defined role. + example: "The technical lead for the incident." + nullable: true + type: string + name: + description: The name of the user-defined role. + example: "Tech Lead" + type: string + policy: + $ref: "#/components/schemas/IncidentUserDefinedRolePolicy" + required: + - name + - policy + type: object + IncidentUserDefinedRoleDataAttributesResponse: + description: Attributes of an incident user-defined role. + properties: + created: + description: Timestamp when the role was created. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + description: + description: A description of the user-defined role. + example: "The technical lead for the incident." + nullable: true + type: string + modified: + description: Timestamp when the role was last modified. + example: "2024-01-01T00:00:00.000Z" + format: date-time + type: string + name: + description: The name of the user-defined role. + example: "Tech Lead" + type: string + policy: + $ref: "#/components/schemas/IncidentUserDefinedRolePolicy" + required: + - name + - policy + - created + - modified + type: object + IncidentUserDefinedRoleDataRequest: + description: Data for creating an incident user-defined role. + properties: + attributes: + $ref: "#/components/schemas/IncidentUserDefinedRoleDataAttributesRequest" + relationships: + $ref: "#/components/schemas/IncidentUserDefinedRoleRelationshipsRequest" + type: + $ref: "#/components/schemas/IncidentUserDefinedRoleType" + required: + - type + - attributes + - relationships + type: object + IncidentUserDefinedRoleDataResponse: + description: Data for an incident user-defined role response. + properties: + attributes: + $ref: "#/components/schemas/IncidentUserDefinedRoleDataAttributesResponse" + id: + description: The ID of the user-defined role. + example: "00000000-0000-0000-0000-000000000002" + format: uuid + type: string + relationships: + $ref: "#/components/schemas/IncidentUserDefinedRoleRelationshipsResponse" + type: + $ref: "#/components/schemas/IncidentUserDefinedRoleType" + required: + - id + - type + - attributes + type: object + IncidentUserDefinedRoleIncidentTypeRelationship: + description: Relationship to an incident type for a user-defined role. + properties: + data: + $ref: "#/components/schemas/IncidentUserDefinedRoleIncidentTypeRelationshipData" + required: + - data + type: object + IncidentUserDefinedRoleIncidentTypeRelationshipData: + description: Data for the incident type relationship of a user-defined role. + properties: + id: + description: The ID of the incident type. + example: "00000000-0000-0000-0000-000000000001" + format: uuid + type: string + type: + description: The type of the resource. + example: "incident_types" + type: string + required: + - id + - type + type: object + IncidentUserDefinedRoleIncludedItem: + description: A single included resource in a user-defined role response. + oneOf: + - $ref: "#/components/schemas/IncidentUserData" + - $ref: "#/components/schemas/IncidentTypeObject" + IncidentUserDefinedRoleIncludedResponse: + description: Included resources for an incident user-defined role response. + items: + $ref: "#/components/schemas/IncidentUserDefinedRoleIncludedItem" + type: array + IncidentUserDefinedRolePatchDataAttributesRequest: + description: Attributes for updating an incident user-defined role. + properties: + description: + description: A description of the user-defined role. + example: "The technical lead for the incident." + nullable: true + type: string + name: + description: The name of the user-defined role. + example: "Tech Lead" + type: string + policy: + $ref: "#/components/schemas/IncidentUserDefinedRolePolicy" + type: object + IncidentUserDefinedRolePatchDataRequest: + description: Data for updating an incident user-defined role. + properties: + attributes: + $ref: "#/components/schemas/IncidentUserDefinedRolePatchDataAttributesRequest" + id: + description: The ID of the user-defined role to update. + example: "00000000-0000-0000-0000-000000000002" + format: uuid + type: string + type: + $ref: "#/components/schemas/IncidentUserDefinedRoleType" + required: + - id + - type + type: object + IncidentUserDefinedRolePatchRequest: + description: Request for updating an incident user-defined role. + properties: + data: + $ref: "#/components/schemas/IncidentUserDefinedRolePatchDataRequest" + required: + - data + type: object + IncidentUserDefinedRolePolicy: + description: Policy configuration for a user-defined role. + properties: + is_single: + description: Whether this role can only be assigned to one responder at a time. + example: true + type: boolean + required: + - is_single + type: object + IncidentUserDefinedRoleRelationshipsRequest: + description: Relationships for creating a user-defined role. + properties: + incident_type: + $ref: "#/components/schemas/IncidentUserDefinedRoleIncidentTypeRelationship" + required: + - incident_type + type: object + IncidentUserDefinedRoleRelationshipsResponse: + description: Relationships of a user-defined role response. + properties: + created_by_user: + $ref: "#/components/schemas/RelationshipToUser" + incident_type: + $ref: "#/components/schemas/IncidentUserDefinedRoleIncidentTypeRelationship" + last_modified_by_user: + $ref: "#/components/schemas/RelationshipToUser" + type: object + IncidentUserDefinedRoleRequest: + description: Request for creating an incident user-defined role. + properties: + data: + $ref: "#/components/schemas/IncidentUserDefinedRoleDataRequest" + required: + - data + type: object + IncidentUserDefinedRoleResponse: + description: Response with a single incident user-defined role. + properties: + data: + $ref: "#/components/schemas/IncidentUserDefinedRoleDataResponse" + included: + $ref: "#/components/schemas/IncidentUserDefinedRoleIncludedResponse" + required: + - data + type: object + IncidentUserDefinedRoleType: + description: Incident user-defined role resource type. + enum: + - incident_user_defined_roles + example: incident_user_defined_roles + type: string + x-enum-varnames: + - INCIDENT_USER_DEFINED_ROLES + IncidentUserDefinedRolesDataResponse: + description: List of incident user-defined role data objects. + items: + $ref: "#/components/schemas/IncidentUserDefinedRoleDataResponse" + type: array + IncidentUserDefinedRolesResponse: + description: Response with a list of incident user-defined roles. + properties: + data: + $ref: "#/components/schemas/IncidentUserDefinedRolesDataResponse" + included: + $ref: "#/components/schemas/IncidentUserDefinedRoleIncludedResponse" + required: + - data + type: object IncidentsResponse: description: Response with a list of incidents. properties: @@ -140592,6 +140824,303 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/config/user-defined-roles: + get: + description: List all user-defined roles for incidents. + operationId: ListIncidentUserDefinedRoles + parameters: + - description: Filter roles by incident type UUID. + in: query + name: filter[incident-type] + required: false + schema: + example: "00000000-0000-0000-0000-000000000001" + format: uuid + type: string + - description: Comma-separated list of related resources to include in the response. + in: query + name: include + required: false + schema: + example: "created_by_user,last_modified_by_user,incident_type" + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + created: "2024-01-01T00:00:00.000Z" + description: "The technical lead for the incident." + modified: "2024-01-01T00:00:00.000Z" + name: "Tech Lead" + policy: + is_single: true + id: "00000000-0000-0000-0000-000000000002" + type: incident_user_defined_roles + schema: + $ref: "#/components/schemas/IncidentUserDefinedRolesResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_read + summary: List incident user-defined roles + tags: + - Incidents + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: Create a new user-defined role for incidents. + operationId: CreateIncidentUserDefinedRole + parameters: + - description: Comma-separated list of related resources to include in the response. + in: query + name: include + required: false + schema: + example: "created_by_user,last_modified_by_user,incident_type" + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + description: "The technical lead for the incident." + name: "Tech Lead" + policy: + is_single: true + relationships: + incident_type: + data: + id: "00000000-0000-0000-0000-000000000001" + type: incident_types + type: incident_user_defined_roles + schema: + $ref: "#/components/schemas/IncidentUserDefinedRoleRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created: "2024-01-01T00:00:00.000Z" + description: "The technical lead for the incident." + modified: "2024-01-01T00:00:00.000Z" + name: "Tech Lead" + policy: + is_single: true + id: "00000000-0000-0000-0000-000000000002" + type: incident_user_defined_roles + schema: + $ref: "#/components/schemas/IncidentUserDefinedRoleResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Create an incident user-defined role + tags: + - Incidents + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/incidents/config/user-defined-roles/{role_id}: + delete: + description: Delete an existing user-defined role for incidents. + operationId: DeleteIncidentUserDefinedRole + parameters: + - $ref: "#/components/parameters/IncidentUserDefinedRoleIDPathParameter" + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Delete an incident user-defined role + tags: + - Incidents + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + get: + description: Retrieve a single user-defined role for incidents. + operationId: GetIncidentUserDefinedRole + parameters: + - $ref: "#/components/parameters/IncidentUserDefinedRoleIDPathParameter" + - description: Comma-separated list of related resources to include in the response. + in: query + name: include + required: false + schema: + example: "created_by_user,last_modified_by_user,incident_type" + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created: "2024-01-01T00:00:00.000Z" + description: "The technical lead for the incident." + modified: "2024-01-01T00:00:00.000Z" + name: "Tech Lead" + policy: + is_single: true + id: "00000000-0000-0000-0000-000000000002" + type: incident_user_defined_roles + schema: + $ref: "#/components/schemas/IncidentUserDefinedRoleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_read + summary: Get an incident user-defined role + tags: + - Incidents + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + patch: + description: Update an existing user-defined role for incidents. + operationId: UpdateIncidentUserDefinedRole + parameters: + - $ref: "#/components/parameters/IncidentUserDefinedRoleIDPathParameter" + - description: Comma-separated list of related resources to include in the response. + in: query + name: include + required: false + schema: + example: "created_by_user,last_modified_by_user,incident_type" + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + name: "Updated Tech Lead" + id: "00000000-0000-0000-0000-000000000002" + type: incident_user_defined_roles + schema: + $ref: "#/components/schemas/IncidentUserDefinedRolePatchRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created: "2024-01-01T00:00:00.000Z" + modified: "2024-01-02T00:00:00.000Z" + name: "Updated Tech Lead" + policy: + is_single: true + id: "00000000-0000-0000-0000-000000000002" + type: incident_user_defined_roles + schema: + $ref: "#/components/schemas/IncidentUserDefinedRoleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_settings_write + summary: Update an incident user-defined role + tags: + - Incidents + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/incidents/import: post: description: |- diff --git a/examples/v2/incidents/CreateIncidentUserDefinedRole.rb b/examples/v2/incidents/CreateIncidentUserDefinedRole.rb new file mode 100644 index 000000000000..3d0ee20868f0 --- /dev/null +++ b/examples/v2/incidents/CreateIncidentUserDefinedRole.rb @@ -0,0 +1,29 @@ +# Create an incident user-defined role returns "Created" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_incident_user_defined_role".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +body = DatadogAPIClient::V2::IncidentUserDefinedRoleRequest.new({ + data: DatadogAPIClient::V2::IncidentUserDefinedRoleDataRequest.new({ + attributes: DatadogAPIClient::V2::IncidentUserDefinedRoleDataAttributesRequest.new({ + description: "The technical lead for the incident.", + name: "Tech Lead", + policy: DatadogAPIClient::V2::IncidentUserDefinedRolePolicy.new({ + is_single: true, + }), + }), + relationships: DatadogAPIClient::V2::IncidentUserDefinedRoleRelationshipsRequest.new({ + incident_type: DatadogAPIClient::V2::IncidentUserDefinedRoleIncidentTypeRelationship.new({ + data: DatadogAPIClient::V2::IncidentUserDefinedRoleIncidentTypeRelationshipData.new({ + id: "00000000-0000-0000-0000-000000000001", + type: "incident_types", + }), + }), + }), + type: DatadogAPIClient::V2::IncidentUserDefinedRoleType::INCIDENT_USER_DEFINED_ROLES, + }), +}) +p api_instance.create_incident_user_defined_role(body) diff --git a/examples/v2/incidents/DeleteIncidentUserDefinedRole.rb b/examples/v2/incidents/DeleteIncidentUserDefinedRole.rb new file mode 100644 index 000000000000..65c01a600c2a --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentUserDefinedRole.rb @@ -0,0 +1,8 @@ +# Delete an incident user-defined role returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_incident_user_defined_role".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new +api_instance.delete_incident_user_defined_role("00000000-0000-0000-0000-000000000002") diff --git a/examples/v2/incidents/GetIncidentUserDefinedRole.rb b/examples/v2/incidents/GetIncidentUserDefinedRole.rb new file mode 100644 index 000000000000..6791e2cf9d65 --- /dev/null +++ b/examples/v2/incidents/GetIncidentUserDefinedRole.rb @@ -0,0 +1,8 @@ +# Get an incident user-defined role returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_incident_user_defined_role".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new +p api_instance.get_incident_user_defined_role("00000000-0000-0000-0000-000000000002") diff --git a/examples/v2/incidents/ListIncidentUserDefinedRoles.rb b/examples/v2/incidents/ListIncidentUserDefinedRoles.rb new file mode 100644 index 000000000000..48c8b57b4c6a --- /dev/null +++ b/examples/v2/incidents/ListIncidentUserDefinedRoles.rb @@ -0,0 +1,8 @@ +# List incident user-defined roles returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_incident_user_defined_roles".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new +p api_instance.list_incident_user_defined_roles() diff --git a/examples/v2/incidents/UpdateIncidentUserDefinedRole.rb b/examples/v2/incidents/UpdateIncidentUserDefinedRole.rb new file mode 100644 index 000000000000..663e2d62bd3a --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentUserDefinedRole.rb @@ -0,0 +1,22 @@ +# Update an incident user-defined role returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_incident_user_defined_role".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +body = DatadogAPIClient::V2::IncidentUserDefinedRolePatchRequest.new({ + data: DatadogAPIClient::V2::IncidentUserDefinedRolePatchDataRequest.new({ + attributes: DatadogAPIClient::V2::IncidentUserDefinedRolePatchDataAttributesRequest.new({ + description: "The technical lead for the incident.", + name: "Tech Lead", + policy: DatadogAPIClient::V2::IncidentUserDefinedRolePolicy.new({ + is_single: true, + }), + }), + id: "00000000-0000-0000-0000-000000000002", + type: DatadogAPIClient::V2::IncidentUserDefinedRoleType::INCIDENT_USER_DEFINED_ROLES, + }), +}) +p api_instance.update_incident_user_defined_role("00000000-0000-0000-0000-000000000002", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 83ba3376efad..eedca8f7d2ce 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3553,6 +3553,26 @@ "include" => "String", "body" => "IncidentUserDefinedFieldUpdateRequest", }, + "v2.ListIncidentUserDefinedRoles" => { + "filter_incident_type" => "UUID", + "include" => "String", + }, + "v2.CreateIncidentUserDefinedRole" => { + "include" => "String", + "body" => "IncidentUserDefinedRoleRequest", + }, + "v2.DeleteIncidentUserDefinedRole" => { + "role_id" => "UUID", + }, + "v2.GetIncidentUserDefinedRole" => { + "role_id" => "UUID", + "include" => "String", + }, + "v2.UpdateIncidentUserDefinedRole" => { + "role_id" => "UUID", + "include" => "String", + "body" => "IncidentUserDefinedRolePatchRequest", + }, "v2.ImportIncident" => { "include" => "Array", "body" => "IncidentImportRequest", diff --git a/features/v2/incidents.feature b/features/v2/incidents.feature index 62c70d5c5608..1b993a1ff299 100644 --- a/features/v2/incidents.feature +++ b/features/v2/incidents.feature @@ -210,6 +210,22 @@ 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 role returns "Bad Request" response + Given operation "CreateIncidentUserDefinedRole" enabled + And new "CreateIncidentUserDefinedRole" request + And body with value {"data": {"attributes": {"description": "The technical lead for the incident.", "name": "Tech Lead", "policy": {"is_single": true}}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000001", "type": "incident_types"}}}, "type": "incident_user_defined_roles"}} + 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 role returns "Created" response + Given operation "CreateIncidentUserDefinedRole" enabled + And new "CreateIncidentUserDefinedRole" request + And body with value {"data": {"attributes": {"description": "The technical lead for the incident.", "name": "Tech Lead", "policy": {"is_single": true}}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000001", "type": "incident_types"}}}, "type": "incident_user_defined_roles"}} + When the request is sent + Then the response status is 201 Created + @generated @skip @team:DataDog/incident-app Scenario: Create global incident handle returns "Bad Request" response Given operation "CreateGlobalIncidentHandle" enabled @@ -530,6 +546,30 @@ Feature: Incidents When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app + Scenario: Delete an incident user-defined role returns "Bad Request" response + Given operation "DeleteIncidentUserDefinedRole" enabled + And new "DeleteIncidentUserDefinedRole" request + And request contains "role_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 role returns "No Content" response + Given operation "DeleteIncidentUserDefinedRole" enabled + And new "DeleteIncidentUserDefinedRole" request + And request contains "role_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 role returns "Not Found" response + Given operation "DeleteIncidentUserDefinedRole" enabled + And new "DeleteIncidentUserDefinedRole" request + And request contains "role_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 @@ -781,6 +821,30 @@ 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 role returns "Bad Request" response + Given operation "GetIncidentUserDefinedRole" enabled + And new "GetIncidentUserDefinedRole" request + And request contains "role_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: Get an incident user-defined role returns "Not Found" response + Given operation "GetIncidentUserDefinedRole" enabled + And new "GetIncidentUserDefinedRole" request + And request contains "role_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 role returns "OK" response + Given operation "GetIncidentUserDefinedRole" enabled + And new "GetIncidentUserDefinedRole" request + And request contains "role_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 @@ -1108,6 +1172,20 @@ Feature: Incidents Then the response status is 200 OK And the response "data" has length 0 + @generated @skip @team:DataDog/incident-app + Scenario: List incident user-defined roles returns "Bad Request" response + Given operation "ListIncidentUserDefinedRoles" enabled + And new "ListIncidentUserDefinedRoles" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: List incident user-defined roles returns "OK" response + Given operation "ListIncidentUserDefinedRoles" enabled + And new "ListIncidentUserDefinedRoles" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app Scenario: List postmortem templates returns "Bad Request" response Given operation "ListIncidentPostmortemTemplates" enabled @@ -1348,6 +1426,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 role returns "Bad Request" response + Given operation "UpdateIncidentUserDefinedRole" enabled + And new "UpdateIncidentUserDefinedRole" request + And request contains "role_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "The technical lead for the incident.", "name": "Tech Lead", "policy": {"is_single": true}}, "id": "00000000-0000-0000-0000-000000000002", "type": "incident_user_defined_roles"}} + 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 role returns "Not Found" response + Given operation "UpdateIncidentUserDefinedRole" enabled + And new "UpdateIncidentUserDefinedRole" request + And request contains "role_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "The technical lead for the incident.", "name": "Tech Lead", "policy": {"is_single": true}}, "id": "00000000-0000-0000-0000-000000000002", "type": "incident_user_defined_roles"}} + 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 role returns "OK" response + Given operation "UpdateIncidentUserDefinedRole" enabled + And new "UpdateIncidentUserDefinedRole" request + And request contains "role_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "The technical lead for the incident.", "name": "Tech Lead", "policy": {"is_single": true}}, "id": "00000000-0000-0000-0000-000000000002", "type": "incident_user_defined_roles"}} + 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 cbfa3f20784e..034389914115 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -3115,6 +3115,43 @@ "type": "idempotent" } }, + "ListIncidentUserDefinedRoles": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "CreateIncidentUserDefinedRole": { + "tag": "Incidents", + "undo": { + "operationId": "DeleteIncidentUserDefinedRole", + "parameters": [ + { + "name": "role_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteIncidentUserDefinedRole": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, + "GetIncidentUserDefinedRole": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "UpdateIncidentUserDefinedRole": { + "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 af5982f11e59..46c87214cd62 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -513,6 +513,7 @@ def initialize "v2.create_incident_todo": false, "v2.create_incident_type": false, "v2.create_incident_user_defined_field": false, + "v2.create_incident_user_defined_role": false, "v2.delete_global_incident_handle": false, "v2.delete_incident": false, "v2.delete_incident_attachment": false, @@ -523,6 +524,7 @@ def initialize "v2.delete_incident_todo": false, "v2.delete_incident_type": false, "v2.delete_incident_user_defined_field": false, + "v2.delete_incident_user_defined_role": false, "v2.get_global_incident_settings": false, "v2.get_incident": false, "v2.get_incident_integration": false, @@ -532,6 +534,7 @@ def initialize "v2.get_incident_todo": false, "v2.get_incident_type": false, "v2.get_incident_user_defined_field": false, + "v2.get_incident_user_defined_role": false, "v2.import_incident": false, "v2.list_global_incident_handles": false, "v2.list_incident_attachments": false, @@ -543,6 +546,7 @@ def initialize "v2.list_incident_todos": false, "v2.list_incident_types": false, "v2.list_incident_user_defined_fields": false, + "v2.list_incident_user_defined_roles": false, "v2.search_incidents": false, "v2.update_global_incident_handle": false, "v2.update_global_incident_settings": false, @@ -555,6 +559,7 @@ def initialize "v2.update_incident_todo": false, "v2.update_incident_type": false, "v2.update_incident_user_defined_field": false, + "v2.update_incident_user_defined_role": 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 ba94a9e2ceb5..4b7661a0e79b 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3901,6 +3901,23 @@ def overrides "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.incident_user_defined_role_data_attributes_request" => "IncidentUserDefinedRoleDataAttributesRequest", + "v2.incident_user_defined_role_data_attributes_response" => "IncidentUserDefinedRoleDataAttributesResponse", + "v2.incident_user_defined_role_data_request" => "IncidentUserDefinedRoleDataRequest", + "v2.incident_user_defined_role_data_response" => "IncidentUserDefinedRoleDataResponse", + "v2.incident_user_defined_role_incident_type_relationship" => "IncidentUserDefinedRoleIncidentTypeRelationship", + "v2.incident_user_defined_role_incident_type_relationship_data" => "IncidentUserDefinedRoleIncidentTypeRelationshipData", + "v2.incident_user_defined_role_included_item" => "IncidentUserDefinedRoleIncludedItem", + "v2.incident_user_defined_role_patch_data_attributes_request" => "IncidentUserDefinedRolePatchDataAttributesRequest", + "v2.incident_user_defined_role_patch_data_request" => "IncidentUserDefinedRolePatchDataRequest", + "v2.incident_user_defined_role_patch_request" => "IncidentUserDefinedRolePatchRequest", + "v2.incident_user_defined_role_policy" => "IncidentUserDefinedRolePolicy", + "v2.incident_user_defined_role_relationships_request" => "IncidentUserDefinedRoleRelationshipsRequest", + "v2.incident_user_defined_role_relationships_response" => "IncidentUserDefinedRoleRelationshipsResponse", + "v2.incident_user_defined_role_request" => "IncidentUserDefinedRoleRequest", + "v2.incident_user_defined_role_response" => "IncidentUserDefinedRoleResponse", + "v2.incident_user_defined_roles_response" => "IncidentUserDefinedRolesResponse", + "v2.incident_user_defined_role_type" => "IncidentUserDefinedRoleType", "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 e5ea4e02b73e..3b7917ed154a 100644 --- a/lib/datadog_api_client/v2/api/incidents_api.rb +++ b/lib/datadog_api_client/v2/api/incidents_api.rb @@ -930,6 +930,81 @@ def create_incident_user_defined_field_with_http_info(body, opts = {}) return data, status_code, headers end + # Create an incident user-defined role. + # + # @see #create_incident_user_defined_role_with_http_info + def create_incident_user_defined_role(body, opts = {}) + data, _status_code, _headers = create_incident_user_defined_role_with_http_info(body, opts) + data + end + + # Create an incident user-defined role. + # + # Create a new user-defined role for incidents. + # + # @param body [IncidentUserDefinedRoleRequest] + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of related resources to include in the response. + # @return [Array<(IncidentUserDefinedRoleResponse, Integer, Hash)>] IncidentUserDefinedRoleResponse data, response status code and response headers + def create_incident_user_defined_role_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_incident_user_defined_role".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_incident_user_defined_role") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_incident_user_defined_role")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.create_incident_user_defined_role ...' + 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_role" + end + # resource path + local_var_path = '/api/v2/incidents/config/user-defined-roles' + + # 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] || 'IncidentUserDefinedRoleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_incident_user_defined_role, + :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_role\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 @@ -1721,6 +1796,77 @@ def delete_incident_user_defined_field_with_http_info(field_id, opts = {}) return data, status_code, headers end + # Delete an incident user-defined role. + # + # @see #delete_incident_user_defined_role_with_http_info + def delete_incident_user_defined_role(role_id, opts = {}) + delete_incident_user_defined_role_with_http_info(role_id, opts) + nil + end + + # Delete an incident user-defined role. + # + # Delete an existing user-defined role for incidents. + # + # @param role_id [UUID] The UUID of the incident user-defined role. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_incident_user_defined_role_with_http_info(role_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_incident_user_defined_role".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_incident_user_defined_role") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_incident_user_defined_role")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.delete_incident_user_defined_role ...' + end + # verify the required parameter 'role_id' is set + if @api_client.config.client_side_validation && role_id.nil? + fail ArgumentError, "Missing the required parameter 'role_id' when calling IncidentsAPI.delete_incident_user_defined_role" + end + # resource path + local_var_path = '/api/v2/incidents/config/user-defined-roles/{role_id}'.sub('{role_id}', CGI.escape(role_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_role, + :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_role\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 @@ -2373,6 +2519,79 @@ def get_incident_user_defined_field_with_http_info(field_id, opts = {}) return data, status_code, headers end + # Get an incident user-defined role. + # + # @see #get_incident_user_defined_role_with_http_info + def get_incident_user_defined_role(role_id, opts = {}) + data, _status_code, _headers = get_incident_user_defined_role_with_http_info(role_id, opts) + data + end + + # Get an incident user-defined role. + # + # Retrieve a single user-defined role for incidents. + # + # @param role_id [UUID] The UUID of the incident user-defined role. + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of related resources to include in the response. + # @return [Array<(IncidentUserDefinedRoleResponse, Integer, Hash)>] IncidentUserDefinedRoleResponse data, response status code and response headers + def get_incident_user_defined_role_with_http_info(role_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_incident_user_defined_role".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_incident_user_defined_role") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_incident_user_defined_role")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.get_incident_user_defined_role ...' + end + # verify the required parameter 'role_id' is set + if @api_client.config.client_side_validation && role_id.nil? + fail ArgumentError, "Missing the required parameter 'role_id' when calling IncidentsAPI.get_incident_user_defined_role" + end + # resource path + local_var_path = '/api/v2/incidents/config/user-defined-roles/{role_id}'.sub('{role_id}', CGI.escape(role_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] || 'IncidentUserDefinedRoleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_incident_user_defined_role, + :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_role\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 @@ -3252,6 +3471,76 @@ def list_incident_user_defined_fields_with_http_info(opts = {}) return data, status_code, headers end + # List incident user-defined roles. + # + # @see #list_incident_user_defined_roles_with_http_info + def list_incident_user_defined_roles(opts = {}) + data, _status_code, _headers = list_incident_user_defined_roles_with_http_info(opts) + data + end + + # List incident user-defined roles. + # + # List all user-defined roles for incidents. + # + # @param opts [Hash] the optional parameters + # @option opts [UUID] :filter_incident_type Filter roles by incident type UUID. + # @option opts [String] :include Comma-separated list of related resources to include in the response. + # @return [Array<(IncidentUserDefinedRolesResponse, Integer, Hash)>] IncidentUserDefinedRolesResponse data, response status code and response headers + def list_incident_user_defined_roles_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_incident_user_defined_roles".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_incident_user_defined_roles") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_incident_user_defined_roles")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.list_incident_user_defined_roles ...' + end + # resource path + local_var_path = '/api/v2/incidents/config/user-defined-roles' + + # query parameters + query_params = opts[:query_params] || {} + 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] || 'IncidentUserDefinedRolesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_incident_user_defined_roles, + :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_roles\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 @@ -4232,5 +4521,85 @@ def update_incident_user_defined_field_with_http_info(field_id, body, opts = {}) end return data, status_code, headers end + + # Update an incident user-defined role. + # + # @see #update_incident_user_defined_role_with_http_info + def update_incident_user_defined_role(role_id, body, opts = {}) + data, _status_code, _headers = update_incident_user_defined_role_with_http_info(role_id, body, opts) + data + end + + # Update an incident user-defined role. + # + # Update an existing user-defined role for incidents. + # + # @param role_id [UUID] The UUID of the incident user-defined role. + # @param body [IncidentUserDefinedRolePatchRequest] + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of related resources to include in the response. + # @return [Array<(IncidentUserDefinedRoleResponse, Integer, Hash)>] IncidentUserDefinedRoleResponse data, response status code and response headers + def update_incident_user_defined_role_with_http_info(role_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_incident_user_defined_role".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_incident_user_defined_role") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_incident_user_defined_role")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.update_incident_user_defined_role ...' + end + # verify the required parameter 'role_id' is set + if @api_client.config.client_side_validation && role_id.nil? + fail ArgumentError, "Missing the required parameter 'role_id' when calling IncidentsAPI.update_incident_user_defined_role" + 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_role" + end + # resource path + local_var_path = '/api/v2/incidents/config/user-defined-roles/{role_id}'.sub('{role_id}', CGI.escape(role_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] || 'IncidentUserDefinedRoleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_incident_user_defined_role, + :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_role\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_role_data_attributes_request.rb b/lib/datadog_api_client/v2/models/incident_user_defined_role_data_attributes_request.rb new file mode 100644 index 000000000000..73c5524a0d60 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_role_data_attributes_request.rb @@ -0,0 +1,162 @@ +=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 role. + class IncidentUserDefinedRoleDataAttributesRequest + include BaseGenericModel + + # A description of the user-defined role. + attr_accessor :description + + # The name of the user-defined role. + attr_reader :name + + # Policy configuration for a user-defined role. + attr_reader :policy + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'name' => :'name', + :'policy' => :'policy' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'name' => :'String', + :'policy' => :'IncidentUserDefinedRolePolicy' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'description', + ]) + 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::IncidentUserDefinedRoleDataAttributesRequest` 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?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'policy') + self.policy = attributes[:'policy'] + 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 @policy.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 policy [Object] Object to be assigned + # @!visibility private + def policy=(policy) + if policy.nil? + fail ArgumentError, 'invalid value for "policy", policy cannot be nil.' + end + @policy = policy + 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 && + name == o.name && + policy == o.policy && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, name, policy, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_role_data_attributes_response.rb b/lib/datadog_api_client/v2/models/incident_user_defined_role_data_attributes_response.rb new file mode 100644 index 000000000000..7b802db091e9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_role_data_attributes_response.rb @@ -0,0 +1,204 @@ +=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 role. + class IncidentUserDefinedRoleDataAttributesResponse + include BaseGenericModel + + # Timestamp when the role was created. + attr_reader :created + + # A description of the user-defined role. + attr_accessor :description + + # Timestamp when the role was last modified. + attr_reader :modified + + # The name of the user-defined role. + attr_reader :name + + # Policy configuration for a user-defined role. + attr_reader :policy + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created' => :'created', + :'description' => :'description', + :'modified' => :'modified', + :'name' => :'name', + :'policy' => :'policy' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created' => :'Time', + :'description' => :'String', + :'modified' => :'Time', + :'name' => :'String', + :'policy' => :'IncidentUserDefinedRolePolicy' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'description', + ]) + 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::IncidentUserDefinedRoleDataAttributesResponse` 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') + self.created = attributes[:'created'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'modified') + self.modified = attributes[:'modified'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'policy') + self.policy = attributes[:'policy'] + 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.nil? + return false if @modified.nil? + return false if @name.nil? + return false if @policy.nil? + true + 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 modified [Object] Object to be assigned + # @!visibility private + def modified=(modified) + if modified.nil? + fail ArgumentError, 'invalid value for "modified", modified cannot be nil.' + end + @modified = modified + 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 policy [Object] Object to be assigned + # @!visibility private + def policy=(policy) + if policy.nil? + fail ArgumentError, 'invalid value for "policy", policy cannot be nil.' + end + @policy = policy + 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 == o.created && + description == o.description && + modified == o.modified && + name == o.name && + policy == o.policy && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created, description, modified, name, policy, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_role_data_request.rb b/lib/datadog_api_client/v2/models/incident_user_defined_role_data_request.rb new file mode 100644 index 000000000000..89db7779eff3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_role_data_request.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 role. + class IncidentUserDefinedRoleDataRequest + include BaseGenericModel + + # Attributes for creating an incident user-defined role. + attr_reader :attributes + + # Relationships for creating a user-defined role. + attr_reader :relationships + + # Incident user-defined role resource 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' => :'IncidentUserDefinedRoleDataAttributesRequest', + :'relationships' => :'IncidentUserDefinedRoleRelationshipsRequest', + :'type' => :'IncidentUserDefinedRoleType' + } + 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::IncidentUserDefinedRoleDataRequest` 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_role_data_response.rb b/lib/datadog_api_client/v2/models/incident_user_defined_role_data_response.rb new file mode 100644 index 000000000000..9025e3e51805 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_role_data_response.rb @@ -0,0 +1,175 @@ +=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 an incident user-defined role response. + class IncidentUserDefinedRoleDataResponse + include BaseGenericModel + + # Attributes of an incident user-defined role. + attr_reader :attributes + + # The ID of the user-defined role. + attr_reader :id + + # Relationships of a user-defined role response. + attr_accessor :relationships + + # Incident user-defined role resource 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' => :'IncidentUserDefinedRoleDataAttributesResponse', + :'id' => :'UUID', + :'relationships' => :'IncidentUserDefinedRoleRelationshipsResponse', + :'type' => :'IncidentUserDefinedRoleType' + } + 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::IncidentUserDefinedRoleDataResponse` 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 @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 && + 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_role_incident_type_relationship.rb b/lib/datadog_api_client/v2/models/incident_user_defined_role_incident_type_relationship.rb new file mode 100644 index 000000000000..1b108115df34 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_role_incident_type_relationship.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 + # Relationship to an incident type for a user-defined role. + class IncidentUserDefinedRoleIncidentTypeRelationship + include BaseGenericModel + + # Data for the incident type relationship of a user-defined role. + 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' => :'IncidentUserDefinedRoleIncidentTypeRelationshipData' + } + 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::IncidentUserDefinedRoleIncidentTypeRelationship` 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_role_incident_type_relationship_data.rb b/lib/datadog_api_client/v2/models/incident_user_defined_role_incident_type_relationship_data.rb new file mode 100644 index 000000000000..ab11baa2abc0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_role_incident_type_relationship_data.rb @@ -0,0 +1,144 @@ +=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 the incident type relationship of a user-defined role. + class IncidentUserDefinedRoleIncidentTypeRelationshipData + include BaseGenericModel + + # The ID of the incident type. + attr_reader :id + + # The type of the resource. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'UUID', + :'type' => :'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::IncidentUserDefinedRoleIncidentTypeRelationshipData` 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?(:'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 @id.nil? + return false if @type.nil? + true + 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 && + 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 + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_role_included_item.rb b/lib/datadog_api_client/v2/models/incident_user_defined_role_included_item.rb new file mode 100644 index 000000000000..95a1b56df95d --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_role_included_item.rb @@ -0,0 +1,63 @@ +=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 single included resource in a user-defined role response. + module IncidentUserDefinedRoleIncludedItem + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'IncidentUserData', + :'IncidentTypeObject' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_role_patch_data_attributes_request.rb b/lib/datadog_api_client/v2/models/incident_user_defined_role_patch_data_attributes_request.rb new file mode 100644 index 000000000000..022d1b68c8c4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_role_patch_data_attributes_request.rb @@ -0,0 +1,133 @@ +=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 role. + class IncidentUserDefinedRolePatchDataAttributesRequest + include BaseGenericModel + + # A description of the user-defined role. + attr_accessor :description + + # The name of the user-defined role. + attr_accessor :name + + # Policy configuration for a user-defined role. + attr_accessor :policy + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'name' => :'name', + :'policy' => :'policy' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'name' => :'String', + :'policy' => :'IncidentUserDefinedRolePolicy' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'description', + ]) + 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::IncidentUserDefinedRolePatchDataAttributesRequest` 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?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'policy') + self.policy = attributes[:'policy'] + 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 && + description == o.description && + name == o.name && + policy == o.policy && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, name, policy, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_role_patch_data_request.rb b/lib/datadog_api_client/v2/models/incident_user_defined_role_patch_data_request.rb new file mode 100644 index 000000000000..f3841e4c3822 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_role_patch_data_request.rb @@ -0,0 +1,154 @@ +=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 role. + class IncidentUserDefinedRolePatchDataRequest + include BaseGenericModel + + # Attributes for updating an incident user-defined role. + attr_accessor :attributes + + # The ID of the user-defined role to update. + attr_reader :id + + # Incident user-defined role resource 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' => :'IncidentUserDefinedRolePatchDataAttributesRequest', + :'id' => :'UUID', + :'type' => :'IncidentUserDefinedRoleType' + } + 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::IncidentUserDefinedRolePatchDataRequest` 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 @id.nil? + return false if @type.nil? + true + 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_role_patch_request.rb b/lib/datadog_api_client/v2/models/incident_user_defined_role_patch_request.rb new file mode 100644 index 000000000000..35a7aaa26c55 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_role_patch_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 for updating an incident user-defined role. + class IncidentUserDefinedRolePatchRequest + include BaseGenericModel + + # Data for updating an incident user-defined role. + 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' => :'IncidentUserDefinedRolePatchDataRequest' + } + 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::IncidentUserDefinedRolePatchRequest` 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_role_policy.rb b/lib/datadog_api_client/v2/models/incident_user_defined_role_policy.rb new file mode 100644 index 000000000000..47155b7051fd --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_role_policy.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 + # Policy configuration for a user-defined role. + class IncidentUserDefinedRolePolicy + include BaseGenericModel + + # Whether this role can only be assigned to one responder at a time. + attr_reader :is_single + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'is_single' => :'is_single' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'is_single' => :'Boolean' + } + 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::IncidentUserDefinedRolePolicy` 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?(:'is_single') + self.is_single = attributes[:'is_single'] + 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 @is_single.nil? + true + end + + # Custom attribute writer method with validation + # @param is_single [Object] Object to be assigned + # @!visibility private + def is_single=(is_single) + if is_single.nil? + fail ArgumentError, 'invalid value for "is_single", is_single cannot be nil.' + end + @is_single = is_single + 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 && + is_single == o.is_single && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [is_single, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_role_relationships_request.rb b/lib/datadog_api_client/v2/models/incident_user_defined_role_relationships_request.rb new file mode 100644 index 000000000000..833bb61e7c91 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_role_relationships_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 + # Relationships for creating a user-defined role. + class IncidentUserDefinedRoleRelationshipsRequest + include BaseGenericModel + + # Relationship to an incident type for a user-defined role. + 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' => :'IncidentUserDefinedRoleIncidentTypeRelationship' + } + 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::IncidentUserDefinedRoleRelationshipsRequest` 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_role_relationships_response.rb b/lib/datadog_api_client/v2/models/incident_user_defined_role_relationships_response.rb new file mode 100644 index 000000000000..17476c716311 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_role_relationships_response.rb @@ -0,0 +1,125 @@ +=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 a user-defined role response. + class IncidentUserDefinedRoleRelationshipsResponse + include BaseGenericModel + + # Relationship to user. + attr_accessor :created_by_user + + # Relationship to an incident type for a user-defined role. + attr_accessor :incident_type + + # Relationship to user. + attr_accessor :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' => :'IncidentUserDefinedRoleIncidentTypeRelationship', + :'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::IncidentUserDefinedRoleRelationshipsResponse` 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 + + # 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_role_request.rb b/lib/datadog_api_client/v2/models/incident_user_defined_role_request.rb new file mode 100644 index 000000000000..34366c834121 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_role_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 for creating an incident user-defined role. + class IncidentUserDefinedRoleRequest + include BaseGenericModel + + # Data for creating an incident user-defined role. + 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' => :'IncidentUserDefinedRoleDataRequest' + } + 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::IncidentUserDefinedRoleRequest` 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_role_response.rb b/lib/datadog_api_client/v2/models/incident_user_defined_role_response.rb new file mode 100644 index 000000000000..a9e867dccd71 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_role_response.rb @@ -0,0 +1,135 @@ +=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 with a single incident user-defined role. + class IncidentUserDefinedRoleResponse + include BaseGenericModel + + # Data for an incident user-defined role response. + attr_reader :data + + # Included resources for an incident user-defined role response. + attr_accessor :included + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'IncidentUserDefinedRoleDataResponse', + :'included' => :'Array' + } + 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::IncidentUserDefinedRoleResponse` 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 + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = 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 @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 && + included == o.included && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_role_type.rb b/lib/datadog_api_client/v2/models/incident_user_defined_role_type.rb new file mode 100644 index 000000000000..ca457f6ab365 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_role_type.rb @@ -0,0 +1,26 @@ +=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 + # Incident user-defined role resource type. + class IncidentUserDefinedRoleType + include BaseEnumModel + + INCIDENT_USER_DEFINED_ROLES = "incident_user_defined_roles".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/incident_user_defined_roles_response.rb b/lib/datadog_api_client/v2/models/incident_user_defined_roles_response.rb new file mode 100644 index 000000000000..23bdcaf5894d --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_user_defined_roles_response.rb @@ -0,0 +1,137 @@ +=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 with a list of incident user-defined roles. + class IncidentUserDefinedRolesResponse + include BaseGenericModel + + # List of incident user-defined role data objects. + attr_reader :data + + # Included resources for an incident user-defined role response. + attr_accessor :included + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'included' => :'Array' + } + 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::IncidentUserDefinedRolesResponse` 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?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = 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 @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 && + included == o.included && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, additional_properties].hash + end + end +end