diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index fa9ffba1574..2d6b6c945a6 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.java b/examples/v2/incidents/CreateIncidentUserDefinedRole.java new file mode 100644 index 00000000000..e1cc4586b5e --- /dev/null +++ b/examples/v2/incidents/CreateIncidentUserDefinedRole.java @@ -0,0 +1,55 @@ +// Create an incident user-defined role returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import com.datadog.api.client.v2.model.IncidentUserDefinedRoleDataAttributesRequest; +import com.datadog.api.client.v2.model.IncidentUserDefinedRoleDataRequest; +import com.datadog.api.client.v2.model.IncidentUserDefinedRoleIncidentTypeRelationship; +import com.datadog.api.client.v2.model.IncidentUserDefinedRoleIncidentTypeRelationshipData; +import com.datadog.api.client.v2.model.IncidentUserDefinedRolePolicy; +import com.datadog.api.client.v2.model.IncidentUserDefinedRoleRelationshipsRequest; +import com.datadog.api.client.v2.model.IncidentUserDefinedRoleRequest; +import com.datadog.api.client.v2.model.IncidentUserDefinedRoleResponse; +import com.datadog.api.client.v2.model.IncidentUserDefinedRoleType; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createIncidentUserDefinedRole", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + IncidentUserDefinedRoleRequest body = + new IncidentUserDefinedRoleRequest() + .data( + new IncidentUserDefinedRoleDataRequest() + .attributes( + new IncidentUserDefinedRoleDataAttributesRequest() + .description("The technical lead for the incident.") + .name("Tech Lead") + .policy(new IncidentUserDefinedRolePolicy().isSingle(true))) + .relationships( + new IncidentUserDefinedRoleRelationshipsRequest() + .incidentType( + new IncidentUserDefinedRoleIncidentTypeRelationship() + .data( + new IncidentUserDefinedRoleIncidentTypeRelationshipData() + .id( + UUID.fromString( + "00000000-0000-0000-0000-000000000001")) + .type("incident_types")))) + .type(IncidentUserDefinedRoleType.INCIDENT_USER_DEFINED_ROLES)); + + try { + IncidentUserDefinedRoleResponse result = apiInstance.createIncidentUserDefinedRole(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#createIncidentUserDefinedRole"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/DeleteIncidentUserDefinedRole.java b/examples/v2/incidents/DeleteIncidentUserDefinedRole.java new file mode 100644 index 00000000000..19f77de64b7 --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentUserDefinedRole.java @@ -0,0 +1,25 @@ +// Delete an incident user-defined role returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.deleteIncidentUserDefinedRole", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + try { + apiInstance.deleteIncidentUserDefinedRole( + UUID.fromString("00000000-0000-0000-0000-000000000002")); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#deleteIncidentUserDefinedRole"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/GetIncidentUserDefinedRole.java b/examples/v2/incidents/GetIncidentUserDefinedRole.java new file mode 100644 index 00000000000..c85dae9812c --- /dev/null +++ b/examples/v2/incidents/GetIncidentUserDefinedRole.java @@ -0,0 +1,28 @@ +// Get an incident user-defined role returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import com.datadog.api.client.v2.model.IncidentUserDefinedRoleResponse; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getIncidentUserDefinedRole", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + try { + IncidentUserDefinedRoleResponse result = + apiInstance.getIncidentUserDefinedRole( + UUID.fromString("00000000-0000-0000-0000-000000000002")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#getIncidentUserDefinedRole"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/ListIncidentUserDefinedRoles.java b/examples/v2/incidents/ListIncidentUserDefinedRoles.java new file mode 100644 index 00000000000..b4be1315507 --- /dev/null +++ b/examples/v2/incidents/ListIncidentUserDefinedRoles.java @@ -0,0 +1,25 @@ +// List incident user-defined roles returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import com.datadog.api.client.v2.model.IncidentUserDefinedRolesResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listIncidentUserDefinedRoles", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + try { + IncidentUserDefinedRolesResponse result = apiInstance.listIncidentUserDefinedRoles(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#listIncidentUserDefinedRoles"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/UpdateIncidentUserDefinedRole.java b/examples/v2/incidents/UpdateIncidentUserDefinedRole.java new file mode 100644 index 00000000000..a8d38690979 --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentUserDefinedRole.java @@ -0,0 +1,45 @@ +// Update an incident user-defined role returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import com.datadog.api.client.v2.model.IncidentUserDefinedRolePatchDataAttributesRequest; +import com.datadog.api.client.v2.model.IncidentUserDefinedRolePatchDataRequest; +import com.datadog.api.client.v2.model.IncidentUserDefinedRolePatchRequest; +import com.datadog.api.client.v2.model.IncidentUserDefinedRolePolicy; +import com.datadog.api.client.v2.model.IncidentUserDefinedRoleResponse; +import com.datadog.api.client.v2.model.IncidentUserDefinedRoleType; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.updateIncidentUserDefinedRole", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + IncidentUserDefinedRolePatchRequest body = + new IncidentUserDefinedRolePatchRequest() + .data( + new IncidentUserDefinedRolePatchDataRequest() + .attributes( + new IncidentUserDefinedRolePatchDataAttributesRequest() + .description("The technical lead for the incident.") + .name("Tech Lead") + .policy(new IncidentUserDefinedRolePolicy().isSingle(true))) + .id(UUID.fromString("00000000-0000-0000-0000-000000000002")) + .type(IncidentUserDefinedRoleType.INCIDENT_USER_DEFINED_ROLES)); + + try { + IncidentUserDefinedRoleResponse result = + apiInstance.updateIncidentUserDefinedRole( + UUID.fromString("00000000-0000-0000-0000-000000000002"), body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#updateIncidentUserDefinedRole"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 997e1ca4586..1ebba772b52 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -1085,6 +1085,7 @@ public class ApiClient { put("v2.createIncidentTodo", false); put("v2.createIncidentType", false); put("v2.createIncidentUserDefinedField", false); + put("v2.createIncidentUserDefinedRole", false); put("v2.deleteGlobalIncidentHandle", false); put("v2.deleteIncident", false); put("v2.deleteIncidentAttachment", false); @@ -1095,6 +1096,7 @@ public class ApiClient { put("v2.deleteIncidentTodo", false); put("v2.deleteIncidentType", false); put("v2.deleteIncidentUserDefinedField", false); + put("v2.deleteIncidentUserDefinedRole", false); put("v2.getGlobalIncidentSettings", false); put("v2.getIncident", false); put("v2.getIncidentIntegration", false); @@ -1104,6 +1106,7 @@ public class ApiClient { put("v2.getIncidentTodo", false); put("v2.getIncidentType", false); put("v2.getIncidentUserDefinedField", false); + put("v2.getIncidentUserDefinedRole", false); put("v2.importIncident", false); put("v2.listGlobalIncidentHandles", false); put("v2.listIncidentAttachments", false); @@ -1115,6 +1118,7 @@ public class ApiClient { put("v2.listIncidentTodos", false); put("v2.listIncidentTypes", false); put("v2.listIncidentUserDefinedFields", false); + put("v2.listIncidentUserDefinedRoles", false); put("v2.searchIncidents", false); put("v2.updateGlobalIncidentHandle", false); put("v2.updateGlobalIncidentSettings", false); @@ -1127,6 +1131,7 @@ public class ApiClient { put("v2.updateIncidentTodo", false); put("v2.updateIncidentType", false); put("v2.updateIncidentUserDefinedField", false); + put("v2.updateIncidentUserDefinedRole", false); put("v2.createAWSAccountCCMConfig", false); put("v2.deleteAWSAccountCCMConfig", false); put("v2.getAWSAccountCCMConfig", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java b/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java index c44e3983ac1..1abe2b4359d 100644 --- a/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java @@ -50,6 +50,10 @@ import com.datadog.api.client.v2.model.IncidentUserDefinedFieldListResponse; import com.datadog.api.client.v2.model.IncidentUserDefinedFieldResponse; import com.datadog.api.client.v2.model.IncidentUserDefinedFieldUpdateRequest; +import com.datadog.api.client.v2.model.IncidentUserDefinedRolePatchRequest; +import com.datadog.api.client.v2.model.IncidentUserDefinedRoleRequest; +import com.datadog.api.client.v2.model.IncidentUserDefinedRoleResponse; +import com.datadog.api.client.v2.model.IncidentUserDefinedRolesResponse; import com.datadog.api.client.v2.model.IncidentsResponse; import com.datadog.api.client.v2.model.PatchAttachmentRequest; import com.datadog.api.client.v2.model.PatchIncidentNotificationTemplateRequest; @@ -2345,6 +2349,230 @@ public ApiResponse createIncidentUserDefinedFi new GenericType() {}); } + /** Manage optional parameters to createIncidentUserDefinedRole. */ + public static class CreateIncidentUserDefinedRoleOptionalParameters { + private String include; + + /** + * Set include. + * + * @param include Comma-separated list of related resources to include in the response. + * (optional) + * @return CreateIncidentUserDefinedRoleOptionalParameters + */ + public CreateIncidentUserDefinedRoleOptionalParameters include(String include) { + this.include = include; + return this; + } + } + + /** + * Create an incident user-defined role. + * + *

See {@link #createIncidentUserDefinedRoleWithHttpInfo}. + * + * @param body (required) + * @return IncidentUserDefinedRoleResponse + * @throws ApiException if fails to make API call + */ + public IncidentUserDefinedRoleResponse createIncidentUserDefinedRole( + IncidentUserDefinedRoleRequest body) throws ApiException { + return createIncidentUserDefinedRoleWithHttpInfo( + body, new CreateIncidentUserDefinedRoleOptionalParameters()) + .getData(); + } + + /** + * Create an incident user-defined role. + * + *

See {@link #createIncidentUserDefinedRoleWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<IncidentUserDefinedRoleResponse> + */ + public CompletableFuture createIncidentUserDefinedRoleAsync( + IncidentUserDefinedRoleRequest body) { + return createIncidentUserDefinedRoleWithHttpInfoAsync( + body, new CreateIncidentUserDefinedRoleOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create an incident user-defined role. + * + *

See {@link #createIncidentUserDefinedRoleWithHttpInfo}. + * + * @param body (required) + * @param parameters Optional parameters for the request. + * @return IncidentUserDefinedRoleResponse + * @throws ApiException if fails to make API call + */ + public IncidentUserDefinedRoleResponse createIncidentUserDefinedRole( + IncidentUserDefinedRoleRequest body, + CreateIncidentUserDefinedRoleOptionalParameters parameters) + throws ApiException { + return createIncidentUserDefinedRoleWithHttpInfo(body, parameters).getData(); + } + + /** + * Create an incident user-defined role. + * + *

See {@link #createIncidentUserDefinedRoleWithHttpInfoAsync}. + * + * @param body (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<IncidentUserDefinedRoleResponse> + */ + public CompletableFuture createIncidentUserDefinedRoleAsync( + IncidentUserDefinedRoleRequest body, + CreateIncidentUserDefinedRoleOptionalParameters parameters) { + return createIncidentUserDefinedRoleWithHttpInfoAsync(body, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a new user-defined role for incidents. + * + * @param body (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<IncidentUserDefinedRoleResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse createIncidentUserDefinedRoleWithHttpInfo( + IncidentUserDefinedRoleRequest body, + CreateIncidentUserDefinedRoleOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "createIncidentUserDefinedRole"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createIncidentUserDefinedRole"); + } + String include = parameters.include; + // create path and map variables + String localVarPath = "/api/v2/incidents/config/user-defined-roles"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.createIncidentUserDefinedRole", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create an incident user-defined role. + * + *

See {@link #createIncidentUserDefinedRoleWithHttpInfo}. + * + * @param body (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<IncidentUserDefinedRoleResponse>> + */ + public CompletableFuture> + createIncidentUserDefinedRoleWithHttpInfoAsync( + IncidentUserDefinedRoleRequest body, + CreateIncidentUserDefinedRoleOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "createIncidentUserDefinedRole"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling createIncidentUserDefinedRole")); + return result; + } + String include = parameters.include; + // create path and map variables + String localVarPath = "/api/v2/incidents/config/user-defined-roles"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.createIncidentUserDefinedRole", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Delete global incident handle. * @@ -4234,6 +4462,160 @@ public CompletableFuture> deleteIncidentUserDefinedFieldWithHt null); } + /** + * Delete an incident user-defined role. + * + *

See {@link #deleteIncidentUserDefinedRoleWithHttpInfo}. + * + * @param roleId The UUID of the incident user-defined role. (required) + * @throws ApiException if fails to make API call + */ + public void deleteIncidentUserDefinedRole(UUID roleId) throws ApiException { + deleteIncidentUserDefinedRoleWithHttpInfo(roleId); + } + + /** + * Delete an incident user-defined role. + * + *

See {@link #deleteIncidentUserDefinedRoleWithHttpInfoAsync}. + * + * @param roleId The UUID of the incident user-defined role. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteIncidentUserDefinedRoleAsync(UUID roleId) { + return deleteIncidentUserDefinedRoleWithHttpInfoAsync(roleId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete an existing user-defined role for incidents. + * + * @param roleId The UUID of the incident user-defined role. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteIncidentUserDefinedRoleWithHttpInfo(UUID roleId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteIncidentUserDefinedRole"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'roleId' is set + if (roleId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'roleId' when calling deleteIncidentUserDefinedRole"); + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/config/user-defined-roles/{role_id}" + .replaceAll("\\{" + "role_id" + "\\}", apiClient.escapeString(roleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.deleteIncidentUserDefinedRole", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete an incident user-defined role. + * + *

See {@link #deleteIncidentUserDefinedRoleWithHttpInfo}. + * + * @param roleId The UUID of the incident user-defined role. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteIncidentUserDefinedRoleWithHttpInfoAsync( + UUID roleId) { + // Check if unstable operation is enabled + String operationId = "deleteIncidentUserDefinedRole"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'roleId' is set + if (roleId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'roleId' when calling" + + " deleteIncidentUserDefinedRole")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/config/user-defined-roles/{role_id}" + .replaceAll("\\{" + "role_id" + "\\}", apiClient.escapeString(roleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.deleteIncidentUserDefinedRole", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * Get global incident settings. * @@ -5808,17 +6190,239 @@ public CompletableFuture getIncidentUserDefine * Response details * Status Code Description Response Headers * 200 OK - - * 401 Unauthorized - - * 403 Forbidden - + * 401 Unauthorized - + * 403 Forbidden - + * 404 Not Found - + * 429 Too many requests - + * + */ + public ApiResponse getIncidentUserDefinedFieldWithHttpInfo( + String fieldId, GetIncidentUserDefinedFieldOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "getIncidentUserDefinedField"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'fieldId' is set + if (fieldId == null) { + throw new ApiException( + 400, "Missing the required parameter 'fieldId' when calling getIncidentUserDefinedField"); + } + String include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/incidents/config/user-defined-fields/{field_id}" + .replaceAll("\\{" + "field_id" + "\\}", apiClient.escapeString(fieldId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.getIncidentUserDefinedField", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get an incident user-defined field. + * + *

See {@link #getIncidentUserDefinedFieldWithHttpInfo}. + * + * @param fieldId The ID of the incident user-defined field. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<IncidentUserDefinedFieldResponse>> + */ + public CompletableFuture> + getIncidentUserDefinedFieldWithHttpInfoAsync( + String fieldId, GetIncidentUserDefinedFieldOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "getIncidentUserDefinedField"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'fieldId' is set + if (fieldId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'fieldId' when calling getIncidentUserDefinedField")); + return result; + } + String include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/incidents/config/user-defined-fields/{field_id}" + .replaceAll("\\{" + "field_id" + "\\}", apiClient.escapeString(fieldId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.getIncidentUserDefinedField", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to getIncidentUserDefinedRole. */ + public static class GetIncidentUserDefinedRoleOptionalParameters { + private String include; + + /** + * Set include. + * + * @param include Comma-separated list of related resources to include in the response. + * (optional) + * @return GetIncidentUserDefinedRoleOptionalParameters + */ + public GetIncidentUserDefinedRoleOptionalParameters include(String include) { + this.include = include; + return this; + } + } + + /** + * Get an incident user-defined role. + * + *

See {@link #getIncidentUserDefinedRoleWithHttpInfo}. + * + * @param roleId The UUID of the incident user-defined role. (required) + * @return IncidentUserDefinedRoleResponse + * @throws ApiException if fails to make API call + */ + public IncidentUserDefinedRoleResponse getIncidentUserDefinedRole(UUID roleId) + throws ApiException { + return getIncidentUserDefinedRoleWithHttpInfo( + roleId, new GetIncidentUserDefinedRoleOptionalParameters()) + .getData(); + } + + /** + * Get an incident user-defined role. + * + *

See {@link #getIncidentUserDefinedRoleWithHttpInfoAsync}. + * + * @param roleId The UUID of the incident user-defined role. (required) + * @return CompletableFuture<IncidentUserDefinedRoleResponse> + */ + public CompletableFuture getIncidentUserDefinedRoleAsync( + UUID roleId) { + return getIncidentUserDefinedRoleWithHttpInfoAsync( + roleId, new GetIncidentUserDefinedRoleOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get an incident user-defined role. + * + *

See {@link #getIncidentUserDefinedRoleWithHttpInfo}. + * + * @param roleId The UUID of the incident user-defined role. (required) + * @param parameters Optional parameters for the request. + * @return IncidentUserDefinedRoleResponse + * @throws ApiException if fails to make API call + */ + public IncidentUserDefinedRoleResponse getIncidentUserDefinedRole( + UUID roleId, GetIncidentUserDefinedRoleOptionalParameters parameters) throws ApiException { + return getIncidentUserDefinedRoleWithHttpInfo(roleId, parameters).getData(); + } + + /** + * Get an incident user-defined role. + * + *

See {@link #getIncidentUserDefinedRoleWithHttpInfoAsync}. + * + * @param roleId The UUID of the incident user-defined role. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<IncidentUserDefinedRoleResponse> + */ + public CompletableFuture getIncidentUserDefinedRoleAsync( + UUID roleId, GetIncidentUserDefinedRoleOptionalParameters parameters) { + return getIncidentUserDefinedRoleWithHttpInfoAsync(roleId, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve a single user-defined role for incidents. + * + * @param roleId The UUID of the incident user-defined role. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<IncidentUserDefinedRoleResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * * * *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
404 Not Found -
429 Too many requests -
*/ - public ApiResponse getIncidentUserDefinedFieldWithHttpInfo( - String fieldId, GetIncidentUserDefinedFieldOptionalParameters parameters) - throws ApiException { + public ApiResponse getIncidentUserDefinedRoleWithHttpInfo( + UUID roleId, GetIncidentUserDefinedRoleOptionalParameters parameters) throws ApiException { // Check if unstable operation is enabled - String operationId = "getIncidentUserDefinedField"; + String operationId = "getIncidentUserDefinedRole"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { @@ -5826,16 +6430,16 @@ public ApiResponse getIncidentUserDefinedField } Object localVarPostBody = null; - // verify the required parameter 'fieldId' is set - if (fieldId == null) { + // verify the required parameter 'roleId' is set + if (roleId == null) { throw new ApiException( - 400, "Missing the required parameter 'fieldId' when calling getIncidentUserDefinedField"); + 400, "Missing the required parameter 'roleId' when calling getIncidentUserDefinedRole"); } String include = parameters.include; // create path and map variables String localVarPath = - "/api/v2/incidents/config/user-defined-fields/{field_id}" - .replaceAll("\\{" + "field_id" + "\\}", apiClient.escapeString(fieldId.toString())); + "/api/v2/incidents/config/user-defined-roles/{role_id}" + .replaceAll("\\{" + "role_id" + "\\}", apiClient.escapeString(roleId.toString())); List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); @@ -5844,7 +6448,7 @@ public ApiResponse getIncidentUserDefinedField Invocation.Builder builder = apiClient.createBuilder( - "v2.IncidentsApi.getIncidentUserDefinedField", + "v2.IncidentsApi.getIncidentUserDefinedRole", localVarPath, localVarQueryParams, localVarHeaderParams, @@ -5859,27 +6463,27 @@ public ApiResponse getIncidentUserDefinedField localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Get an incident user-defined field. + * Get an incident user-defined role. * - *

See {@link #getIncidentUserDefinedFieldWithHttpInfo}. + *

See {@link #getIncidentUserDefinedRoleWithHttpInfo}. * - * @param fieldId The ID of the incident user-defined field. (required) + * @param roleId The UUID of the incident user-defined role. (required) * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<IncidentUserDefinedFieldResponse>> + * @return CompletableFuture<ApiResponse<IncidentUserDefinedRoleResponse>> */ - public CompletableFuture> - getIncidentUserDefinedFieldWithHttpInfoAsync( - String fieldId, GetIncidentUserDefinedFieldOptionalParameters parameters) { + public CompletableFuture> + getIncidentUserDefinedRoleWithHttpInfoAsync( + UUID roleId, GetIncidentUserDefinedRoleOptionalParameters parameters) { // Check if unstable operation is enabled - String operationId = "getIncidentUserDefinedField"; + String operationId = "getIncidentUserDefinedRole"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { - CompletableFuture> result = + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); @@ -5887,21 +6491,21 @@ public ApiResponse getIncidentUserDefinedField } Object localVarPostBody = null; - // verify the required parameter 'fieldId' is set - if (fieldId == null) { - CompletableFuture> result = + // verify the required parameter 'roleId' is set + if (roleId == null) { + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, - "Missing the required parameter 'fieldId' when calling getIncidentUserDefinedField")); + "Missing the required parameter 'roleId' when calling getIncidentUserDefinedRole")); return result; } String include = parameters.include; // create path and map variables String localVarPath = - "/api/v2/incidents/config/user-defined-fields/{field_id}" - .replaceAll("\\{" + "field_id" + "\\}", apiClient.escapeString(fieldId.toString())); + "/api/v2/incidents/config/user-defined-roles/{role_id}" + .replaceAll("\\{" + "role_id" + "\\}", apiClient.escapeString(roleId.toString())); List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); @@ -5912,7 +6516,7 @@ public ApiResponse getIncidentUserDefinedField try { builder = apiClient.createBuilder( - "v2.IncidentsApi.getIncidentUserDefinedField", + "v2.IncidentsApi.getIncidentUserDefinedRole", localVarPath, localVarQueryParams, localVarHeaderParams, @@ -5920,7 +6524,7 @@ public ApiResponse getIncidentUserDefinedField new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); } catch (ApiException ex) { - CompletableFuture> result = + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; @@ -5933,7 +6537,7 @@ public ApiResponse getIncidentUserDefinedField localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** Manage optional parameters to importIncident. */ @@ -8150,12 +8754,239 @@ public ListIncidentUserDefinedFieldsOptionalParameters includeDeleted(Boolean in /** * Set filterIncidentType. * - * @param filterIncidentType Filter results to fields associated with the given incident type - * UUID. (optional) - * @return ListIncidentUserDefinedFieldsOptionalParameters + * @param filterIncidentType Filter results to fields associated with the given incident type + * UUID. (optional) + * @return ListIncidentUserDefinedFieldsOptionalParameters + */ + public ListIncidentUserDefinedFieldsOptionalParameters filterIncidentType( + String filterIncidentType) { + this.filterIncidentType = filterIncidentType; + return this; + } + + /** + * Set include. + * + * @param include Comma-separated list of related resources to include. Supported values are + * "last_modified_by_user", "created_by_user", and "incident_type". (optional) + * @return ListIncidentUserDefinedFieldsOptionalParameters + */ + public ListIncidentUserDefinedFieldsOptionalParameters include(String include) { + this.include = include; + return this; + } + } + + /** + * Get a list of incident user-defined fields. + * + *

See {@link #listIncidentUserDefinedFieldsWithHttpInfo}. + * + * @return IncidentUserDefinedFieldListResponse + * @throws ApiException if fails to make API call + */ + public IncidentUserDefinedFieldListResponse listIncidentUserDefinedFields() throws ApiException { + return listIncidentUserDefinedFieldsWithHttpInfo( + new ListIncidentUserDefinedFieldsOptionalParameters()) + .getData(); + } + + /** + * Get a list of incident user-defined fields. + * + *

See {@link #listIncidentUserDefinedFieldsWithHttpInfoAsync}. + * + * @return CompletableFuture<IncidentUserDefinedFieldListResponse> + */ + public CompletableFuture + listIncidentUserDefinedFieldsAsync() { + return listIncidentUserDefinedFieldsWithHttpInfoAsync( + new ListIncidentUserDefinedFieldsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a list of incident user-defined fields. + * + *

See {@link #listIncidentUserDefinedFieldsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return IncidentUserDefinedFieldListResponse + * @throws ApiException if fails to make API call + */ + public IncidentUserDefinedFieldListResponse listIncidentUserDefinedFields( + ListIncidentUserDefinedFieldsOptionalParameters parameters) throws ApiException { + return listIncidentUserDefinedFieldsWithHttpInfo(parameters).getData(); + } + + /** + * Get a list of incident user-defined fields. + * + *

See {@link #listIncidentUserDefinedFieldsWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<IncidentUserDefinedFieldListResponse> + */ + public CompletableFuture listIncidentUserDefinedFieldsAsync( + ListIncidentUserDefinedFieldsOptionalParameters parameters) { + return listIncidentUserDefinedFieldsWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a list of all incident user-defined fields. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<IncidentUserDefinedFieldListResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse + listIncidentUserDefinedFieldsWithHttpInfo( + ListIncidentUserDefinedFieldsOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listIncidentUserDefinedFields"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + Boolean includeDeleted = parameters.includeDeleted; + String filterIncidentType = parameters.filterIncidentType; + String include = parameters.include; + // create path and map variables + String localVarPath = "/api/v2/incidents/config/user-defined-fields"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include-deleted", includeDeleted)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[incident-type]", filterIncidentType)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.listIncidentUserDefinedFields", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a list of incident user-defined fields. + * + *

See {@link #listIncidentUserDefinedFieldsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<IncidentUserDefinedFieldListResponse>> + */ + public CompletableFuture> + listIncidentUserDefinedFieldsWithHttpInfoAsync( + ListIncidentUserDefinedFieldsOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "listIncidentUserDefinedFields"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + Long pageSize = parameters.pageSize; + Long pageNumber = parameters.pageNumber; + Boolean includeDeleted = parameters.includeDeleted; + String filterIncidentType = parameters.filterIncidentType; + String include = parameters.include; + // create path and map variables + String localVarPath = "/api/v2/incidents/config/user-defined-fields"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include-deleted", includeDeleted)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[incident-type]", filterIncidentType)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.listIncidentUserDefinedFields", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to listIncidentUserDefinedRoles. */ + public static class ListIncidentUserDefinedRolesOptionalParameters { + private UUID filterIncidentType; + private String include; + + /** + * Set filterIncidentType. + * + * @param filterIncidentType Filter roles by incident type UUID. (optional) + * @return ListIncidentUserDefinedRolesOptionalParameters */ - public ListIncidentUserDefinedFieldsOptionalParameters filterIncidentType( - String filterIncidentType) { + public ListIncidentUserDefinedRolesOptionalParameters filterIncidentType( + UUID filterIncidentType) { this.filterIncidentType = filterIncidentType; return this; } @@ -8163,41 +8994,40 @@ public ListIncidentUserDefinedFieldsOptionalParameters filterIncidentType( /** * Set include. * - * @param include Comma-separated list of related resources to include. Supported values are - * "last_modified_by_user", "created_by_user", and "incident_type". (optional) - * @return ListIncidentUserDefinedFieldsOptionalParameters + * @param include Comma-separated list of related resources to include in the response. + * (optional) + * @return ListIncidentUserDefinedRolesOptionalParameters */ - public ListIncidentUserDefinedFieldsOptionalParameters include(String include) { + public ListIncidentUserDefinedRolesOptionalParameters include(String include) { this.include = include; return this; } } /** - * Get a list of incident user-defined fields. + * List incident user-defined roles. * - *

See {@link #listIncidentUserDefinedFieldsWithHttpInfo}. + *

See {@link #listIncidentUserDefinedRolesWithHttpInfo}. * - * @return IncidentUserDefinedFieldListResponse + * @return IncidentUserDefinedRolesResponse * @throws ApiException if fails to make API call */ - public IncidentUserDefinedFieldListResponse listIncidentUserDefinedFields() throws ApiException { - return listIncidentUserDefinedFieldsWithHttpInfo( - new ListIncidentUserDefinedFieldsOptionalParameters()) + public IncidentUserDefinedRolesResponse listIncidentUserDefinedRoles() throws ApiException { + return listIncidentUserDefinedRolesWithHttpInfo( + new ListIncidentUserDefinedRolesOptionalParameters()) .getData(); } /** - * Get a list of incident user-defined fields. + * List incident user-defined roles. * - *

See {@link #listIncidentUserDefinedFieldsWithHttpInfoAsync}. + *

See {@link #listIncidentUserDefinedRolesWithHttpInfoAsync}. * - * @return CompletableFuture<IncidentUserDefinedFieldListResponse> + * @return CompletableFuture<IncidentUserDefinedRolesResponse> */ - public CompletableFuture - listIncidentUserDefinedFieldsAsync() { - return listIncidentUserDefinedFieldsWithHttpInfoAsync( - new ListIncidentUserDefinedFieldsOptionalParameters()) + public CompletableFuture listIncidentUserDefinedRolesAsync() { + return listIncidentUserDefinedRolesWithHttpInfoAsync( + new ListIncidentUserDefinedRolesOptionalParameters()) .thenApply( response -> { return response.getData(); @@ -8205,30 +9035,30 @@ public IncidentUserDefinedFieldListResponse listIncidentUserDefinedFields() thro } /** - * Get a list of incident user-defined fields. + * List incident user-defined roles. * - *

See {@link #listIncidentUserDefinedFieldsWithHttpInfo}. + *

See {@link #listIncidentUserDefinedRolesWithHttpInfo}. * * @param parameters Optional parameters for the request. - * @return IncidentUserDefinedFieldListResponse + * @return IncidentUserDefinedRolesResponse * @throws ApiException if fails to make API call */ - public IncidentUserDefinedFieldListResponse listIncidentUserDefinedFields( - ListIncidentUserDefinedFieldsOptionalParameters parameters) throws ApiException { - return listIncidentUserDefinedFieldsWithHttpInfo(parameters).getData(); + public IncidentUserDefinedRolesResponse listIncidentUserDefinedRoles( + ListIncidentUserDefinedRolesOptionalParameters parameters) throws ApiException { + return listIncidentUserDefinedRolesWithHttpInfo(parameters).getData(); } /** - * Get a list of incident user-defined fields. + * List incident user-defined roles. * - *

See {@link #listIncidentUserDefinedFieldsWithHttpInfoAsync}. + *

See {@link #listIncidentUserDefinedRolesWithHttpInfoAsync}. * * @param parameters Optional parameters for the request. - * @return CompletableFuture<IncidentUserDefinedFieldListResponse> + * @return CompletableFuture<IncidentUserDefinedRolesResponse> */ - public CompletableFuture listIncidentUserDefinedFieldsAsync( - ListIncidentUserDefinedFieldsOptionalParameters parameters) { - return listIncidentUserDefinedFieldsWithHttpInfoAsync(parameters) + public CompletableFuture listIncidentUserDefinedRolesAsync( + ListIncidentUserDefinedRolesOptionalParameters parameters) { + return listIncidentUserDefinedRolesWithHttpInfoAsync(parameters) .thenApply( response -> { return response.getData(); @@ -8236,10 +9066,10 @@ public CompletableFuture listIncidentUserD } /** - * Get a list of all incident user-defined fields. + * List all user-defined roles for incidents. * * @param parameters Optional parameters for the request. - * @return ApiResponse<IncidentUserDefinedFieldListResponse> + * @return ApiResponse<IncidentUserDefinedRolesResponse> * @throws ApiException if fails to make API call * @http.response.details * @@ -8247,43 +9077,34 @@ public CompletableFuture listIncidentUserD * * * - * - * * *
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
*/ - public ApiResponse - listIncidentUserDefinedFieldsWithHttpInfo( - ListIncidentUserDefinedFieldsOptionalParameters parameters) throws ApiException { + public ApiResponse listIncidentUserDefinedRolesWithHttpInfo( + ListIncidentUserDefinedRolesOptionalParameters parameters) throws ApiException { // Check if unstable operation is enabled - String operationId = "listIncidentUserDefinedFields"; + String operationId = "listIncidentUserDefinedRoles"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); } Object localVarPostBody = null; - Long pageSize = parameters.pageSize; - Long pageNumber = parameters.pageNumber; - Boolean includeDeleted = parameters.includeDeleted; - String filterIncidentType = parameters.filterIncidentType; + UUID filterIncidentType = parameters.filterIncidentType; String include = parameters.include; // create path and map variables - String localVarPath = "/api/v2/incidents/config/user-defined-fields"; + String localVarPath = "/api/v2/incidents/config/user-defined-roles"; List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "include-deleted", includeDeleted)); localVarQueryParams.addAll( apiClient.parameterToPairs("", "filter[incident-type]", filterIncidentType)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); Invocation.Builder builder = apiClient.createBuilder( - "v2.IncidentsApi.listIncidentUserDefinedFields", + "v2.IncidentsApi.listIncidentUserDefinedRoles", localVarPath, localVarQueryParams, localVarHeaderParams, @@ -8298,46 +9119,40 @@ public CompletableFuture listIncidentUserD localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Get a list of incident user-defined fields. + * List incident user-defined roles. * - *

See {@link #listIncidentUserDefinedFieldsWithHttpInfo}. + *

See {@link #listIncidentUserDefinedRolesWithHttpInfo}. * * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<IncidentUserDefinedFieldListResponse>> + * @return CompletableFuture<ApiResponse<IncidentUserDefinedRolesResponse>> */ - public CompletableFuture> - listIncidentUserDefinedFieldsWithHttpInfoAsync( - ListIncidentUserDefinedFieldsOptionalParameters parameters) { + public CompletableFuture> + listIncidentUserDefinedRolesWithHttpInfoAsync( + ListIncidentUserDefinedRolesOptionalParameters parameters) { // Check if unstable operation is enabled - String operationId = "listIncidentUserDefinedFields"; + String operationId = "listIncidentUserDefinedRoles"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { - CompletableFuture> result = + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); return result; } Object localVarPostBody = null; - Long pageSize = parameters.pageSize; - Long pageNumber = parameters.pageNumber; - Boolean includeDeleted = parameters.includeDeleted; - String filterIncidentType = parameters.filterIncidentType; + UUID filterIncidentType = parameters.filterIncidentType; String include = parameters.include; // create path and map variables - String localVarPath = "/api/v2/incidents/config/user-defined-fields"; + String localVarPath = "/api/v2/incidents/config/user-defined-roles"; List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "include-deleted", includeDeleted)); localVarQueryParams.addAll( apiClient.parameterToPairs("", "filter[incident-type]", filterIncidentType)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); @@ -8346,7 +9161,7 @@ public CompletableFuture listIncidentUserD try { builder = apiClient.createBuilder( - "v2.IncidentsApi.listIncidentUserDefinedFields", + "v2.IncidentsApi.listIncidentUserDefinedRoles", localVarPath, localVarQueryParams, localVarHeaderParams, @@ -8354,7 +9169,7 @@ public CompletableFuture listIncidentUserD new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); } catch (ApiException ex) { - CompletableFuture> result = + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; @@ -8367,7 +9182,7 @@ public CompletableFuture listIncidentUserD localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** Manage optional parameters to searchIncidents. */ @@ -11165,4 +11980,261 @@ public ApiResponse updateIncidentUserDefinedFi false, new GenericType() {}); } + + /** Manage optional parameters to updateIncidentUserDefinedRole. */ + public static class UpdateIncidentUserDefinedRoleOptionalParameters { + private String include; + + /** + * Set include. + * + * @param include Comma-separated list of related resources to include in the response. + * (optional) + * @return UpdateIncidentUserDefinedRoleOptionalParameters + */ + public UpdateIncidentUserDefinedRoleOptionalParameters include(String include) { + this.include = include; + return this; + } + } + + /** + * Update an incident user-defined role. + * + *

See {@link #updateIncidentUserDefinedRoleWithHttpInfo}. + * + * @param roleId The UUID of the incident user-defined role. (required) + * @param body (required) + * @return IncidentUserDefinedRoleResponse + * @throws ApiException if fails to make API call + */ + public IncidentUserDefinedRoleResponse updateIncidentUserDefinedRole( + UUID roleId, IncidentUserDefinedRolePatchRequest body) throws ApiException { + return updateIncidentUserDefinedRoleWithHttpInfo( + roleId, body, new UpdateIncidentUserDefinedRoleOptionalParameters()) + .getData(); + } + + /** + * Update an incident user-defined role. + * + *

See {@link #updateIncidentUserDefinedRoleWithHttpInfoAsync}. + * + * @param roleId The UUID of the incident user-defined role. (required) + * @param body (required) + * @return CompletableFuture<IncidentUserDefinedRoleResponse> + */ + public CompletableFuture updateIncidentUserDefinedRoleAsync( + UUID roleId, IncidentUserDefinedRolePatchRequest body) { + return updateIncidentUserDefinedRoleWithHttpInfoAsync( + roleId, body, new UpdateIncidentUserDefinedRoleOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update an incident user-defined role. + * + *

See {@link #updateIncidentUserDefinedRoleWithHttpInfo}. + * + * @param roleId The UUID of the incident user-defined role. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return IncidentUserDefinedRoleResponse + * @throws ApiException if fails to make API call + */ + public IncidentUserDefinedRoleResponse updateIncidentUserDefinedRole( + UUID roleId, + IncidentUserDefinedRolePatchRequest body, + UpdateIncidentUserDefinedRoleOptionalParameters parameters) + throws ApiException { + return updateIncidentUserDefinedRoleWithHttpInfo(roleId, body, parameters).getData(); + } + + /** + * Update an incident user-defined role. + * + *

See {@link #updateIncidentUserDefinedRoleWithHttpInfoAsync}. + * + * @param roleId The UUID of the incident user-defined role. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<IncidentUserDefinedRoleResponse> + */ + public CompletableFuture updateIncidentUserDefinedRoleAsync( + UUID roleId, + IncidentUserDefinedRolePatchRequest body, + UpdateIncidentUserDefinedRoleOptionalParameters parameters) { + return updateIncidentUserDefinedRoleWithHttpInfoAsync(roleId, body, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update an existing user-defined role for incidents. + * + * @param roleId The UUID of the incident user-defined role. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<IncidentUserDefinedRoleResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updateIncidentUserDefinedRoleWithHttpInfo( + UUID roleId, + IncidentUserDefinedRolePatchRequest body, + UpdateIncidentUserDefinedRoleOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateIncidentUserDefinedRole"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'roleId' is set + if (roleId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'roleId' when calling updateIncidentUserDefinedRole"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateIncidentUserDefinedRole"); + } + String include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/incidents/config/user-defined-roles/{role_id}" + .replaceAll("\\{" + "role_id" + "\\}", apiClient.escapeString(roleId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.updateIncidentUserDefinedRole", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update an incident user-defined role. + * + *

See {@link #updateIncidentUserDefinedRoleWithHttpInfo}. + * + * @param roleId The UUID of the incident user-defined role. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<IncidentUserDefinedRoleResponse>> + */ + public CompletableFuture> + updateIncidentUserDefinedRoleWithHttpInfoAsync( + UUID roleId, + IncidentUserDefinedRolePatchRequest body, + UpdateIncidentUserDefinedRoleOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "updateIncidentUserDefinedRole"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'roleId' is set + if (roleId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'roleId' when calling" + + " updateIncidentUserDefinedRole")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling updateIncidentUserDefinedRole")); + return result; + } + String include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/incidents/config/user-defined-roles/{role_id}" + .replaceAll("\\{" + "role_id" + "\\}", apiClient.escapeString(roleId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.updateIncidentUserDefinedRole", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleDataAttributesRequest.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleDataAttributesRequest.java new file mode 100644 index 00000000000..342bd8a4f19 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleDataAttributesRequest.java @@ -0,0 +1,219 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Attributes for creating an incident user-defined role. */ +@JsonPropertyOrder({ + IncidentUserDefinedRoleDataAttributesRequest.JSON_PROPERTY_DESCRIPTION, + IncidentUserDefinedRoleDataAttributesRequest.JSON_PROPERTY_NAME, + IncidentUserDefinedRoleDataAttributesRequest.JSON_PROPERTY_POLICY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentUserDefinedRoleDataAttributesRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_POLICY = "policy"; + private IncidentUserDefinedRolePolicy policy; + + public IncidentUserDefinedRoleDataAttributesRequest() {} + + @JsonCreator + public IncidentUserDefinedRoleDataAttributesRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_POLICY) + IncidentUserDefinedRolePolicy policy) { + this.name = name; + this.policy = policy; + this.unparsed |= policy.unparsed; + } + + public IncidentUserDefinedRoleDataAttributesRequest description(String description) { + this.description = JsonNullable.of(description); + return this; + } + + /** + * A description of the user-defined role. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(String description) { + this.description = JsonNullable.of(description); + } + + public IncidentUserDefinedRoleDataAttributesRequest name(String name) { + this.name = name; + return this; + } + + /** + * The name of the user-defined role. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public IncidentUserDefinedRoleDataAttributesRequest policy(IncidentUserDefinedRolePolicy policy) { + this.policy = policy; + this.unparsed |= policy.unparsed; + return this; + } + + /** + * Policy configuration for a user-defined role. + * + * @return policy + */ + @JsonProperty(JSON_PROPERTY_POLICY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentUserDefinedRolePolicy getPolicy() { + return policy; + } + + public void setPolicy(IncidentUserDefinedRolePolicy policy) { + this.policy = policy; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentUserDefinedRoleDataAttributesRequest + */ + @JsonAnySetter + public IncidentUserDefinedRoleDataAttributesRequest putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentUserDefinedRoleDataAttributesRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentUserDefinedRoleDataAttributesRequest incidentUserDefinedRoleDataAttributesRequest = + (IncidentUserDefinedRoleDataAttributesRequest) o; + return Objects.equals( + this.description, incidentUserDefinedRoleDataAttributesRequest.description) + && Objects.equals(this.name, incidentUserDefinedRoleDataAttributesRequest.name) + && Objects.equals(this.policy, incidentUserDefinedRoleDataAttributesRequest.policy) + && Objects.equals( + this.additionalProperties, + incidentUserDefinedRoleDataAttributesRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, name, policy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentUserDefinedRoleDataAttributesRequest {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" policy: ").append(toIndentedString(policy)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleDataAttributesResponse.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleDataAttributesResponse.java new file mode 100644 index 00000000000..06a52fbb10f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleDataAttributesResponse.java @@ -0,0 +1,277 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Attributes of an incident user-defined role. */ +@JsonPropertyOrder({ + IncidentUserDefinedRoleDataAttributesResponse.JSON_PROPERTY_CREATED, + IncidentUserDefinedRoleDataAttributesResponse.JSON_PROPERTY_DESCRIPTION, + IncidentUserDefinedRoleDataAttributesResponse.JSON_PROPERTY_MODIFIED, + IncidentUserDefinedRoleDataAttributesResponse.JSON_PROPERTY_NAME, + IncidentUserDefinedRoleDataAttributesResponse.JSON_PROPERTY_POLICY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentUserDefinedRoleDataAttributesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED = "created"; + private OffsetDateTime created; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_MODIFIED = "modified"; + private OffsetDateTime modified; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_POLICY = "policy"; + private IncidentUserDefinedRolePolicy policy; + + public IncidentUserDefinedRoleDataAttributesResponse() {} + + @JsonCreator + public IncidentUserDefinedRoleDataAttributesResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED) OffsetDateTime created, + @JsonProperty(required = true, value = JSON_PROPERTY_MODIFIED) OffsetDateTime modified, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_POLICY) + IncidentUserDefinedRolePolicy policy) { + this.created = created; + this.modified = modified; + this.name = name; + this.policy = policy; + this.unparsed |= policy.unparsed; + } + + public IncidentUserDefinedRoleDataAttributesResponse created(OffsetDateTime created) { + this.created = created; + return this; + } + + /** + * Timestamp when the role was created. + * + * @return created + */ + @JsonProperty(JSON_PROPERTY_CREATED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreated() { + return created; + } + + public void setCreated(OffsetDateTime created) { + this.created = created; + } + + public IncidentUserDefinedRoleDataAttributesResponse description(String description) { + this.description = JsonNullable.of(description); + return this; + } + + /** + * A description of the user-defined role. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(String description) { + this.description = JsonNullable.of(description); + } + + public IncidentUserDefinedRoleDataAttributesResponse modified(OffsetDateTime modified) { + this.modified = modified; + return this; + } + + /** + * Timestamp when the role was last modified. + * + * @return modified + */ + @JsonProperty(JSON_PROPERTY_MODIFIED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getModified() { + return modified; + } + + public void setModified(OffsetDateTime modified) { + this.modified = modified; + } + + public IncidentUserDefinedRoleDataAttributesResponse name(String name) { + this.name = name; + return this; + } + + /** + * The name of the user-defined role. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public IncidentUserDefinedRoleDataAttributesResponse policy( + IncidentUserDefinedRolePolicy policy) { + this.policy = policy; + this.unparsed |= policy.unparsed; + return this; + } + + /** + * Policy configuration for a user-defined role. + * + * @return policy + */ + @JsonProperty(JSON_PROPERTY_POLICY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentUserDefinedRolePolicy getPolicy() { + return policy; + } + + public void setPolicy(IncidentUserDefinedRolePolicy policy) { + this.policy = policy; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentUserDefinedRoleDataAttributesResponse + */ + @JsonAnySetter + public IncidentUserDefinedRoleDataAttributesResponse putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentUserDefinedRoleDataAttributesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentUserDefinedRoleDataAttributesResponse incidentUserDefinedRoleDataAttributesResponse = + (IncidentUserDefinedRoleDataAttributesResponse) o; + return Objects.equals(this.created, incidentUserDefinedRoleDataAttributesResponse.created) + && Objects.equals( + this.description, incidentUserDefinedRoleDataAttributesResponse.description) + && Objects.equals(this.modified, incidentUserDefinedRoleDataAttributesResponse.modified) + && Objects.equals(this.name, incidentUserDefinedRoleDataAttributesResponse.name) + && Objects.equals(this.policy, incidentUserDefinedRoleDataAttributesResponse.policy) + && Objects.equals( + this.additionalProperties, + incidentUserDefinedRoleDataAttributesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(created, description, modified, name, policy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentUserDefinedRoleDataAttributesResponse {\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" modified: ").append(toIndentedString(modified)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" policy: ").append(toIndentedString(policy)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleDataRequest.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleDataRequest.java new file mode 100644 index 00000000000..5d1bb6bc0e8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleDataRequest.java @@ -0,0 +1,216 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data for creating an incident user-defined role. */ +@JsonPropertyOrder({ + IncidentUserDefinedRoleDataRequest.JSON_PROPERTY_ATTRIBUTES, + IncidentUserDefinedRoleDataRequest.JSON_PROPERTY_RELATIONSHIPS, + IncidentUserDefinedRoleDataRequest.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentUserDefinedRoleDataRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private IncidentUserDefinedRoleDataAttributesRequest attributes; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private IncidentUserDefinedRoleRelationshipsRequest relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IncidentUserDefinedRoleType type; + + public IncidentUserDefinedRoleDataRequest() {} + + @JsonCreator + public IncidentUserDefinedRoleDataRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + IncidentUserDefinedRoleDataAttributesRequest attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_RELATIONSHIPS) + IncidentUserDefinedRoleRelationshipsRequest relationships, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IncidentUserDefinedRoleType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public IncidentUserDefinedRoleDataRequest attributes( + IncidentUserDefinedRoleDataAttributesRequest attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for creating an incident user-defined role. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentUserDefinedRoleDataAttributesRequest getAttributes() { + return attributes; + } + + public void setAttributes(IncidentUserDefinedRoleDataAttributesRequest attributes) { + this.attributes = attributes; + } + + public IncidentUserDefinedRoleDataRequest relationships( + IncidentUserDefinedRoleRelationshipsRequest relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * Relationships for creating a user-defined role. + * + * @return relationships + */ + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentUserDefinedRoleRelationshipsRequest getRelationships() { + return relationships; + } + + public void setRelationships(IncidentUserDefinedRoleRelationshipsRequest relationships) { + this.relationships = relationships; + } + + public IncidentUserDefinedRoleDataRequest type(IncidentUserDefinedRoleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Incident user-defined role resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentUserDefinedRoleType getType() { + return type; + } + + public void setType(IncidentUserDefinedRoleType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentUserDefinedRoleDataRequest + */ + @JsonAnySetter + public IncidentUserDefinedRoleDataRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentUserDefinedRoleDataRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentUserDefinedRoleDataRequest incidentUserDefinedRoleDataRequest = + (IncidentUserDefinedRoleDataRequest) o; + return Objects.equals(this.attributes, incidentUserDefinedRoleDataRequest.attributes) + && Objects.equals(this.relationships, incidentUserDefinedRoleDataRequest.relationships) + && Objects.equals(this.type, incidentUserDefinedRoleDataRequest.type) + && Objects.equals( + this.additionalProperties, incidentUserDefinedRoleDataRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentUserDefinedRoleDataRequest {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleDataResponse.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleDataResponse.java new file mode 100644 index 00000000000..26e5ac55194 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleDataResponse.java @@ -0,0 +1,242 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Data for an incident user-defined role response. */ +@JsonPropertyOrder({ + IncidentUserDefinedRoleDataResponse.JSON_PROPERTY_ATTRIBUTES, + IncidentUserDefinedRoleDataResponse.JSON_PROPERTY_ID, + IncidentUserDefinedRoleDataResponse.JSON_PROPERTY_RELATIONSHIPS, + IncidentUserDefinedRoleDataResponse.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentUserDefinedRoleDataResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private IncidentUserDefinedRoleDataAttributesResponse attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private IncidentUserDefinedRoleRelationshipsResponse relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IncidentUserDefinedRoleType type; + + public IncidentUserDefinedRoleDataResponse() {} + + @JsonCreator + public IncidentUserDefinedRoleDataResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + IncidentUserDefinedRoleDataAttributesResponse attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IncidentUserDefinedRoleType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public IncidentUserDefinedRoleDataResponse attributes( + IncidentUserDefinedRoleDataAttributesResponse attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of an incident user-defined role. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentUserDefinedRoleDataAttributesResponse getAttributes() { + return attributes; + } + + public void setAttributes(IncidentUserDefinedRoleDataAttributesResponse attributes) { + this.attributes = attributes; + } + + public IncidentUserDefinedRoleDataResponse id(UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the user-defined role. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public IncidentUserDefinedRoleDataResponse relationships( + IncidentUserDefinedRoleRelationshipsResponse relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * Relationships of a user-defined role response. + * + * @return relationships + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public IncidentUserDefinedRoleRelationshipsResponse getRelationships() { + return relationships; + } + + public void setRelationships(IncidentUserDefinedRoleRelationshipsResponse relationships) { + this.relationships = relationships; + } + + public IncidentUserDefinedRoleDataResponse type(IncidentUserDefinedRoleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Incident user-defined role resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentUserDefinedRoleType getType() { + return type; + } + + public void setType(IncidentUserDefinedRoleType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentUserDefinedRoleDataResponse + */ + @JsonAnySetter + public IncidentUserDefinedRoleDataResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentUserDefinedRoleDataResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentUserDefinedRoleDataResponse incidentUserDefinedRoleDataResponse = + (IncidentUserDefinedRoleDataResponse) o; + return Objects.equals(this.attributes, incidentUserDefinedRoleDataResponse.attributes) + && Objects.equals(this.id, incidentUserDefinedRoleDataResponse.id) + && Objects.equals(this.relationships, incidentUserDefinedRoleDataResponse.relationships) + && Objects.equals(this.type, incidentUserDefinedRoleDataResponse.type) + && Objects.equals( + this.additionalProperties, incidentUserDefinedRoleDataResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentUserDefinedRoleDataResponse {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleIncidentTypeRelationship.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleIncidentTypeRelationship.java new file mode 100644 index 00000000000..aa935dc5835 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleIncidentTypeRelationship.java @@ -0,0 +1,152 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Relationship to an incident type for a user-defined role. */ +@JsonPropertyOrder({IncidentUserDefinedRoleIncidentTypeRelationship.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentUserDefinedRoleIncidentTypeRelationship { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private IncidentUserDefinedRoleIncidentTypeRelationshipData data; + + public IncidentUserDefinedRoleIncidentTypeRelationship() {} + + @JsonCreator + public IncidentUserDefinedRoleIncidentTypeRelationship( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + IncidentUserDefinedRoleIncidentTypeRelationshipData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public IncidentUserDefinedRoleIncidentTypeRelationship data( + IncidentUserDefinedRoleIncidentTypeRelationshipData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for the incident type relationship of a user-defined role. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentUserDefinedRoleIncidentTypeRelationshipData getData() { + return data; + } + + public void setData(IncidentUserDefinedRoleIncidentTypeRelationshipData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentUserDefinedRoleIncidentTypeRelationship + */ + @JsonAnySetter + public IncidentUserDefinedRoleIncidentTypeRelationship putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentUserDefinedRoleIncidentTypeRelationship object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentUserDefinedRoleIncidentTypeRelationship + incidentUserDefinedRoleIncidentTypeRelationship = + (IncidentUserDefinedRoleIncidentTypeRelationship) o; + return Objects.equals(this.data, incidentUserDefinedRoleIncidentTypeRelationship.data) + && Objects.equals( + this.additionalProperties, + incidentUserDefinedRoleIncidentTypeRelationship.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentUserDefinedRoleIncidentTypeRelationship {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleIncidentTypeRelationshipData.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleIncidentTypeRelationshipData.java new file mode 100644 index 00000000000..de541482fd5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleIncidentTypeRelationshipData.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Data for the incident type relationship of a user-defined role. */ +@JsonPropertyOrder({ + IncidentUserDefinedRoleIncidentTypeRelationshipData.JSON_PROPERTY_ID, + IncidentUserDefinedRoleIncidentTypeRelationshipData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentUserDefinedRoleIncidentTypeRelationshipData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public IncidentUserDefinedRoleIncidentTypeRelationshipData() {} + + @JsonCreator + public IncidentUserDefinedRoleIncidentTypeRelationshipData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type) { + this.id = id; + this.type = type; + } + + public IncidentUserDefinedRoleIncidentTypeRelationshipData id(UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the incident type. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public IncidentUserDefinedRoleIncidentTypeRelationshipData type(String type) { + this.type = type; + return this; + } + + /** + * The type of the resource. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentUserDefinedRoleIncidentTypeRelationshipData + */ + @JsonAnySetter + public IncidentUserDefinedRoleIncidentTypeRelationshipData putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** + * Return true if this IncidentUserDefinedRoleIncidentTypeRelationshipData object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentUserDefinedRoleIncidentTypeRelationshipData + incidentUserDefinedRoleIncidentTypeRelationshipData = + (IncidentUserDefinedRoleIncidentTypeRelationshipData) o; + return Objects.equals(this.id, incidentUserDefinedRoleIncidentTypeRelationshipData.id) + && Objects.equals(this.type, incidentUserDefinedRoleIncidentTypeRelationshipData.type) + && Objects.equals( + this.additionalProperties, + incidentUserDefinedRoleIncidentTypeRelationshipData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentUserDefinedRoleIncidentTypeRelationshipData {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleIncludedItem.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleIncludedItem.java new file mode 100644 index 00000000000..c5dbff3eb99 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleIncludedItem.java @@ -0,0 +1,285 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = + IncidentUserDefinedRoleIncludedItem.IncidentUserDefinedRoleIncludedItemDeserializer.class) +@JsonSerialize( + using = IncidentUserDefinedRoleIncludedItem.IncidentUserDefinedRoleIncludedItemSerializer.class) +public class IncidentUserDefinedRoleIncludedItem extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(IncidentUserDefinedRoleIncludedItem.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class IncidentUserDefinedRoleIncludedItemSerializer + extends StdSerializer { + public IncidentUserDefinedRoleIncludedItemSerializer( + Class t) { + super(t); + } + + public IncidentUserDefinedRoleIncludedItemSerializer() { + this(null); + } + + @Override + public void serialize( + IncidentUserDefinedRoleIncludedItem value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class IncidentUserDefinedRoleIncludedItemDeserializer + extends StdDeserializer { + public IncidentUserDefinedRoleIncludedItemDeserializer() { + this(IncidentUserDefinedRoleIncludedItem.class); + } + + public IncidentUserDefinedRoleIncludedItemDeserializer(Class vc) { + super(vc); + } + + @Override + public IncidentUserDefinedRoleIncludedItem deserialize( + JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize IncidentUserData + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (IncidentUserData.class.equals(Integer.class) + || IncidentUserData.class.equals(Long.class) + || IncidentUserData.class.equals(Float.class) + || IncidentUserData.class.equals(Double.class) + || IncidentUserData.class.equals(Boolean.class) + || IncidentUserData.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((IncidentUserData.class.equals(Integer.class) + || IncidentUserData.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((IncidentUserData.class.equals(Float.class) + || IncidentUserData.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (IncidentUserData.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (IncidentUserData.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(IncidentUserData.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((IncidentUserData) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'IncidentUserData'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'IncidentUserData'", e); + } + + // deserialize IncidentTypeObject + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (IncidentTypeObject.class.equals(Integer.class) + || IncidentTypeObject.class.equals(Long.class) + || IncidentTypeObject.class.equals(Float.class) + || IncidentTypeObject.class.equals(Double.class) + || IncidentTypeObject.class.equals(Boolean.class) + || IncidentTypeObject.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((IncidentTypeObject.class.equals(Integer.class) + || IncidentTypeObject.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((IncidentTypeObject.class.equals(Float.class) + || IncidentTypeObject.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (IncidentTypeObject.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (IncidentTypeObject.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(IncidentTypeObject.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((IncidentTypeObject) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'IncidentTypeObject'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'IncidentTypeObject'", e); + } + + IncidentUserDefinedRoleIncludedItem ret = new IncidentUserDefinedRoleIncludedItem(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public IncidentUserDefinedRoleIncludedItem getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "IncidentUserDefinedRoleIncludedItem cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public IncidentUserDefinedRoleIncludedItem() { + super("oneOf", Boolean.FALSE); + } + + public IncidentUserDefinedRoleIncludedItem(IncidentUserData o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public IncidentUserDefinedRoleIncludedItem(IncidentTypeObject o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("IncidentUserData", new GenericType() {}); + schemas.put("IncidentTypeObject", new GenericType() {}); + JSON.registerDescendants( + IncidentUserDefinedRoleIncludedItem.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return IncidentUserDefinedRoleIncludedItem.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: IncidentUserData, IncidentTypeObject + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(IncidentUserData.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(IncidentTypeObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be IncidentUserData, IncidentTypeObject"); + } + + /** + * Get the actual instance, which can be the following: IncidentUserData, IncidentTypeObject + * + * @return The actual instance (IncidentUserData, IncidentTypeObject) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `IncidentUserData`. If the actual instance is not + * `IncidentUserData`, the ClassCastException will be thrown. + * + * @return The actual instance of `IncidentUserData` + * @throws ClassCastException if the instance is not `IncidentUserData` + */ + public IncidentUserData getIncidentUserData() throws ClassCastException { + return (IncidentUserData) super.getActualInstance(); + } + + /** + * Get the actual instance of `IncidentTypeObject`. If the actual instance is not + * `IncidentTypeObject`, the ClassCastException will be thrown. + * + * @return The actual instance of `IncidentTypeObject` + * @throws ClassCastException if the instance is not `IncidentTypeObject` + */ + public IncidentTypeObject getIncidentTypeObject() throws ClassCastException { + return (IncidentTypeObject) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRolePatchDataAttributesRequest.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRolePatchDataAttributesRequest.java new file mode 100644 index 00000000000..fe41888d77d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRolePatchDataAttributesRequest.java @@ -0,0 +1,210 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Attributes for updating an incident user-defined role. */ +@JsonPropertyOrder({ + IncidentUserDefinedRolePatchDataAttributesRequest.JSON_PROPERTY_DESCRIPTION, + IncidentUserDefinedRolePatchDataAttributesRequest.JSON_PROPERTY_NAME, + IncidentUserDefinedRolePatchDataAttributesRequest.JSON_PROPERTY_POLICY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentUserDefinedRolePatchDataAttributesRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_POLICY = "policy"; + private IncidentUserDefinedRolePolicy policy; + + public IncidentUserDefinedRolePatchDataAttributesRequest description(String description) { + this.description = JsonNullable.of(description); + return this; + } + + /** + * A description of the user-defined role. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(String description) { + this.description = JsonNullable.of(description); + } + + public IncidentUserDefinedRolePatchDataAttributesRequest name(String name) { + this.name = name; + return this; + } + + /** + * The name of the user-defined role. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public IncidentUserDefinedRolePatchDataAttributesRequest policy( + IncidentUserDefinedRolePolicy policy) { + this.policy = policy; + this.unparsed |= policy.unparsed; + return this; + } + + /** + * Policy configuration for a user-defined role. + * + * @return policy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_POLICY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public IncidentUserDefinedRolePolicy getPolicy() { + return policy; + } + + public void setPolicy(IncidentUserDefinedRolePolicy policy) { + this.policy = policy; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentUserDefinedRolePatchDataAttributesRequest + */ + @JsonAnySetter + public IncidentUserDefinedRolePatchDataAttributesRequest putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentUserDefinedRolePatchDataAttributesRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentUserDefinedRolePatchDataAttributesRequest + incidentUserDefinedRolePatchDataAttributesRequest = + (IncidentUserDefinedRolePatchDataAttributesRequest) o; + return Objects.equals( + this.description, incidentUserDefinedRolePatchDataAttributesRequest.description) + && Objects.equals(this.name, incidentUserDefinedRolePatchDataAttributesRequest.name) + && Objects.equals(this.policy, incidentUserDefinedRolePatchDataAttributesRequest.policy) + && Objects.equals( + this.additionalProperties, + incidentUserDefinedRolePatchDataAttributesRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(description, name, policy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentUserDefinedRolePatchDataAttributesRequest {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" policy: ").append(toIndentedString(policy)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRolePatchDataRequest.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRolePatchDataRequest.java new file mode 100644 index 00000000000..5f3975822a1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRolePatchDataRequest.java @@ -0,0 +1,211 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Data for updating an incident user-defined role. */ +@JsonPropertyOrder({ + IncidentUserDefinedRolePatchDataRequest.JSON_PROPERTY_ATTRIBUTES, + IncidentUserDefinedRolePatchDataRequest.JSON_PROPERTY_ID, + IncidentUserDefinedRolePatchDataRequest.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentUserDefinedRolePatchDataRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private IncidentUserDefinedRolePatchDataAttributesRequest attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IncidentUserDefinedRoleType type; + + public IncidentUserDefinedRolePatchDataRequest() {} + + @JsonCreator + public IncidentUserDefinedRolePatchDataRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) IncidentUserDefinedRoleType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public IncidentUserDefinedRolePatchDataRequest attributes( + IncidentUserDefinedRolePatchDataAttributesRequest attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for updating an incident user-defined role. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public IncidentUserDefinedRolePatchDataAttributesRequest getAttributes() { + return attributes; + } + + public void setAttributes(IncidentUserDefinedRolePatchDataAttributesRequest attributes) { + this.attributes = attributes; + } + + public IncidentUserDefinedRolePatchDataRequest id(UUID id) { + this.id = id; + return this; + } + + /** + * The ID of the user-defined role to update. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public IncidentUserDefinedRolePatchDataRequest type(IncidentUserDefinedRoleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Incident user-defined role resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentUserDefinedRoleType getType() { + return type; + } + + public void setType(IncidentUserDefinedRoleType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentUserDefinedRolePatchDataRequest + */ + @JsonAnySetter + public IncidentUserDefinedRolePatchDataRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentUserDefinedRolePatchDataRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentUserDefinedRolePatchDataRequest incidentUserDefinedRolePatchDataRequest = + (IncidentUserDefinedRolePatchDataRequest) o; + return Objects.equals(this.attributes, incidentUserDefinedRolePatchDataRequest.attributes) + && Objects.equals(this.id, incidentUserDefinedRolePatchDataRequest.id) + && Objects.equals(this.type, incidentUserDefinedRolePatchDataRequest.type) + && Objects.equals( + this.additionalProperties, + incidentUserDefinedRolePatchDataRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentUserDefinedRolePatchDataRequest {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRolePatchRequest.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRolePatchRequest.java new file mode 100644 index 00000000000..684e4f915a5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRolePatchRequest.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request for updating an incident user-defined role. */ +@JsonPropertyOrder({IncidentUserDefinedRolePatchRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentUserDefinedRolePatchRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private IncidentUserDefinedRolePatchDataRequest data; + + public IncidentUserDefinedRolePatchRequest() {} + + @JsonCreator + public IncidentUserDefinedRolePatchRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + IncidentUserDefinedRolePatchDataRequest data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public IncidentUserDefinedRolePatchRequest data(IncidentUserDefinedRolePatchDataRequest data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for updating an incident user-defined role. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentUserDefinedRolePatchDataRequest getData() { + return data; + } + + public void setData(IncidentUserDefinedRolePatchDataRequest data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentUserDefinedRolePatchRequest + */ + @JsonAnySetter + public IncidentUserDefinedRolePatchRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentUserDefinedRolePatchRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentUserDefinedRolePatchRequest incidentUserDefinedRolePatchRequest = + (IncidentUserDefinedRolePatchRequest) o; + return Objects.equals(this.data, incidentUserDefinedRolePatchRequest.data) + && Objects.equals( + this.additionalProperties, incidentUserDefinedRolePatchRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentUserDefinedRolePatchRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRolePolicy.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRolePolicy.java new file mode 100644 index 00000000000..46815e7b92d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRolePolicy.java @@ -0,0 +1,144 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Policy configuration for a user-defined role. */ +@JsonPropertyOrder({IncidentUserDefinedRolePolicy.JSON_PROPERTY_IS_SINGLE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentUserDefinedRolePolicy { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_IS_SINGLE = "is_single"; + private Boolean isSingle; + + public IncidentUserDefinedRolePolicy() {} + + @JsonCreator + public IncidentUserDefinedRolePolicy( + @JsonProperty(required = true, value = JSON_PROPERTY_IS_SINGLE) Boolean isSingle) { + this.isSingle = isSingle; + } + + public IncidentUserDefinedRolePolicy isSingle(Boolean isSingle) { + this.isSingle = isSingle; + return this; + } + + /** + * Whether this role can only be assigned to one responder at a time. + * + * @return isSingle + */ + @JsonProperty(JSON_PROPERTY_IS_SINGLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsSingle() { + return isSingle; + } + + public void setIsSingle(Boolean isSingle) { + this.isSingle = isSingle; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentUserDefinedRolePolicy + */ + @JsonAnySetter + public IncidentUserDefinedRolePolicy putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentUserDefinedRolePolicy object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentUserDefinedRolePolicy incidentUserDefinedRolePolicy = (IncidentUserDefinedRolePolicy) o; + return Objects.equals(this.isSingle, incidentUserDefinedRolePolicy.isSingle) + && Objects.equals( + this.additionalProperties, incidentUserDefinedRolePolicy.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(isSingle, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentUserDefinedRolePolicy {\n"); + sb.append(" isSingle: ").append(toIndentedString(isSingle)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleRelationshipsRequest.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleRelationshipsRequest.java new file mode 100644 index 00000000000..51972c5594e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleRelationshipsRequest.java @@ -0,0 +1,152 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Relationships for creating a user-defined role. */ +@JsonPropertyOrder({IncidentUserDefinedRoleRelationshipsRequest.JSON_PROPERTY_INCIDENT_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentUserDefinedRoleRelationshipsRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_INCIDENT_TYPE = "incident_type"; + private IncidentUserDefinedRoleIncidentTypeRelationship incidentType; + + public IncidentUserDefinedRoleRelationshipsRequest() {} + + @JsonCreator + public IncidentUserDefinedRoleRelationshipsRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_INCIDENT_TYPE) + IncidentUserDefinedRoleIncidentTypeRelationship incidentType) { + this.incidentType = incidentType; + this.unparsed |= incidentType.unparsed; + } + + public IncidentUserDefinedRoleRelationshipsRequest incidentType( + IncidentUserDefinedRoleIncidentTypeRelationship incidentType) { + this.incidentType = incidentType; + this.unparsed |= incidentType.unparsed; + return this; + } + + /** + * Relationship to an incident type for a user-defined role. + * + * @return incidentType + */ + @JsonProperty(JSON_PROPERTY_INCIDENT_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentUserDefinedRoleIncidentTypeRelationship getIncidentType() { + return incidentType; + } + + public void setIncidentType(IncidentUserDefinedRoleIncidentTypeRelationship incidentType) { + this.incidentType = incidentType; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentUserDefinedRoleRelationshipsRequest + */ + @JsonAnySetter + public IncidentUserDefinedRoleRelationshipsRequest putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentUserDefinedRoleRelationshipsRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentUserDefinedRoleRelationshipsRequest incidentUserDefinedRoleRelationshipsRequest = + (IncidentUserDefinedRoleRelationshipsRequest) o; + return Objects.equals( + this.incidentType, incidentUserDefinedRoleRelationshipsRequest.incidentType) + && Objects.equals( + this.additionalProperties, + incidentUserDefinedRoleRelationshipsRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(incidentType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentUserDefinedRoleRelationshipsRequest {\n"); + sb.append(" incidentType: ").append(toIndentedString(incidentType)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleRelationshipsResponse.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleRelationshipsResponse.java new file mode 100644 index 00000000000..58427e9a088 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleRelationshipsResponse.java @@ -0,0 +1,205 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Relationships of a user-defined role response. */ +@JsonPropertyOrder({ + IncidentUserDefinedRoleRelationshipsResponse.JSON_PROPERTY_CREATED_BY_USER, + IncidentUserDefinedRoleRelationshipsResponse.JSON_PROPERTY_INCIDENT_TYPE, + IncidentUserDefinedRoleRelationshipsResponse.JSON_PROPERTY_LAST_MODIFIED_BY_USER +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentUserDefinedRoleRelationshipsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_BY_USER = "created_by_user"; + private RelationshipToUser createdByUser; + + public static final String JSON_PROPERTY_INCIDENT_TYPE = "incident_type"; + private IncidentUserDefinedRoleIncidentTypeRelationship incidentType; + + public static final String JSON_PROPERTY_LAST_MODIFIED_BY_USER = "last_modified_by_user"; + private RelationshipToUser lastModifiedByUser; + + public IncidentUserDefinedRoleRelationshipsResponse createdByUser( + RelationshipToUser createdByUser) { + this.createdByUser = createdByUser; + this.unparsed |= createdByUser.unparsed; + return this; + } + + /** + * Relationship to user. + * + * @return createdByUser + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_BY_USER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RelationshipToUser getCreatedByUser() { + return createdByUser; + } + + public void setCreatedByUser(RelationshipToUser createdByUser) { + this.createdByUser = createdByUser; + } + + public IncidentUserDefinedRoleRelationshipsResponse incidentType( + IncidentUserDefinedRoleIncidentTypeRelationship incidentType) { + this.incidentType = incidentType; + this.unparsed |= incidentType.unparsed; + return this; + } + + /** + * Relationship to an incident type for a user-defined role. + * + * @return incidentType + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCIDENT_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public IncidentUserDefinedRoleIncidentTypeRelationship getIncidentType() { + return incidentType; + } + + public void setIncidentType(IncidentUserDefinedRoleIncidentTypeRelationship incidentType) { + this.incidentType = incidentType; + } + + public IncidentUserDefinedRoleRelationshipsResponse lastModifiedByUser( + RelationshipToUser lastModifiedByUser) { + this.lastModifiedByUser = lastModifiedByUser; + this.unparsed |= lastModifiedByUser.unparsed; + return this; + } + + /** + * Relationship to user. + * + * @return lastModifiedByUser + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LAST_MODIFIED_BY_USER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RelationshipToUser getLastModifiedByUser() { + return lastModifiedByUser; + } + + public void setLastModifiedByUser(RelationshipToUser lastModifiedByUser) { + this.lastModifiedByUser = lastModifiedByUser; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentUserDefinedRoleRelationshipsResponse + */ + @JsonAnySetter + public IncidentUserDefinedRoleRelationshipsResponse putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentUserDefinedRoleRelationshipsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentUserDefinedRoleRelationshipsResponse incidentUserDefinedRoleRelationshipsResponse = + (IncidentUserDefinedRoleRelationshipsResponse) o; + return Objects.equals( + this.createdByUser, incidentUserDefinedRoleRelationshipsResponse.createdByUser) + && Objects.equals( + this.incidentType, incidentUserDefinedRoleRelationshipsResponse.incidentType) + && Objects.equals( + this.lastModifiedByUser, + incidentUserDefinedRoleRelationshipsResponse.lastModifiedByUser) + && Objects.equals( + this.additionalProperties, + incidentUserDefinedRoleRelationshipsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdByUser, incidentType, lastModifiedByUser, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentUserDefinedRoleRelationshipsResponse {\n"); + sb.append(" createdByUser: ").append(toIndentedString(createdByUser)).append("\n"); + sb.append(" incidentType: ").append(toIndentedString(incidentType)).append("\n"); + sb.append(" lastModifiedByUser: ").append(toIndentedString(lastModifiedByUser)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleRequest.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleRequest.java new file mode 100644 index 00000000000..e97226c0c02 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleRequest.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request for creating an incident user-defined role. */ +@JsonPropertyOrder({IncidentUserDefinedRoleRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentUserDefinedRoleRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private IncidentUserDefinedRoleDataRequest data; + + public IncidentUserDefinedRoleRequest() {} + + @JsonCreator + public IncidentUserDefinedRoleRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + IncidentUserDefinedRoleDataRequest data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public IncidentUserDefinedRoleRequest data(IncidentUserDefinedRoleDataRequest data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for creating an incident user-defined role. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentUserDefinedRoleDataRequest getData() { + return data; + } + + public void setData(IncidentUserDefinedRoleDataRequest data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentUserDefinedRoleRequest + */ + @JsonAnySetter + public IncidentUserDefinedRoleRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentUserDefinedRoleRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentUserDefinedRoleRequest incidentUserDefinedRoleRequest = + (IncidentUserDefinedRoleRequest) o; + return Objects.equals(this.data, incidentUserDefinedRoleRequest.data) + && Objects.equals( + this.additionalProperties, incidentUserDefinedRoleRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentUserDefinedRoleRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleResponse.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleResponse.java new file mode 100644 index 00000000000..c7ac2e8c545 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleResponse.java @@ -0,0 +1,193 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response with a single incident user-defined role. */ +@JsonPropertyOrder({ + IncidentUserDefinedRoleResponse.JSON_PROPERTY_DATA, + IncidentUserDefinedRoleResponse.JSON_PROPERTY_INCLUDED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentUserDefinedRoleResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private IncidentUserDefinedRoleDataResponse data; + + public static final String JSON_PROPERTY_INCLUDED = "included"; + private List included = null; + + public IncidentUserDefinedRoleResponse() {} + + @JsonCreator + public IncidentUserDefinedRoleResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + IncidentUserDefinedRoleDataResponse data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public IncidentUserDefinedRoleResponse data(IncidentUserDefinedRoleDataResponse data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for an incident user-defined role response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentUserDefinedRoleDataResponse getData() { + return data; + } + + public void setData(IncidentUserDefinedRoleDataResponse data) { + this.data = data; + } + + public IncidentUserDefinedRoleResponse included( + List included) { + this.included = included; + for (IncidentUserDefinedRoleIncludedItem item : included) { + this.unparsed |= item.unparsed; + } + return this; + } + + public IncidentUserDefinedRoleResponse addIncludedItem( + IncidentUserDefinedRoleIncludedItem includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + this.unparsed |= includedItem.unparsed; + return this; + } + + /** + * Included resources for an incident user-defined role response. + * + * @return included + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCLUDED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIncluded() { + return included; + } + + public void setIncluded(List included) { + this.included = included; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentUserDefinedRoleResponse + */ + @JsonAnySetter + public IncidentUserDefinedRoleResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentUserDefinedRoleResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentUserDefinedRoleResponse incidentUserDefinedRoleResponse = + (IncidentUserDefinedRoleResponse) o; + return Objects.equals(this.data, incidentUserDefinedRoleResponse.data) + && Objects.equals(this.included, incidentUserDefinedRoleResponse.included) + && Objects.equals( + this.additionalProperties, incidentUserDefinedRoleResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentUserDefinedRoleResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleType.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleType.java new file mode 100644 index 00000000000..883594ac806 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRoleType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Incident user-defined role resource type. */ +@JsonSerialize(using = IncidentUserDefinedRoleType.IncidentUserDefinedRoleTypeSerializer.class) +public class IncidentUserDefinedRoleType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("incident_user_defined_roles")); + + public static final IncidentUserDefinedRoleType INCIDENT_USER_DEFINED_ROLES = + new IncidentUserDefinedRoleType("incident_user_defined_roles"); + + IncidentUserDefinedRoleType(String value) { + super(value, allowedValues); + } + + public static class IncidentUserDefinedRoleTypeSerializer + extends StdSerializer { + public IncidentUserDefinedRoleTypeSerializer(Class t) { + super(t); + } + + public IncidentUserDefinedRoleTypeSerializer() { + this(null); + } + + @Override + public void serialize( + IncidentUserDefinedRoleType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static IncidentUserDefinedRoleType fromValue(String value) { + return new IncidentUserDefinedRoleType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRolesResponse.java b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRolesResponse.java new file mode 100644 index 00000000000..2a6dced4108 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentUserDefinedRolesResponse.java @@ -0,0 +1,201 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response with a list of incident user-defined roles. */ +@JsonPropertyOrder({ + IncidentUserDefinedRolesResponse.JSON_PROPERTY_DATA, + IncidentUserDefinedRolesResponse.JSON_PROPERTY_INCLUDED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentUserDefinedRolesResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public static final String JSON_PROPERTY_INCLUDED = "included"; + private List included = null; + + public IncidentUserDefinedRolesResponse() {} + + @JsonCreator + public IncidentUserDefinedRolesResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + } + + public IncidentUserDefinedRolesResponse data(List data) { + this.data = data; + for (IncidentUserDefinedRoleDataResponse item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public IncidentUserDefinedRolesResponse addDataItem( + IncidentUserDefinedRoleDataResponse dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * List of incident user-defined role data objects. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public IncidentUserDefinedRolesResponse included( + List included) { + this.included = included; + for (IncidentUserDefinedRoleIncludedItem item : included) { + this.unparsed |= item.unparsed; + } + return this; + } + + public IncidentUserDefinedRolesResponse addIncludedItem( + IncidentUserDefinedRoleIncludedItem includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + this.unparsed |= includedItem.unparsed; + return this; + } + + /** + * Included resources for an incident user-defined role response. + * + * @return included + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCLUDED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIncluded() { + return included; + } + + public void setIncluded(List included) { + this.included = included; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentUserDefinedRolesResponse + */ + @JsonAnySetter + public IncidentUserDefinedRolesResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentUserDefinedRolesResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentUserDefinedRolesResponse incidentUserDefinedRolesResponse = + (IncidentUserDefinedRolesResponse) o; + return Objects.equals(this.data, incidentUserDefinedRolesResponse.data) + && Objects.equals(this.included, incidentUserDefinedRolesResponse.included) + && Objects.equals( + this.additionalProperties, incidentUserDefinedRolesResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentUserDefinedRolesResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/incidents.feature b/src/test/resources/com/datadog/api/client/v2/api/incidents.feature index 62c70d5c560..1b993a1ff29 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/incidents.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index cbfa3f20784..03438991411 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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": {