diff --git a/.apigentools-info b/.apigentools-info index 3a75e55772be..29e7c1405256 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2023-03-03 14:44:23.087376", - "spec_repo_commit": "52f78f82" + "regenerated": "2023-03-06 17:22:58.062582", + "spec_repo_commit": "5248c0df" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2023-03-03 14:44:23.103277", - "spec_repo_commit": "52f78f82" + "regenerated": "2023-03-06 17:22:58.078098", + "spec_repo_commit": "5248c0df" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 8b4befe6ab4a..28bf6944d5d5 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -211,6 +211,13 @@ components: items: $ref: '#/components/schemas/IncidentRelatedObject' type: array + IncidentIntegrationMetadataIDPathParameter: + description: The UUID of the incident integration metadata. + in: path + name: integration_metadata_id + required: true + schema: + type: string IncidentSearchIncludeQueryParameter: description: Specifies which types of related objects should be included in the response. @@ -4347,6 +4354,137 @@ components: - TEXTARRAY - METRICTAG - AUTOCOMPLETE + IncidentIntegrationMetadataAttributes: + description: Incident integration metadata's attributes for a create request. + properties: + incident_id: + description: UUID of the incident this integration metadata is connected + to. + example: 00000000-aaaa-0000-0000-000000000000 + type: string + integration_type: + description: 'A number indicating the type of integration this metadata + is for. 1 indicates Slack; + + 8 indicates Jira.' + example: 1 + format: int32 + maximum: 9 + type: integer + metadata: + $ref: '#/components/schemas/IncidentIntegrationMetadataMetadata' + status: + description: 'A number indicating the status of this integration metadata. + 0 indicates unknown; + + 1 indicates pending; 2 indicates complete; 3 indicates manually created; + + 4 indicates manually updated; 5 indicates failed.' + format: int32 + maximum: 5 + type: integer + required: + - integration_type + - metadata + type: object + IncidentIntegrationMetadataCreateData: + description: Incident integration metadata data for a create request. + properties: + attributes: + $ref: '#/components/schemas/IncidentIntegrationMetadataAttributes' + type: + $ref: '#/components/schemas/IncidentIntegrationMetadataType' + required: + - type + - attributes + type: object + IncidentIntegrationMetadataCreateRequest: + description: Create request for an incident integration metadata. + properties: + data: + $ref: '#/components/schemas/IncidentIntegrationMetadataCreateData' + required: + - data + type: object + IncidentIntegrationMetadataListResponse: + description: Response with a list of incident integration metadata. + properties: + data: + description: An array of incident integration metadata. + items: + $ref: '#/components/schemas/IncidentIntegrationMetadataResponseData' + type: array + included: + description: Included related resources that the user requested. + items: + $ref: '#/components/schemas/IncidentIntegrationMetadataResponseIncludedItem' + readOnly: true + type: array + meta: + $ref: '#/components/schemas/IncidentResponseMeta' + required: + - data + type: object + IncidentIntegrationMetadataMetadata: + description: Incident integration metadata's metadata attribute. + oneOf: + - $ref: '#/components/schemas/SlackIntegrationMetadata' + - $ref: '#/components/schemas/JiraIntegrationMetadata' + type: object + IncidentIntegrationMetadataPatchData: + description: Incident integration metadata data for a patch request. + properties: + attributes: + $ref: '#/components/schemas/IncidentIntegrationMetadataAttributes' + type: + $ref: '#/components/schemas/IncidentIntegrationMetadataType' + required: + - type + - attributes + type: object + IncidentIntegrationMetadataPatchRequest: + description: Patch request for an incident integration metadata. + properties: + data: + $ref: '#/components/schemas/IncidentIntegrationMetadataPatchData' + required: + - data + type: object + IncidentIntegrationMetadataResponse: + description: Response with an incident integration metadata. + properties: + data: + $ref: '#/components/schemas/IncidentIntegrationMetadataResponseData' + included: + description: Included related resources that the user requested. + items: + $ref: '#/components/schemas/IncidentIntegrationMetadataResponseIncludedItem' + readOnly: true + type: array + required: + - data + type: object + IncidentIntegrationMetadataResponseData: + description: Incident integration metadata from a response. + properties: + attributes: + $ref: '#/components/schemas/IncidentIntegrationMetadataAttributes' + id: + description: The incident integration metadata's ID. + example: 00000000-0000-0000-1234-000000000000 + type: string + type: + $ref: '#/components/schemas/IncidentIntegrationMetadataType' + required: + - id + - type + type: object + IncidentIntegrationMetadataResponseIncludedItem: + description: An object related to an incident integration metadata that is included + in the response. + oneOf: + - $ref: '#/components/schemas/User' + type: object IncidentIntegrationMetadataType: default: incident_integrations description: Integration metadata resource type. @@ -5201,7 +5339,7 @@ components: attributes: $ref: '#/components/schemas/IncidentUpdateAttributes' id: - description: The team's ID. + description: The incident's ID. example: 00000000-0000-0000-4567-000000000000 type: string relationships: @@ -5348,6 +5486,45 @@ components: type: string type: array type: object + JiraIntegrationMetadata: + description: Incident integration metadata for the Jira integration. + properties: + issues: + description: Array of Jira issues in this integration metadata. + example: [] + items: + $ref: '#/components/schemas/JiraIntegrationMetadataIssuesItem' + type: array + required: + - issues + type: object + JiraIntegrationMetadataIssuesItem: + description: Item in the Jira integration metadata issue array. + properties: + account: + description: URL of issue's Jira account. + example: https://example.atlassian.net + type: string + issue_key: + description: Jira issue's issue key. + example: PROJ-123 + type: string + issuetype_id: + description: Jira issue's issue type. + example: '1000' + type: string + project_key: + description: Jira issue's project keys. + example: PROJ + type: string + redirect_url: + description: URL redirecting to the Jira issue. + example: https://example.atlassian.net/browse/PROJ-123 + type: string + required: + - project_key + - account + type: object ListApplicationKeysResponse: description: Response for a list of application keys. properties: @@ -8965,7 +9142,7 @@ components: type: incident_integrations properties: data: - description: The integration metadata relationship array + description: Integration metadata relationship array example: - id: 00000000-abcd-0003-0000-000000000000 type: incident_integrations @@ -12131,6 +12308,42 @@ components: $ref: '#/components/schemas/ServiceDefinitionData' type: array type: object + SlackIntegrationMetadata: + description: Incident integration metadata for the Slack integration. + properties: + channels: + description: Array of Slack channels in this integration metadata. + example: [] + items: + $ref: '#/components/schemas/SlackIntegrationMetadataChannelItem' + type: array + required: + - channels + type: object + SlackIntegrationMetadataChannelItem: + description: Item in the Slack integration metadata channel array. + properties: + channel_id: + description: Slack channel ID. + example: C0123456789 + type: string + channel_name: + description: Name of the Slack channel. + example: '#example-channel-name' + type: string + redirect_url: + description: URL redirecting to the Slack channel. + example: https://slack.com/app_redirect?channel=C0123456789&team=T01234567 + type: string + team_id: + description: Slack team ID. + example: T01234567 + type: string + required: + - channel_id + - channel_name + - redirect_url + type: object TagsEventAttribute: description: Array of tags associated with your event. example: @@ -14477,6 +14690,189 @@ paths: x-unstable: '**Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/incidents/{incident_id}/relationships/integrations: + get: + description: Get all integration metadata for an incident. + operationId: ListIncidentIntegrations + parameters: + - $ref: '#/components/parameters/IncidentIDPathParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentIntegrationMetadataListResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_read + summary: Get a list of an incident's integration metadata + tags: + - Incidents + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Create an incident integration metadata. + operationId: CreateIncidentIntegration + parameters: + - $ref: '#/components/parameters/IncidentIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentIntegrationMetadataCreateRequest' + description: Incident integration metadata payload. + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentIntegrationMetadataResponse' + description: CREATED + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Create an incident integration metadata + tags: + - Incidents + x-codegen-request-body-name: body + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}: + delete: + description: Delete an incident integration metadata. + operationId: DeleteIncidentIntegration + parameters: + - $ref: '#/components/parameters/IncidentIDPathParameter' + - $ref: '#/components/parameters/IncidentIntegrationMetadataIDPathParameter' + responses: + '204': + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Delete an incident integration metadata + tags: + - Incidents + x-codegen-request-body-name: body + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Get incident integration metadata details. + operationId: GetIncidentIntegration + parameters: + - $ref: '#/components/parameters/IncidentIDPathParameter' + - $ref: '#/components/parameters/IncidentIntegrationMetadataIDPathParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentIntegrationMetadataResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_read + summary: Get incident integration metadata details + tags: + - Incidents + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + patch: + description: Update an existing incident integration metadata. + operationId: UpdateIncidentIntegration + parameters: + - $ref: '#/components/parameters/IncidentIDPathParameter' + - $ref: '#/components/parameters/IncidentIntegrationMetadataIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentIntegrationMetadataPatchRequest' + description: Incident integration metadata payload. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentIntegrationMetadataResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_write + summary: Update an existing incident integration metadata + tags: + - Incidents + x-codegen-request-body-name: body + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/integration/opsgenie/services: get: description: Get a list of all services from the Datadog Opsgenie integration. diff --git a/cassettes/features/v2/incidents/Create-an-incident-integration-metadata-returns-CREATED-response.frozen b/cassettes/features/v2/incidents/Create-an-incident-integration-metadata-returns-CREATED-response.frozen new file mode 100644 index 000000000000..51810a54c9b1 --- /dev/null +++ b/cassettes/features/v2/incidents/Create-an-incident-integration-metadata-returns-CREATED-response.frozen @@ -0,0 +1 @@ +2023-03-02T08:30:38.031Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Create-an-incident-integration-metadata-returns-CREATED-response.yml b/cassettes/features/v2/incidents/Create-an-incident-integration-metadata-returns-CREATED-response.yml new file mode 100644 index 000000000000..a0f7fb5113cd --- /dev/null +++ b/cassettes/features/v2/incidents/Create-an-incident-integration-metadata-returns-CREATED-response.yml @@ -0,0 +1,86 @@ +http_interactions: +- recorded_at: Thu, 02 Mar 2023 08:30:38 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-Create_an_incident_integration_metadata_returns_CREATED_response-1677745838"},"type":"incidents"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"incidents","id":"c1c3c52e-a1a6-52b3-9dcd-65d04496033f","attributes":{"public_id":124034,"title":"Test-Create_an_incident_integration_metadata_returns_CREATED_response-1677745838","resolved":null,"customer_impact_scope":null,"customer_impact_start":null,"customer_impact_end":null,"customer_impacted":false,"notification_handles":null,"last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"last_modified_by_uuid":null,"created":"2023-03-02T08:30:38.468135+00:00","modified":"2023-03-02T08:30:38.468135+00:00","commander":null,"detected":"2023-03-02T08:30:38.458636+00:00","created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"created_by_uuid":null,"creation_idempotency_key":null,"customer_impact_duration":0,"time_to_detect":0,"time_to_repair":0,"time_to_internal_response":0,"time_to_resolve":0,"fields":{"severity":{"type":"dropdown","value":"UNKNOWN"},"state":{"type":"dropdown","value":"active"},"root_cause":{"type":"textbox","value":null},"detection_method":{"type":"dropdown","value":"unknown"},"services":{"type":"autocomplete","value":null},"teams":{"type":"autocomplete","value":null},"summary":{"type":"textbox","value":null}},"field_analytics":null,"severity":"UNKNOWN","state":"active","non_datadog_creator":null,"visibility":"organization","case_id":null},"relationships":{"created_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"last_modified_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"commander_user":{"data":null},"user_defined_fields":{"data":[{"type":"user_defined_field","id":"ad2b9456-eaec-5bbd-9bae-e502d74e23f8"},{"type":"user_defined_field","id":"299616f7-8acd-5403-886b-991656d6b982"},{"type":"user_defined_field","id":"4148ead2-da45-548e-b6be-8e319bafc425"},{"type":"user_defined_field","id":"66b62f59-48f6-5fee-969a-0886b1db6dcd"},{"type":"user_defined_field","id":"d8a54f16-8b2a-5ab4-87b8-5f0fa575c83e"},{"type":"user_defined_field","id":"623af0a5-f30c-577e-8146-09b8324bdb2d"},{"type":"user_defined_field","id":"ccfc9e6c-f586-58e5-b502-03c466c72e6f"}]},"integrations":{"data":[]},"attachments":{"data":[]},"responders":{"data":[]},"impacts":{"data":[]}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Thu, 02 Mar 2023 08:30:38 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"incident_id":"c1c3c52e-a1a6-52b3-9dcd-65d04496033f","integration_type":1,"metadata":{"channels":[{"channel_id":"C0123456789","channel_name":"#new-channel","redirect_url":"https://slack.com/app_redirect?channel=C0123456789&team=T01234567","team_id":"T01234567"}]}},"type":"incident_integrations"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/c1c3c52e-a1a6-52b3-9dcd-65d04496033f/relationships/integrations + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"incident_integrations","id":"b841d498-4840-5388-98af-9f6cc30307f1","attributes":{"created":"2023-03-02T08:30:39.110755+00:00","modified":"2023-03-02T08:30:39.110755+00:00","created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"created_by_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","incident_id":"c1c3c52e-a1a6-52b3-9dcd-65d04496033f","last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"last_modified_by_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","status":3,"integration_type":1,"metadata":{"channels":[{"channel_id":"C0123456789","channel_name":"#new-channel","redirect_url":"https://slack.com/app_redirect?channel=C0123456789&team=T01234567","team_id":"T01234567"}]}},"relationships":{"created_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"last_modified_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Thu, 02 Mar 2023 08:30:38 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/c1c3c52e-a1a6-52b3-9dcd-65d04496033f/relationships/integrations/b841d498-4840-5388-98af-9f6cc30307f1 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +- recorded_at: Thu, 02 Mar 2023 08:30:38 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/c1c3c52e-a1a6-52b3-9dcd-65d04496033f + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Delete-an-incident-integration-metadata-returns-OK-response.frozen b/cassettes/features/v2/incidents/Delete-an-incident-integration-metadata-returns-OK-response.frozen new file mode 100644 index 000000000000..56155f272fcf --- /dev/null +++ b/cassettes/features/v2/incidents/Delete-an-incident-integration-metadata-returns-OK-response.frozen @@ -0,0 +1 @@ +2023-02-24T19:28:01.343Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Delete-an-incident-integration-metadata-returns-OK-response.yml b/cassettes/features/v2/incidents/Delete-an-incident-integration-metadata-returns-OK-response.yml new file mode 100644 index 000000000000..f956a75ebf58 --- /dev/null +++ b/cassettes/features/v2/incidents/Delete-an-incident-integration-metadata-returns-OK-response.yml @@ -0,0 +1,104 @@ +http_interactions: +- recorded_at: Fri, 24 Feb 2023 19:28:01 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-Delete_an_incident_integration_metadata_returns_OK_response-1677266881"},"type":"incidents"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"incidents","id":"312a9af4-0bed-524e-9243-a9de9492506a","attributes":{"public_id":123329,"title":"Test-Delete_an_incident_integration_metadata_returns_OK_response-1677266881","resolved":null,"customer_impact_scope":null,"customer_impact_start":null,"customer_impact_end":null,"customer_impacted":false,"notification_handles":null,"last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"last_modified_by_uuid":null,"created":"2023-02-24T19:28:01.563619+00:00","modified":"2023-02-24T19:28:01.563619+00:00","commander":null,"detected":"2023-02-24T19:28:01.554591+00:00","created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"created_by_uuid":null,"creation_idempotency_key":null,"customer_impact_duration":0,"time_to_detect":0,"time_to_repair":0,"time_to_internal_response":0,"time_to_resolve":0,"fields":{"severity":{"type":"dropdown","value":"UNKNOWN"},"state":{"type":"dropdown","value":"active"},"root_cause":{"type":"textbox","value":null},"detection_method":{"type":"dropdown","value":"unknown"},"services":{"type":"autocomplete","value":null},"teams":{"type":"autocomplete","value":null},"summary":{"type":"textbox","value":null}},"field_analytics":null,"severity":"UNKNOWN","state":"active","non_datadog_creator":null,"visibility":"organization","case_id":null},"relationships":{"created_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"last_modified_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"commander_user":{"data":null},"user_defined_fields":{"data":[{"type":"user_defined_field","id":"ad2b9456-eaec-5bbd-9bae-e502d74e23f8"},{"type":"user_defined_field","id":"299616f7-8acd-5403-886b-991656d6b982"},{"type":"user_defined_field","id":"4148ead2-da45-548e-b6be-8e319bafc425"},{"type":"user_defined_field","id":"66b62f59-48f6-5fee-969a-0886b1db6dcd"},{"type":"user_defined_field","id":"d8a54f16-8b2a-5ab4-87b8-5f0fa575c83e"},{"type":"user_defined_field","id":"623af0a5-f30c-577e-8146-09b8324bdb2d"},{"type":"user_defined_field","id":"ccfc9e6c-f586-58e5-b502-03c466c72e6f"}]},"integrations":{"data":[]},"attachments":{"data":[]},"responders":{"data":[]},"impacts":{"data":[]}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Fri, 24 Feb 2023 19:28:01 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"incident_id":"312a9af4-0bed-524e-9243-a9de9492506a","integration_type":1,"metadata":{"channels":[{"channel_id":"C0123456789","channel_name":"#example-channel-name","redirect_url":"https://slack.com/app_redirect?channel=C0123456789&team=T01234567","team_id":"T01234567"}]},"status":2},"type":"incident_integrations"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/312a9af4-0bed-524e-9243-a9de9492506a/relationships/integrations + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"incident_integrations","id":"74bd2fb0-e385-5564-85db-7d8de4966f36","attributes":{"created":"2023-02-24T19:28:01.991274+00:00","modified":"2023-02-24T19:28:01.991274+00:00","created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"created_by_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","incident_id":"312a9af4-0bed-524e-9243-a9de9492506a","last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"last_modified_by_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","status":3,"integration_type":1,"metadata":{"channels":[{"channel_id":"C0123456789","channel_name":"#example-channel-name","redirect_url":"https://slack.com/app_redirect?channel=C0123456789&team=T01234567","team_id":"T01234567"}]}},"relationships":{"created_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"last_modified_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Fri, 24 Feb 2023 19:28:01 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/312a9af4-0bed-524e-9243-a9de9492506a/relationships/integrations/74bd2fb0-e385-5564-85db-7d8de4966f36 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +- recorded_at: Fri, 24 Feb 2023 19:28:01 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/312a9af4-0bed-524e-9243-a9de9492506a/relationships/integrations/74bd2fb0-e385-5564-85db-7d8de4966f36 + response: + body: + encoding: UTF-8 + string: '{"errors":["74bd2fb0-e385-5564-85db-7d8de4966f36 not found"]}' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +- recorded_at: Fri, 24 Feb 2023 19:28:01 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/312a9af4-0bed-524e-9243-a9de9492506a + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Get-a-list-of-an-incident-s-integration-metadata-returns-OK-response.frozen b/cassettes/features/v2/incidents/Get-a-list-of-an-incident-s-integration-metadata-returns-OK-response.frozen new file mode 100644 index 000000000000..c443743357af --- /dev/null +++ b/cassettes/features/v2/incidents/Get-a-list-of-an-incident-s-integration-metadata-returns-OK-response.frozen @@ -0,0 +1 @@ +2023-02-28T08:31:00.439Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Get-a-list-of-an-incident-s-integration-metadata-returns-OK-response.yml b/cassettes/features/v2/incidents/Get-a-list-of-an-incident-s-integration-metadata-returns-OK-response.yml new file mode 100644 index 000000000000..5b3a39d11e36 --- /dev/null +++ b/cassettes/features/v2/incidents/Get-a-list-of-an-incident-s-integration-metadata-returns-OK-response.yml @@ -0,0 +1,106 @@ +http_interactions: +- recorded_at: Tue, 28 Feb 2023 08:31:00 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-Get_a_list_of_an_incident_s_integration_metadata_returns_OK_response-1677573060"},"type":"incidents"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"incidents","id":"ef6f2ac8-25ee-5771-903c-8fbea1b0ff8a","attributes":{"public_id":123751,"title":"Test-Get_a_list_of_an_incident_s_integration_metadata_returns_OK_response-1677573060","resolved":null,"customer_impact_scope":null,"customer_impact_start":null,"customer_impact_end":null,"customer_impacted":false,"notification_handles":null,"last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"last_modified_by_uuid":null,"created":"2023-02-28T08:31:00.888846+00:00","modified":"2023-02-28T08:31:00.888846+00:00","commander":null,"detected":"2023-02-28T08:31:00.879554+00:00","created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"created_by_uuid":null,"creation_idempotency_key":null,"customer_impact_duration":0,"time_to_detect":0,"time_to_repair":0,"time_to_internal_response":0,"time_to_resolve":0,"fields":{"severity":{"type":"dropdown","value":"UNKNOWN"},"state":{"type":"dropdown","value":"active"},"root_cause":{"type":"textbox","value":null},"detection_method":{"type":"dropdown","value":"unknown"},"services":{"type":"autocomplete","value":null},"teams":{"type":"autocomplete","value":null},"summary":{"type":"textbox","value":null}},"field_analytics":null,"severity":"UNKNOWN","state":"active","non_datadog_creator":null,"visibility":"organization","case_id":null},"relationships":{"created_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"last_modified_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"commander_user":{"data":null},"user_defined_fields":{"data":[{"type":"user_defined_field","id":"ad2b9456-eaec-5bbd-9bae-e502d74e23f8"},{"type":"user_defined_field","id":"299616f7-8acd-5403-886b-991656d6b982"},{"type":"user_defined_field","id":"4148ead2-da45-548e-b6be-8e319bafc425"},{"type":"user_defined_field","id":"66b62f59-48f6-5fee-969a-0886b1db6dcd"},{"type":"user_defined_field","id":"d8a54f16-8b2a-5ab4-87b8-5f0fa575c83e"},{"type":"user_defined_field","id":"623af0a5-f30c-577e-8146-09b8324bdb2d"},{"type":"user_defined_field","id":"ccfc9e6c-f586-58e5-b502-03c466c72e6f"}]},"integrations":{"data":[]},"attachments":{"data":[]},"responders":{"data":[]},"impacts":{"data":[]}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Tue, 28 Feb 2023 08:31:00 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"incident_id":"ef6f2ac8-25ee-5771-903c-8fbea1b0ff8a","integration_type":1,"metadata":{"channels":[{"channel_id":"C0123456789","channel_name":"#example-channel-name","redirect_url":"https://slack.com/app_redirect?channel=C0123456789&team=T01234567","team_id":"T01234567"}]},"status":2},"type":"incident_integrations"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/ef6f2ac8-25ee-5771-903c-8fbea1b0ff8a/relationships/integrations + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"incident_integrations","id":"52ba8c74-a1c2-56ef-8c72-8ea578719072","attributes":{"created":"2023-02-28T08:31:01.472130+00:00","modified":"2023-02-28T08:31:01.472130+00:00","created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"created_by_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","incident_id":"ef6f2ac8-25ee-5771-903c-8fbea1b0ff8a","last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"last_modified_by_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","status":3,"integration_type":1,"metadata":{"channels":[{"channel_id":"C0123456789","channel_name":"#example-channel-name","redirect_url":"https://slack.com/app_redirect?channel=C0123456789&team=T01234567","team_id":"T01234567"}]}},"relationships":{"created_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"last_modified_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Tue, 28 Feb 2023 08:31:00 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/incidents/ef6f2ac8-25ee-5771-903c-8fbea1b0ff8a/relationships/integrations + response: + body: + encoding: UTF-8 + string: '{"data":[{"type":"incident_integrations","id":"52ba8c74-a1c2-56ef-8c72-8ea578719072","attributes":{"created":"2023-02-28T08:31:01.472130+00:00","modified":"2023-02-28T08:31:01.472130+00:00","created_by_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","incident_id":"ef6f2ac8-25ee-5771-903c-8fbea1b0ff8a","last_modified_by_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","status":3,"integration_type":1,"metadata":{"channels":[{"team_id":"T01234567","channel_id":"C0123456789","channel_name":"#example-channel-name","redirect_url":"https://slack.com/app_redirect?channel=C0123456789&team=T01234567"}]}},"relationships":{"created_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"last_modified_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}],"meta":{"pagination":{"offset":0,"next_offset":1,"size":1}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Tue, 28 Feb 2023 08:31:00 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/ef6f2ac8-25ee-5771-903c-8fbea1b0ff8a/relationships/integrations/52ba8c74-a1c2-56ef-8c72-8ea578719072 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +- recorded_at: Tue, 28 Feb 2023 08:31:00 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/ef6f2ac8-25ee-5771-903c-8fbea1b0ff8a + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Get-incident-integration-metadata-details-returns-OK-response.frozen b/cassettes/features/v2/incidents/Get-incident-integration-metadata-details-returns-OK-response.frozen new file mode 100644 index 000000000000..5f7c73fad68e --- /dev/null +++ b/cassettes/features/v2/incidents/Get-incident-integration-metadata-details-returns-OK-response.frozen @@ -0,0 +1 @@ +2023-02-24T19:28:03.052Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Get-incident-integration-metadata-details-returns-OK-response.yml b/cassettes/features/v2/incidents/Get-incident-integration-metadata-details-returns-OK-response.yml new file mode 100644 index 000000000000..770606dabde2 --- /dev/null +++ b/cassettes/features/v2/incidents/Get-incident-integration-metadata-details-returns-OK-response.yml @@ -0,0 +1,106 @@ +http_interactions: +- recorded_at: Fri, 24 Feb 2023 19:28:03 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-Get_incident_integration_metadata_details_returns_OK_response-1677266883"},"type":"incidents"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"incidents","id":"57400630-f287-5c30-8cb8-0ecabb3d44b9","attributes":{"public_id":123330,"title":"Test-Get_incident_integration_metadata_details_returns_OK_response-1677266883","resolved":null,"customer_impact_scope":null,"customer_impact_start":null,"customer_impact_end":null,"customer_impacted":false,"notification_handles":null,"last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"last_modified_by_uuid":null,"created":"2023-02-24T19:28:03.236100+00:00","modified":"2023-02-24T19:28:03.236100+00:00","commander":null,"detected":"2023-02-24T19:28:03.228113+00:00","created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"created_by_uuid":null,"creation_idempotency_key":null,"customer_impact_duration":0,"time_to_detect":0,"time_to_repair":0,"time_to_internal_response":0,"time_to_resolve":0,"fields":{"severity":{"type":"dropdown","value":"UNKNOWN"},"state":{"type":"dropdown","value":"active"},"root_cause":{"type":"textbox","value":null},"detection_method":{"type":"dropdown","value":"unknown"},"services":{"type":"autocomplete","value":null},"teams":{"type":"autocomplete","value":null},"summary":{"type":"textbox","value":null}},"field_analytics":null,"severity":"UNKNOWN","state":"active","non_datadog_creator":null,"visibility":"organization","case_id":null},"relationships":{"created_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"last_modified_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"commander_user":{"data":null},"user_defined_fields":{"data":[{"type":"user_defined_field","id":"ad2b9456-eaec-5bbd-9bae-e502d74e23f8"},{"type":"user_defined_field","id":"299616f7-8acd-5403-886b-991656d6b982"},{"type":"user_defined_field","id":"4148ead2-da45-548e-b6be-8e319bafc425"},{"type":"user_defined_field","id":"66b62f59-48f6-5fee-969a-0886b1db6dcd"},{"type":"user_defined_field","id":"d8a54f16-8b2a-5ab4-87b8-5f0fa575c83e"},{"type":"user_defined_field","id":"623af0a5-f30c-577e-8146-09b8324bdb2d"},{"type":"user_defined_field","id":"ccfc9e6c-f586-58e5-b502-03c466c72e6f"}]},"integrations":{"data":[]},"attachments":{"data":[]},"responders":{"data":[]},"impacts":{"data":[]}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Fri, 24 Feb 2023 19:28:03 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"incident_id":"57400630-f287-5c30-8cb8-0ecabb3d44b9","integration_type":1,"metadata":{"channels":[{"channel_id":"C0123456789","channel_name":"#example-channel-name","redirect_url":"https://slack.com/app_redirect?channel=C0123456789&team=T01234567","team_id":"T01234567"}]},"status":2},"type":"incident_integrations"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/57400630-f287-5c30-8cb8-0ecabb3d44b9/relationships/integrations + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"incident_integrations","id":"6e654fe0-d3db-56c9-937c-861a9f9ce19e","attributes":{"created":"2023-02-24T19:28:03.731346+00:00","modified":"2023-02-24T19:28:03.731346+00:00","created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"created_by_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","incident_id":"57400630-f287-5c30-8cb8-0ecabb3d44b9","last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"last_modified_by_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","status":3,"integration_type":1,"metadata":{"channels":[{"channel_id":"C0123456789","channel_name":"#example-channel-name","redirect_url":"https://slack.com/app_redirect?channel=C0123456789&team=T01234567","team_id":"T01234567"}]}},"relationships":{"created_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"last_modified_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Fri, 24 Feb 2023 19:28:03 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/incidents/57400630-f287-5c30-8cb8-0ecabb3d44b9/relationships/integrations/6e654fe0-d3db-56c9-937c-861a9f9ce19e + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"incident_integrations","id":"6e654fe0-d3db-56c9-937c-861a9f9ce19e","attributes":{"created":"2023-02-24T19:28:03.731346+00:00","modified":"2023-02-24T19:28:03.731346+00:00","created_by_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","incident_id":"57400630-f287-5c30-8cb8-0ecabb3d44b9","last_modified_by_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","status":3,"integration_type":1,"metadata":{"channels":[{"team_id":"T01234567","channel_id":"C0123456789","channel_name":"#example-channel-name","redirect_url":"https://slack.com/app_redirect?channel=C0123456789&team=T01234567"}]}},"relationships":{"created_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"last_modified_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Fri, 24 Feb 2023 19:28:03 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/57400630-f287-5c30-8cb8-0ecabb3d44b9/relationships/integrations/6e654fe0-d3db-56c9-937c-861a9f9ce19e + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +- recorded_at: Fri, 24 Feb 2023 19:28:03 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/57400630-f287-5c30-8cb8-0ecabb3d44b9 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Update-an-existing-incident-integration-metadata-returns-OK-response.frozen b/cassettes/features/v2/incidents/Update-an-existing-incident-integration-metadata-returns-OK-response.frozen new file mode 100644 index 000000000000..b5b717cfa768 --- /dev/null +++ b/cassettes/features/v2/incidents/Update-an-existing-incident-integration-metadata-returns-OK-response.frozen @@ -0,0 +1 @@ +2023-03-02T08:30:18.771Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Update-an-existing-incident-integration-metadata-returns-OK-response.yml b/cassettes/features/v2/incidents/Update-an-existing-incident-integration-metadata-returns-OK-response.yml new file mode 100644 index 000000000000..ec6fcd52325d --- /dev/null +++ b/cassettes/features/v2/incidents/Update-an-existing-incident-integration-metadata-returns-OK-response.yml @@ -0,0 +1,110 @@ +http_interactions: +- recorded_at: Thu, 02 Mar 2023 08:30:18 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"customer_impacted":false,"title":"Test-Update_an_existing_incident_integration_metadata_returns_OK_response-1677745818"},"type":"incidents"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"incidents","id":"3291404a-284f-5ef5-b012-16aa4bcbb677","attributes":{"public_id":124033,"title":"Test-Update_an_existing_incident_integration_metadata_returns_OK_response-1677745818","resolved":null,"customer_impact_scope":null,"customer_impact_start":null,"customer_impact_end":null,"customer_impacted":false,"notification_handles":null,"last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"last_modified_by_uuid":null,"created":"2023-03-02T08:30:19.354738+00:00","modified":"2023-03-02T08:30:19.354738+00:00","commander":null,"detected":"2023-03-02T08:30:19.344778+00:00","created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"created_by_uuid":null,"creation_idempotency_key":null,"customer_impact_duration":0,"time_to_detect":0,"time_to_repair":0,"time_to_internal_response":0,"time_to_resolve":0,"fields":{"severity":{"type":"dropdown","value":"UNKNOWN"},"state":{"type":"dropdown","value":"active"},"root_cause":{"type":"textbox","value":null},"detection_method":{"type":"dropdown","value":"unknown"},"services":{"type":"autocomplete","value":null},"teams":{"type":"autocomplete","value":null},"summary":{"type":"textbox","value":null}},"field_analytics":null,"severity":"UNKNOWN","state":"active","non_datadog_creator":null,"visibility":"organization","case_id":null},"relationships":{"created_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"last_modified_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"commander_user":{"data":null},"user_defined_fields":{"data":[{"type":"user_defined_field","id":"ad2b9456-eaec-5bbd-9bae-e502d74e23f8"},{"type":"user_defined_field","id":"299616f7-8acd-5403-886b-991656d6b982"},{"type":"user_defined_field","id":"4148ead2-da45-548e-b6be-8e319bafc425"},{"type":"user_defined_field","id":"66b62f59-48f6-5fee-969a-0886b1db6dcd"},{"type":"user_defined_field","id":"d8a54f16-8b2a-5ab4-87b8-5f0fa575c83e"},{"type":"user_defined_field","id":"623af0a5-f30c-577e-8146-09b8324bdb2d"},{"type":"user_defined_field","id":"ccfc9e6c-f586-58e5-b502-03c466c72e6f"}]},"integrations":{"data":[]},"attachments":{"data":[]},"responders":{"data":[]},"impacts":{"data":[]}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Thu, 02 Mar 2023 08:30:18 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"incident_id":"3291404a-284f-5ef5-b012-16aa4bcbb677","integration_type":1,"metadata":{"channels":[{"channel_id":"C0123456789","channel_name":"#example-channel-name","redirect_url":"https://slack.com/app_redirect?channel=C0123456789&team=T01234567","team_id":"T01234567"}]},"status":2},"type":"incident_integrations"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/3291404a-284f-5ef5-b012-16aa4bcbb677/relationships/integrations + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"incident_integrations","id":"7c127cf5-9381-5a41-a83d-4b0190c8cd6a","attributes":{"created":"2023-03-02T08:30:20.051847+00:00","modified":"2023-03-02T08:30:20.051847+00:00","created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"created_by_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","incident_id":"3291404a-284f-5ef5-b012-16aa4bcbb677","last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"last_modified_by_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","status":3,"integration_type":1,"metadata":{"channels":[{"channel_id":"C0123456789","channel_name":"#example-channel-name","redirect_url":"https://slack.com/app_redirect?channel=C0123456789&team=T01234567","team_id":"T01234567"}]}},"relationships":{"created_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"last_modified_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 201 + message: Created +- recorded_at: Thu, 02 Mar 2023 08:30:18 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"incident_id":"3291404a-284f-5ef5-b012-16aa4bcbb677","integration_type":1,"metadata":{"channels":[{"channel_id":"C0123456789","channel_name":"#updated-channel-name","redirect_url":"https://slack.com/app_redirect?channel=C0123456789&team=T01234567","team_id":"T01234567"}]}},"type":"incident_integrations"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/incidents/3291404a-284f-5ef5-b012-16aa4bcbb677/relationships/integrations/7c127cf5-9381-5a41-a83d-4b0190c8cd6a + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"incident_integrations","id":"7c127cf5-9381-5a41-a83d-4b0190c8cd6a","attributes":{"created":"2023-03-02T08:30:20.051847+00:00","modified":"2023-03-02T08:30:20.597056+00:00","created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"created_by_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","incident_id":"3291404a-284f-5ef5-b012-16aa4bcbb677","last_modified_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","handle":"frog@datadoghq.com","email":"frog@datadoghq.com","name":null,"icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro"}}},"last_modified_by_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","status":4,"integration_type":1,"metadata":{"channels":[{"channel_id":"C0123456789","channel_name":"#updated-channel-name","redirect_url":"https://slack.com/app_redirect?channel=C0123456789&team=T01234567","team_id":"T01234567"}]}},"relationships":{"created_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"last_modified_by_user":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 02 Mar 2023 08:30:18 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/3291404a-284f-5ef5-b012-16aa4bcbb677/relationships/integrations/7c127cf5-9381-5a41-a83d-4b0190c8cd6a + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +- recorded_at: Thu, 02 Mar 2023 08:30:18 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/3291404a-284f-5ef5-b012-16aa4bcbb677 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/examples/v2/incidents/CreateIncidentIntegration.rb b/examples/v2/incidents/CreateIncidentIntegration.rb new file mode 100644 index 000000000000..531b30b150fe --- /dev/null +++ b/examples/v2/incidents/CreateIncidentIntegration.rb @@ -0,0 +1,31 @@ +# Create an incident integration metadata returns "CREATED" response + +require "datadog_api_client" +DatadogAPIClient::V2.configure do |config| + config.unstable_operations["v2.create_incident_integration".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +# there is a valid "incident" in the system +INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"] + +body = DatadogAPIClient::V2::IncidentIntegrationMetadataCreateRequest.new({ + data: DatadogAPIClient::V2::IncidentIntegrationMetadataCreateData.new({ + attributes: DatadogAPIClient::V2::IncidentIntegrationMetadataAttributes.new({ + incident_id: INCIDENT_DATA_ID, + integration_type: 1, + metadata: DatadogAPIClient::V2::SlackIntegrationMetadata.new({ + channels: [ + DatadogAPIClient::V2::SlackIntegrationMetadataChannelItem.new({ + channel_id: "C0123456789", + channel_name: "#new-channel", + team_id: "T01234567", + redirect_url: "https://slack.com/app_redirect?channel=C0123456789&team=T01234567", + }), + ], + }), + }), + type: DatadogAPIClient::V2::IncidentIntegrationMetadataType::INCIDENT_INTEGRATIONS, + }), +}) +p api_instance.create_incident_integration(INCIDENT_DATA_ID, body) diff --git a/examples/v2/incidents/DeleteIncidentIntegration.rb b/examples/v2/incidents/DeleteIncidentIntegration.rb new file mode 100644 index 000000000000..a0e9492dd43b --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentIntegration.rb @@ -0,0 +1,14 @@ +# Delete an incident integration metadata returns "OK" response + +require "datadog_api_client" +DatadogAPIClient::V2.configure do |config| + config.unstable_operations["v2.delete_incident_integration".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +# there is a valid "incident" in the system +INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"] + +# the "incident" has an "incident_integration_metadata" +INCIDENT_INTEGRATION_METADATA_DATA_ID = ENV["INCIDENT_INTEGRATION_METADATA_DATA_ID"] +api_instance.delete_incident_integration(INCIDENT_DATA_ID, INCIDENT_INTEGRATION_METADATA_DATA_ID) diff --git a/examples/v2/incidents/GetIncidentIntegration.rb b/examples/v2/incidents/GetIncidentIntegration.rb new file mode 100644 index 000000000000..b744a1c1d08b --- /dev/null +++ b/examples/v2/incidents/GetIncidentIntegration.rb @@ -0,0 +1,14 @@ +# Get incident integration metadata details returns "OK" response + +require "datadog_api_client" +DatadogAPIClient::V2.configure do |config| + config.unstable_operations["v2.get_incident_integration".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +# there is a valid "incident" in the system +INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"] + +# the "incident" has an "incident_integration_metadata" +INCIDENT_INTEGRATION_METADATA_DATA_ID = ENV["INCIDENT_INTEGRATION_METADATA_DATA_ID"] +p api_instance.get_incident_integration(INCIDENT_DATA_ID, INCIDENT_INTEGRATION_METADATA_DATA_ID) diff --git a/examples/v2/incidents/ListIncidentIntegrations.rb b/examples/v2/incidents/ListIncidentIntegrations.rb new file mode 100644 index 000000000000..d5c1da7050bb --- /dev/null +++ b/examples/v2/incidents/ListIncidentIntegrations.rb @@ -0,0 +1,11 @@ +# Get a list of an incident's integration metadata returns "OK" response + +require "datadog_api_client" +DatadogAPIClient::V2.configure do |config| + config.unstable_operations["v2.list_incident_integrations".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +# there is a valid "incident" in the system +INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"] +p api_instance.list_incident_integrations(INCIDENT_DATA_ID) diff --git a/examples/v2/incidents/UpdateIncidentIntegration.rb b/examples/v2/incidents/UpdateIncidentIntegration.rb new file mode 100644 index 000000000000..77604fc189c0 --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentIntegration.rb @@ -0,0 +1,34 @@ +# Update an existing incident integration metadata returns "OK" response + +require "datadog_api_client" +DatadogAPIClient::V2.configure do |config| + config.unstable_operations["v2.update_incident_integration".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +# there is a valid "incident" in the system +INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"] + +# the "incident" has an "incident_integration_metadata" +INCIDENT_INTEGRATION_METADATA_DATA_ID = ENV["INCIDENT_INTEGRATION_METADATA_DATA_ID"] + +body = DatadogAPIClient::V2::IncidentIntegrationMetadataPatchRequest.new({ + data: DatadogAPIClient::V2::IncidentIntegrationMetadataPatchData.new({ + attributes: DatadogAPIClient::V2::IncidentIntegrationMetadataAttributes.new({ + incident_id: INCIDENT_DATA_ID, + integration_type: 1, + metadata: DatadogAPIClient::V2::SlackIntegrationMetadata.new({ + channels: [ + DatadogAPIClient::V2::SlackIntegrationMetadataChannelItem.new({ + channel_id: "C0123456789", + channel_name: "#updated-channel-name", + team_id: "T01234567", + redirect_url: "https://slack.com/app_redirect?channel=C0123456789&team=T01234567", + }), + ], + }), + }), + type: DatadogAPIClient::V2::IncidentIntegrationMetadataType::INCIDENT_INTEGRATIONS, + }), +}) +p api_instance.update_incident_integration(INCIDENT_DATA_ID, INCIDENT_INTEGRATION_METADATA_DATA_ID, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 7874f7c8dd8f..45da2c326d59 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -966,6 +966,26 @@ "include" => "Array", "body" => "IncidentAttachmentUpdateRequest", }, + "v2.ListIncidentIntegrations" => { + "incident_id" => "String", + }, + "v2.CreateIncidentIntegration" => { + "incident_id" => "String", + "body" => "IncidentIntegrationMetadataCreateRequest", + }, + "v2.DeleteIncidentIntegration" => { + "incident_id" => "String", + "integration_metadata_id" => "String", + }, + "v2.GetIncidentIntegration" => { + "incident_id" => "String", + "integration_metadata_id" => "String", + }, + "v2.UpdateIncidentIntegration" => { + "incident_id" => "String", + "integration_metadata_id" => "String", + "body" => "IncidentIntegrationMetadataPatchRequest", + }, "v2.CreateOpsgenieService" => { "body" => "OpsgenieServiceCreateRequest", }, diff --git a/features/v2/given.json b/features/v2/given.json index a15071102821..17620e9575e8 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -95,6 +95,22 @@ "tag": "Incidents", "operationId": "UpdateIncidentAttachments" }, + { + "parameters": [ + { + "name": "incident_id", + "source": "incident.data.id" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"integration_type\": 1,\n \"incident_id\": \"{{ incident.data.id }}\",\n \"status\": 2,\n \"metadata\": {\n \"channels\": [\n {\n \"channel_id\": \"C0123456789\",\n \"team_id\": \"T01234567\",\n \"channel_name\": \"#example-channel-name\",\n \"redirect_url\": \"https://slack.com/app_redirect?channel=C0123456789&team=T01234567\"\n }\n ]\n }\n },\n \"type\": \"incident_integrations\"\n }\n}" + } + ], + "step": "the \"incident\" has an \"incident_integration_metadata\"", + "key": "incident_integration_metadata", + "tag": "Incidents", + "operationId": "CreateIncidentIntegration" + }, { "parameters": [ { diff --git a/features/v2/incidents.feature b/features/v2/incidents.feature index 1b8b2ea8993c..5146d4643187 100644 --- a/features/v2/incidents.feature +++ b/features/v2/incidents.feature @@ -32,6 +32,37 @@ Feature: Incidents And the response "data[0].attributes.attachment_type" is equal to "link" And the response "data[0].attributes.attachment.documentUrl" is equal to "https://www.example.com/doc" + @generated @skip @team:DataDog/incident-app + Scenario: Create an incident integration metadata returns "Bad Request" response + Given operation "CreateIncidentIntegration" enabled + And new "CreateIncidentIntegration" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"incident_id": "00000000-aaaa-0000-0000-000000000000", "integration_type": 1, "metadata": {"channels": []}}, "type": "incident_integrations"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/incident-app + Scenario: Create an incident integration metadata returns "CREATED" response + Given operation "CreateIncidentIntegration" enabled + And new "CreateIncidentIntegration" request + And there is a valid "incident" in the system + And request contains "incident_id" parameter from "incident.data.id" + And body with value {"data": {"attributes": {"incident_id": "{{ incident.data.id }}", "integration_type": 1, "metadata": {"channels": [{"channel_id": "C0123456789", "channel_name": "#new-channel", "team_id": "T01234567", "redirect_url": "https://slack.com/app_redirect?channel=C0123456789&team=T01234567"}]}}, "type": "incident_integrations"}} + When the request is sent + Then the response status is 201 CREATED + And the response "data.type" is equal to "incident_integrations" + And the response "data.attributes.metadata.channels" has length 1 + And the response "data.attributes.metadata.channels[0].channel_name" is equal to "#new-channel" + + @generated @skip @team:DataDog/incident-app + Scenario: Create an incident integration metadata returns "Not Found" response + Given operation "CreateIncidentIntegration" enabled + And new "CreateIncidentIntegration" request + And request contains "incident_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"incident_id": "00000000-aaaa-0000-0000-000000000000", "integration_type": 1, "metadata": {"channels": []}}, "type": "incident_integrations"}} + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app Scenario: Create an incident returns "Bad Request" response Given operation "CreateIncident" enabled @@ -111,6 +142,62 @@ Feature: Incidents When the request is sent Then the response status is 204 OK + @generated @skip @team:DataDog/incident-app + Scenario: Delete an incident integration metadata returns "Bad Request" response + Given operation "DeleteIncidentIntegration" enabled + And new "DeleteIncidentIntegration" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "integration_metadata_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 integration metadata returns "Not Found" response + Given operation "DeleteIncidentIntegration" enabled + And new "DeleteIncidentIntegration" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "integration_metadata_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/incident-app + Scenario: Delete an incident integration metadata returns "OK" response + Given operation "DeleteIncidentIntegration" enabled + And new "DeleteIncidentIntegration" request + And there is a valid "incident" in the system + And request contains "incident_id" parameter from "incident.data.id" + And the "incident" has an "incident_integration_metadata" + And request contains "integration_metadata_id" parameter from "incident_integration_metadata.data.id" + When the request is sent + Then the response status is 204 OK + + @generated @skip @team:DataDog/incident-app + Scenario: Get a list of an incident's integration metadata returns "Bad Request" response + Given operation "ListIncidentIntegrations" enabled + And new "ListIncidentIntegrations" request + And request contains "incident_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 a list of an incident's integration metadata returns "Not Found" response + Given operation "ListIncidentIntegrations" enabled + And new "ListIncidentIntegrations" request + And request contains "incident_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/incident-app + Scenario: Get a list of an incident's integration metadata returns "OK" response + Given operation "ListIncidentIntegrations" enabled + And new "ListIncidentIntegrations" request + And there is a valid "incident" in the system + And request contains "incident_id" parameter from "incident.data.id" + And the "incident" has an "incident_integration_metadata" + When the request is sent + Then the response status is 200 OK + And the response "data[0].attributes.metadata.channels[0].channel_name" is equal to "#example-channel-name" + @generated @skip @team:DataDog/incident-app Scenario: Get a list of attachments returns "Bad Request" response Given operation "ListIncidentAttachments" enabled @@ -181,6 +268,35 @@ Feature: Incidents And the response "data[0].attributes.attachment_type" is equal to "link" And the response "data[0].attributes.attachment.documentUrl" is equal to "https://www.example.com/doc" + @generated @skip @team:DataDog/incident-app + Scenario: Get incident integration metadata details returns "Bad Request" response + Given operation "GetIncidentIntegration" enabled + And new "GetIncidentIntegration" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "integration_metadata_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 incident integration metadata details returns "Not Found" response + Given operation "GetIncidentIntegration" enabled + And new "GetIncidentIntegration" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "integration_metadata_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/incident-app + Scenario: Get incident integration metadata details returns "OK" response + Given operation "GetIncidentIntegration" enabled + And new "GetIncidentIntegration" request + And there is a valid "incident" in the system + And request contains "incident_id" parameter from "incident.data.id" + And the "incident" has an "incident_integration_metadata" + And request contains "integration_metadata_id" parameter from "incident_integration_metadata.data.id" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/incident-app Scenario: Get the details of an incident returns "Bad Request" response Given operation "GetIncident" enabled @@ -245,6 +361,39 @@ Feature: Incidents And the response "data.type" is equal to "incidents_search_results" And the response "data.attributes.incidents[0].data.type" is equal to "incidents" + @generated @skip @team:DataDog/incident-app + Scenario: Update an existing incident integration metadata returns "Bad Request" response + Given operation "UpdateIncidentIntegration" enabled + And new "UpdateIncidentIntegration" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "integration_metadata_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"incident_id": "00000000-aaaa-0000-0000-000000000000", "integration_type": 1, "metadata": {"channels": []}}, "type": "incident_integrations"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/incident-app + Scenario: Update an existing incident integration metadata returns "Not Found" response + Given operation "UpdateIncidentIntegration" enabled + And new "UpdateIncidentIntegration" request + And request contains "incident_id" parameter from "REPLACE.ME" + And request contains "integration_metadata_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"incident_id": "00000000-aaaa-0000-0000-000000000000", "integration_type": 1, "metadata": {"channels": []}}, "type": "incident_integrations"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/incident-app + Scenario: Update an existing incident integration metadata returns "OK" response + Given operation "UpdateIncidentIntegration" enabled + And new "UpdateIncidentIntegration" request + And there is a valid "incident" in the system + And request contains "incident_id" parameter from "incident.data.id" + And the "incident" has an "incident_integration_metadata" + And request contains "integration_metadata_id" parameter from "incident_integration_metadata.data.id" + And body with value {"data": {"attributes": {"incident_id": "{{ incident.data.id }}", "integration_type": 1, "metadata": {"channels": [{"channel_id": "C0123456789", "channel_name": "#updated-channel-name", "team_id": "T01234567", "redirect_url": "https://slack.com/app_redirect?channel=C0123456789&team=T01234567"}]}}, "type": "incident_integrations"}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.metadata.channels[0].channel_name" is equal to "#updated-channel-name" + @generated @skip @team:DataDog/incident-app Scenario: Update an existing incident returns "Bad Request" response Given operation "UpdateIncident" enabled diff --git a/features/v2/undo.json b/features/v2/undo.json index e4a5021518d4..2ae185f7f21b 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -273,6 +273,47 @@ "type": "idempotent" } }, + "ListIncidentIntegrations": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "CreateIncidentIntegration": { + "tag": "Incidents", + "undo": { + "operationId": "DeleteIncidentIntegration", + "parameters": [ + { + "name": "incident_id", + "source": "data.attributes.incident_id" + }, + { + "name": "integration_metadata_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteIncidentIntegration": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, + "GetIncidentIntegration": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "UpdateIncidentIntegration": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, "ListOpsgenieServices": { "tag": "Opsgenie Integration", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 079a30b24c18..a344beec6aa9 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -178,13 +178,18 @@ def initialize "v2.list_events": false, "v2.search_events": false, "v2.create_incident": false, + "v2.create_incident_integration": false, "v2.delete_incident": false, + "v2.delete_incident_integration": false, "v2.get_incident": false, + "v2.get_incident_integration": false, "v2.list_incident_attachments": false, + "v2.list_incident_integrations": false, "v2.list_incidents": false, "v2.search_incidents": false, "v2.update_incident": false, "v2.update_incident_attachments": false, + "v2.update_incident_integration": false, "v2.query_scalar_data": false, "v2.query_timeseries_data": false, "v2.create_incident_service": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 2814758400d9..e693c940bc5a 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1030,6 +1030,16 @@ def overrides "v2.incident_field_attributes_single_value" => "IncidentFieldAttributesSingleValue", "v2.incident_field_attributes_single_value_type" => "IncidentFieldAttributesSingleValueType", "v2.incident_field_attributes_value_type" => "IncidentFieldAttributesValueType", + "v2.incident_integration_metadata_attributes" => "IncidentIntegrationMetadataAttributes", + "v2.incident_integration_metadata_create_data" => "IncidentIntegrationMetadataCreateData", + "v2.incident_integration_metadata_create_request" => "IncidentIntegrationMetadataCreateRequest", + "v2.incident_integration_metadata_list_response" => "IncidentIntegrationMetadataListResponse", + "v2.incident_integration_metadata_metadata" => "IncidentIntegrationMetadataMetadata", + "v2.incident_integration_metadata_patch_data" => "IncidentIntegrationMetadataPatchData", + "v2.incident_integration_metadata_patch_request" => "IncidentIntegrationMetadataPatchRequest", + "v2.incident_integration_metadata_response" => "IncidentIntegrationMetadataResponse", + "v2.incident_integration_metadata_response_data" => "IncidentIntegrationMetadataResponseData", + "v2.incident_integration_metadata_response_included_item" => "IncidentIntegrationMetadataResponseIncludedItem", "v2.incident_integration_metadata_type" => "IncidentIntegrationMetadataType", "v2.incident_notification_handle" => "IncidentNotificationHandle", "v2.incident_postmortem_type" => "IncidentPostmortemType", @@ -1099,6 +1109,8 @@ def overrides "v2.ip_allowlist_response" => "IPAllowlistResponse", "v2.ip_allowlist_type" => "IPAllowlistType", "v2.ip_allowlist_update_request" => "IPAllowlistUpdateRequest", + "v2.jira_integration_metadata" => "JiraIntegrationMetadata", + "v2.jira_integration_metadata_issues_item" => "JiraIntegrationMetadataIssuesItem", "v2.list_application_keys_response" => "ListApplicationKeysResponse", "v2.log" => "Log", "v2.log_attributes" => "LogAttributes", @@ -1559,6 +1571,8 @@ def overrides "v2.service_definition_v2_slack" => "ServiceDefinitionV2Slack", "v2.service_definition_v2_slack_type" => "ServiceDefinitionV2SlackType", "v2.service_definition_v2_version" => "ServiceDefinitionV2Version", + "v2.slack_integration_metadata" => "SlackIntegrationMetadata", + "v2.slack_integration_metadata_channel_item" => "SlackIntegrationMetadataChannelItem", "v2.timeseries_formula_query_request" => "TimeseriesFormulaQueryRequest", "v2.timeseries_formula_query_response" => "TimeseriesFormulaQueryResponse", "v2.timeseries_formula_request" => "TimeseriesFormulaRequest", diff --git a/lib/datadog_api_client/v2/api/incidents_api.rb b/lib/datadog_api_client/v2/api/incidents_api.rb index e37364ce38e8..a15afabdb872 100644 --- a/lib/datadog_api_client/v2/api/incidents_api.rb +++ b/lib/datadog_api_client/v2/api/incidents_api.rb @@ -96,6 +96,84 @@ def create_incident_with_http_info(body, opts = {}) return data, status_code, headers end + # Create an incident integration metadata. + # + # @see #create_incident_integration_with_http_info + def create_incident_integration(incident_id, body, opts = {}) + data, _status_code, _headers = create_incident_integration_with_http_info(incident_id, body, opts) + data + end + + # Create an incident integration metadata. + # + # Create an incident integration metadata. + # + # @param incident_id [String] The UUID of the incident. + # @param body [IncidentIntegrationMetadataCreateRequest] Incident integration metadata payload. + # @param opts [Hash] the optional parameters + # @return [Array<(IncidentIntegrationMetadataResponse, Integer, Hash)>] IncidentIntegrationMetadataResponse data, response status code and response headers + def create_incident_integration_with_http_info(incident_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_incident_integration".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_incident_integration") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_incident_integration")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.create_incident_integration ...' + end + # verify the required parameter 'incident_id' is set + if @api_client.config.client_side_validation && incident_id.nil? + fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsAPI.create_incident_integration" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling IncidentsAPI.create_incident_integration" + end + # resource path + local_var_path = '/api/v2/incidents/{incident_id}/relationships/integrations'.sub('{incident_id}', CGI.escape(incident_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'IncidentIntegrationMetadataResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_incident_integration, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#create_incident_integration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete an existing incident. # # @see #delete_incident_with_http_info @@ -167,6 +245,82 @@ def delete_incident_with_http_info(incident_id, opts = {}) return data, status_code, headers end + # Delete an incident integration metadata. + # + # @see #delete_incident_integration_with_http_info + def delete_incident_integration(incident_id, integration_metadata_id, opts = {}) + delete_incident_integration_with_http_info(incident_id, integration_metadata_id, opts) + nil + end + + # Delete an incident integration metadata. + # + # Delete an incident integration metadata. + # + # @param incident_id [String] The UUID of the incident. + # @param integration_metadata_id [String] The UUID of the incident integration metadata. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_incident_integration_with_http_info(incident_id, integration_metadata_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_incident_integration".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_incident_integration") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_incident_integration")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.delete_incident_integration ...' + end + # verify the required parameter 'incident_id' is set + if @api_client.config.client_side_validation && incident_id.nil? + fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsAPI.delete_incident_integration" + end + # verify the required parameter 'integration_metadata_id' is set + if @api_client.config.client_side_validation && integration_metadata_id.nil? + fail ArgumentError, "Missing the required parameter 'integration_metadata_id' when calling IncidentsAPI.delete_incident_integration" + end + # resource path + local_var_path = '/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}'.sub('{incident_id}', CGI.escape(incident_id.to_s).gsub('%2F', '/')).sub('{integration_metadata_id}', CGI.escape(integration_metadata_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :delete_incident_integration, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#delete_incident_integration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get the details of an incident. # # @see #get_incident_with_http_info @@ -240,6 +394,82 @@ def get_incident_with_http_info(incident_id, opts = {}) return data, status_code, headers end + # Get incident integration metadata details. + # + # @see #get_incident_integration_with_http_info + def get_incident_integration(incident_id, integration_metadata_id, opts = {}) + data, _status_code, _headers = get_incident_integration_with_http_info(incident_id, integration_metadata_id, opts) + data + end + + # Get incident integration metadata details. + # + # Get incident integration metadata details. + # + # @param incident_id [String] The UUID of the incident. + # @param integration_metadata_id [String] The UUID of the incident integration metadata. + # @param opts [Hash] the optional parameters + # @return [Array<(IncidentIntegrationMetadataResponse, Integer, Hash)>] IncidentIntegrationMetadataResponse data, response status code and response headers + def get_incident_integration_with_http_info(incident_id, integration_metadata_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_incident_integration".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_incident_integration") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_incident_integration")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.get_incident_integration ...' + end + # verify the required parameter 'incident_id' is set + if @api_client.config.client_side_validation && incident_id.nil? + fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsAPI.get_incident_integration" + end + # verify the required parameter 'integration_metadata_id' is set + if @api_client.config.client_side_validation && integration_metadata_id.nil? + fail ArgumentError, "Missing the required parameter 'integration_metadata_id' when calling IncidentsAPI.get_incident_integration" + end + # resource path + local_var_path = '/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}'.sub('{incident_id}', CGI.escape(incident_id.to_s).gsub('%2F', '/')).sub('{integration_metadata_id}', CGI.escape(integration_metadata_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'IncidentIntegrationMetadataResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_incident_integration, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#get_incident_integration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get a list of attachments. # # @see #list_incident_attachments_with_http_info @@ -315,6 +545,77 @@ def list_incident_attachments_with_http_info(incident_id, opts = {}) return data, status_code, headers end + # Get a list of an incident's integration metadata. + # + # @see #list_incident_integrations_with_http_info + def list_incident_integrations(incident_id, opts = {}) + data, _status_code, _headers = list_incident_integrations_with_http_info(incident_id, opts) + data + end + + # Get a list of an incident's integration metadata. + # + # Get all integration metadata for an incident. + # + # @param incident_id [String] The UUID of the incident. + # @param opts [Hash] the optional parameters + # @return [Array<(IncidentIntegrationMetadataListResponse, Integer, Hash)>] IncidentIntegrationMetadataListResponse data, response status code and response headers + def list_incident_integrations_with_http_info(incident_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_incident_integrations".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_incident_integrations") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_incident_integrations")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.list_incident_integrations ...' + end + # verify the required parameter 'incident_id' is set + if @api_client.config.client_side_validation && incident_id.nil? + fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsAPI.list_incident_integrations" + end + # resource path + local_var_path = '/api/v2/incidents/{incident_id}/relationships/integrations'.sub('{incident_id}', CGI.escape(incident_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'IncidentIntegrationMetadataListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_incident_integrations, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#list_incident_integrations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get a list of incidents. # # @see #list_incidents_with_http_info @@ -651,5 +952,88 @@ def update_incident_attachments_with_http_info(incident_id, body, opts = {}) end return data, status_code, headers end + + # Update an existing incident integration metadata. + # + # @see #update_incident_integration_with_http_info + def update_incident_integration(incident_id, integration_metadata_id, body, opts = {}) + data, _status_code, _headers = update_incident_integration_with_http_info(incident_id, integration_metadata_id, body, opts) + data + end + + # Update an existing incident integration metadata. + # + # Update an existing incident integration metadata. + # + # @param incident_id [String] The UUID of the incident. + # @param integration_metadata_id [String] The UUID of the incident integration metadata. + # @param body [IncidentIntegrationMetadataPatchRequest] Incident integration metadata payload. + # @param opts [Hash] the optional parameters + # @return [Array<(IncidentIntegrationMetadataResponse, Integer, Hash)>] IncidentIntegrationMetadataResponse data, response status code and response headers + def update_incident_integration_with_http_info(incident_id, integration_metadata_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_incident_integration".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_incident_integration") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_incident_integration")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.update_incident_integration ...' + end + # verify the required parameter 'incident_id' is set + if @api_client.config.client_side_validation && incident_id.nil? + fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsAPI.update_incident_integration" + end + # verify the required parameter 'integration_metadata_id' is set + if @api_client.config.client_side_validation && integration_metadata_id.nil? + fail ArgumentError, "Missing the required parameter 'integration_metadata_id' when calling IncidentsAPI.update_incident_integration" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling IncidentsAPI.update_incident_integration" + end + # resource path + local_var_path = '/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}'.sub('{incident_id}', CGI.escape(incident_id.to_s).gsub('%2F', '/')).sub('{integration_metadata_id}', CGI.escape(integration_metadata_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'IncidentIntegrationMetadataResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_incident_integration, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#update_incident_integration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/datadog_api_client/v2/models/incident_integration_metadata_attributes.rb b/lib/datadog_api_client/v2/models/incident_integration_metadata_attributes.rb new file mode 100644 index 000000000000..253bf8eedac2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_integration_metadata_attributes.rb @@ -0,0 +1,161 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Incident integration metadata's attributes for a create request. + class IncidentIntegrationMetadataAttributes + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # UUID of the incident this integration metadata is connected to. + attr_accessor :incident_id + + # A number indicating the type of integration this metadata is for. 1 indicates Slack; + # 8 indicates Jira. + attr_reader :integration_type + + # Incident integration metadata's metadata attribute. + attr_reader :metadata + + # A number indicating the status of this integration metadata. 0 indicates unknown; + # 1 indicates pending; 2 indicates complete; 3 indicates manually created; + # 4 indicates manually updated; 5 indicates failed. + attr_reader :status + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'incident_id' => :'incident_id', + :'integration_type' => :'integration_type', + :'metadata' => :'metadata', + :'status' => :'status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'incident_id' => :'String', + :'integration_type' => :'Integer', + :'metadata' => :'IncidentIntegrationMetadataMetadata', + :'status' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentIntegrationMetadataAttributes` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::IncidentIntegrationMetadataAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'incident_id') + self.incident_id = attributes[:'incident_id'] + end + + if attributes.key?(:'integration_type') + self.integration_type = attributes[:'integration_type'] + end + + if attributes.key?(:'metadata') + self.metadata = attributes[:'metadata'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @integration_type.nil? + return false if @integration_type > 9 + return false if @metadata.nil? + return false if !@status.nil? && @status > 5 + true + end + + # Custom attribute writer method with validation + # @param integration_type [Object] Object to be assigned + # @!visibility private + def integration_type=(integration_type) + if integration_type.nil? + fail ArgumentError, 'invalid value for "integration_type", integration_type cannot be nil.' + end + if integration_type > 9 + fail ArgumentError, 'invalid value for "integration_type", must be smaller than or equal to 9.' + end + @integration_type = integration_type + end + + # Custom attribute writer method with validation + # @param metadata [Object] Object to be assigned + # @!visibility private + def metadata=(metadata) + if metadata.nil? + fail ArgumentError, 'invalid value for "metadata", metadata cannot be nil.' + end + @metadata = metadata + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if !status.nil? && status > 5 + fail ArgumentError, 'invalid value for "status", must be smaller than or equal to 5.' + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + incident_id == o.incident_id && + integration_type == o.integration_type && + metadata == o.metadata && + status == o.status + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [incident_id, integration_type, metadata, status].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_integration_metadata_create_data.rb b/lib/datadog_api_client/v2/models/incident_integration_metadata_create_data.rb new file mode 100644 index 000000000000..7ea05adcddfb --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_integration_metadata_create_data.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Incident integration metadata data for a create request. + class IncidentIntegrationMetadataCreateData + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # Incident integration metadata's attributes for a create request. + attr_reader :attributes + + # Integration metadata resource type. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'IncidentIntegrationMetadataAttributes', + :'type' => :'IncidentIntegrationMetadataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentIntegrationMetadataCreateData` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::IncidentIntegrationMetadataCreateData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_integration_metadata_create_request.rb b/lib/datadog_api_client/v2/models/incident_integration_metadata_create_request.rb new file mode 100644 index 000000000000..c06c872702d9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_integration_metadata_create_request.rb @@ -0,0 +1,102 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Create request for an incident integration metadata. + class IncidentIntegrationMetadataCreateRequest + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # Incident integration metadata data for a create request. + attr_reader :data + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'IncidentIntegrationMetadataCreateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentIntegrationMetadataCreateRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::IncidentIntegrationMetadataCreateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_integration_metadata_list_response.rb b/lib/datadog_api_client/v2/models/incident_integration_metadata_list_response.rb new file mode 100644 index 000000000000..9661906c06f0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_integration_metadata_list_response.rb @@ -0,0 +1,126 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response with a list of incident integration metadata. + class IncidentIntegrationMetadataListResponse + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # An array of incident integration metadata. + attr_reader :data + + # Included related resources that the user requested. + attr_accessor :included + + # The metadata object containing pagination metadata. + attr_accessor :meta + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'included' => :'Array', + :'meta' => :'IncidentResponseMeta' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentIntegrationMetadataListResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::IncidentIntegrationMetadataListResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included && + meta == o.meta + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, meta].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_integration_metadata_metadata.rb b/lib/datadog_api_client/v2/models/incident_integration_metadata_metadata.rb new file mode 100644 index 000000000000..e9361b57db8b --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_integration_metadata_metadata.rb @@ -0,0 +1,63 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Incident integration metadata's metadata attribute. + module IncidentIntegrationMetadataMetadata + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'SlackIntegrationMetadata', + :'JiraIntegrationMetadata' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_integration_metadata_patch_data.rb b/lib/datadog_api_client/v2/models/incident_integration_metadata_patch_data.rb new file mode 100644 index 000000000000..4cecaeb74be8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_integration_metadata_patch_data.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Incident integration metadata data for a patch request. + class IncidentIntegrationMetadataPatchData + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # Incident integration metadata's attributes for a create request. + attr_reader :attributes + + # Integration metadata resource type. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'IncidentIntegrationMetadataAttributes', + :'type' => :'IncidentIntegrationMetadataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentIntegrationMetadataPatchData` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::IncidentIntegrationMetadataPatchData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_integration_metadata_patch_request.rb b/lib/datadog_api_client/v2/models/incident_integration_metadata_patch_request.rb new file mode 100644 index 000000000000..c9f34cb5edc0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_integration_metadata_patch_request.rb @@ -0,0 +1,102 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Patch request for an incident integration metadata. + class IncidentIntegrationMetadataPatchRequest + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # Incident integration metadata data for a patch request. + attr_reader :data + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'IncidentIntegrationMetadataPatchData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentIntegrationMetadataPatchRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::IncidentIntegrationMetadataPatchRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_integration_metadata_response.rb b/lib/datadog_api_client/v2/models/incident_integration_metadata_response.rb new file mode 100644 index 000000000000..129d3bb0e927 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_integration_metadata_response.rb @@ -0,0 +1,114 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response with an incident integration metadata. + class IncidentIntegrationMetadataResponse + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # Incident integration metadata from a response. + attr_reader :data + + # Included related resources that the user requested. + attr_accessor :included + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'IncidentIntegrationMetadataResponseData', + :'included' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentIntegrationMetadataResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::IncidentIntegrationMetadataResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_integration_metadata_response_data.rb b/lib/datadog_api_client/v2/models/incident_integration_metadata_response_data.rb new file mode 100644 index 000000000000..65d4f353afb3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_integration_metadata_response_data.rb @@ -0,0 +1,133 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Incident integration metadata from a response. + class IncidentIntegrationMetadataResponseData + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # Incident integration metadata's attributes for a create request. + attr_accessor :attributes + + # The incident integration metadata's ID. + attr_reader :id + + # Integration metadata resource type. + attr_reader :type + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'IncidentIntegrationMetadataAttributes', + :'id' => :'String', + :'type' => :'IncidentIntegrationMetadataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::IncidentIntegrationMetadataResponseData` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::IncidentIntegrationMetadataResponseData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_integration_metadata_response_included_item.rb b/lib/datadog_api_client/v2/models/incident_integration_metadata_response_included_item.rb new file mode 100644 index 000000000000..3a246de3e32d --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_integration_metadata_response_included_item.rb @@ -0,0 +1,62 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # An object related to an incident integration metadata that is included in the response. + module IncidentIntegrationMetadataResponseIncludedItem + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'User' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_update_data.rb b/lib/datadog_api_client/v2/models/incident_update_data.rb index 38130a5e87aa..41a9e43efdca 100644 --- a/lib/datadog_api_client/v2/models/incident_update_data.rb +++ b/lib/datadog_api_client/v2/models/incident_update_data.rb @@ -28,7 +28,7 @@ class IncidentUpdateData # The incident's attributes for an update request. attr_accessor :attributes - # The team's ID. + # The incident's ID. attr_reader :id # The incident's relationships for an update request. diff --git a/lib/datadog_api_client/v2/models/jira_integration_metadata.rb b/lib/datadog_api_client/v2/models/jira_integration_metadata.rb new file mode 100644 index 000000000000..6397c66b9e5f --- /dev/null +++ b/lib/datadog_api_client/v2/models/jira_integration_metadata.rb @@ -0,0 +1,104 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Incident integration metadata for the Jira integration. + class JiraIntegrationMetadata + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # Array of Jira issues in this integration metadata. + attr_reader :issues + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'issues' => :'issues' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'issues' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::JiraIntegrationMetadata` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::JiraIntegrationMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'issues') + if (value = attributes[:'issues']).is_a?(Array) + self.issues = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @issues.nil? + true + end + + # Custom attribute writer method with validation + # @param issues [Object] Object to be assigned + # @!visibility private + def issues=(issues) + if issues.nil? + fail ArgumentError, 'invalid value for "issues", issues cannot be nil.' + end + @issues = issues + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + issues == o.issues + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [issues].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/jira_integration_metadata_issues_item.rb b/lib/datadog_api_client/v2/models/jira_integration_metadata_issues_item.rb new file mode 100644 index 000000000000..d5a43d1108f0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/jira_integration_metadata_issues_item.rb @@ -0,0 +1,153 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Item in the Jira integration metadata issue array. + class JiraIntegrationMetadataIssuesItem + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # URL of issue's Jira account. + attr_reader :account + + # Jira issue's issue key. + attr_accessor :issue_key + + # Jira issue's issue type. + attr_accessor :issuetype_id + + # Jira issue's project keys. + attr_reader :project_key + + # URL redirecting to the Jira issue. + attr_accessor :redirect_url + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'account' => :'account', + :'issue_key' => :'issue_key', + :'issuetype_id' => :'issuetype_id', + :'project_key' => :'project_key', + :'redirect_url' => :'redirect_url' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'account' => :'String', + :'issue_key' => :'String', + :'issuetype_id' => :'String', + :'project_key' => :'String', + :'redirect_url' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::JiraIntegrationMetadataIssuesItem` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::JiraIntegrationMetadataIssuesItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'account') + self.account = attributes[:'account'] + end + + if attributes.key?(:'issue_key') + self.issue_key = attributes[:'issue_key'] + end + + if attributes.key?(:'issuetype_id') + self.issuetype_id = attributes[:'issuetype_id'] + end + + if attributes.key?(:'project_key') + self.project_key = attributes[:'project_key'] + end + + if attributes.key?(:'redirect_url') + self.redirect_url = attributes[:'redirect_url'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @account.nil? + return false if @project_key.nil? + true + end + + # Custom attribute writer method with validation + # @param account [Object] Object to be assigned + # @!visibility private + def account=(account) + if account.nil? + fail ArgumentError, 'invalid value for "account", account cannot be nil.' + end + @account = account + end + + # Custom attribute writer method with validation + # @param project_key [Object] Object to be assigned + # @!visibility private + def project_key=(project_key) + if project_key.nil? + fail ArgumentError, 'invalid value for "project_key", project_key cannot be nil.' + end + @project_key = project_key + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account == o.account && + issue_key == o.issue_key && + issuetype_id == o.issuetype_id && + project_key == o.project_key && + redirect_url == o.redirect_url + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [account, issue_key, issuetype_id, project_key, redirect_url].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/relationship_to_incident_integration_metadatas.rb b/lib/datadog_api_client/v2/models/relationship_to_incident_integration_metadatas.rb index 0e46e6060bf6..7cbc88424cf6 100644 --- a/lib/datadog_api_client/v2/models/relationship_to_incident_integration_metadatas.rb +++ b/lib/datadog_api_client/v2/models/relationship_to_incident_integration_metadatas.rb @@ -25,7 +25,7 @@ class RelationshipToIncidentIntegrationMetadatas # @!visibility private attr_accessor :_unparsed - # The integration metadata relationship array + # Integration metadata relationship array attr_reader :data # Attribute mapping from ruby-style variable name to JSON key. diff --git a/lib/datadog_api_client/v2/models/slack_integration_metadata.rb b/lib/datadog_api_client/v2/models/slack_integration_metadata.rb new file mode 100644 index 000000000000..3dc1aa4d7a20 --- /dev/null +++ b/lib/datadog_api_client/v2/models/slack_integration_metadata.rb @@ -0,0 +1,104 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Incident integration metadata for the Slack integration. + class SlackIntegrationMetadata + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # Array of Slack channels in this integration metadata. + attr_reader :channels + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'channels' => :'channels' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'channels' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SlackIntegrationMetadata` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::SlackIntegrationMetadata`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'channels') + if (value = attributes[:'channels']).is_a?(Array) + self.channels = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @channels.nil? + true + end + + # Custom attribute writer method with validation + # @param channels [Object] Object to be assigned + # @!visibility private + def channels=(channels) + if channels.nil? + fail ArgumentError, 'invalid value for "channels", channels cannot be nil.' + end + @channels = channels + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + channels == o.channels + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [channels].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/slack_integration_metadata_channel_item.rb b/lib/datadog_api_client/v2/models/slack_integration_metadata_channel_item.rb new file mode 100644 index 000000000000..967d5556c4e4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/slack_integration_metadata_channel_item.rb @@ -0,0 +1,154 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Item in the Slack integration metadata channel array. + class SlackIntegrationMetadataChannelItem + include BaseGenericModel + + # Whether the object has unparsed attributes + # @!visibility private + attr_accessor :_unparsed + + # Slack channel ID. + attr_reader :channel_id + + # Name of the Slack channel. + attr_reader :channel_name + + # URL redirecting to the Slack channel. + attr_reader :redirect_url + + # Slack team ID. + attr_accessor :team_id + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'channel_id' => :'channel_id', + :'channel_name' => :'channel_name', + :'redirect_url' => :'redirect_url', + :'team_id' => :'team_id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'channel_id' => :'String', + :'channel_name' => :'String', + :'redirect_url' => :'String', + :'team_id' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::SlackIntegrationMetadataChannelItem` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::SlackIntegrationMetadataChannelItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'channel_id') + self.channel_id = attributes[:'channel_id'] + end + + if attributes.key?(:'channel_name') + self.channel_name = attributes[:'channel_name'] + end + + if attributes.key?(:'redirect_url') + self.redirect_url = attributes[:'redirect_url'] + end + + if attributes.key?(:'team_id') + self.team_id = attributes[:'team_id'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @channel_id.nil? + return false if @channel_name.nil? + return false if @redirect_url.nil? + true + end + + # Custom attribute writer method with validation + # @param channel_id [Object] Object to be assigned + # @!visibility private + def channel_id=(channel_id) + if channel_id.nil? + fail ArgumentError, 'invalid value for "channel_id", channel_id cannot be nil.' + end + @channel_id = channel_id + end + + # Custom attribute writer method with validation + # @param channel_name [Object] Object to be assigned + # @!visibility private + def channel_name=(channel_name) + if channel_name.nil? + fail ArgumentError, 'invalid value for "channel_name", channel_name cannot be nil.' + end + @channel_name = channel_name + end + + # Custom attribute writer method with validation + # @param redirect_url [Object] Object to be assigned + # @!visibility private + def redirect_url=(redirect_url) + if redirect_url.nil? + fail ArgumentError, 'invalid value for "redirect_url", redirect_url cannot be nil.' + end + @redirect_url = redirect_url + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + channel_id == o.channel_id && + channel_name == o.channel_name && + redirect_url == o.redirect_url && + team_id == o.team_id + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [channel_id, channel_name, redirect_url, team_id].hash + end + end +end