diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index f3ca46bc048..d2192b74841 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -54408,6 +54408,143 @@ components: $ref: '#/components/schemas/TeamLink' type: array type: object + TeamNotificationRule: + description: Team notification rule + properties: + attributes: + $ref: '#/components/schemas/TeamNotificationRuleAttributes' + id: + description: The identifier of the team notification rule + example: b8626d7e-cedd-11eb-abf5-da7ad0900001 + type: string + type: + $ref: '#/components/schemas/TeamNotificationRuleType' + required: + - attributes + - type + type: object + TeamNotificationRuleAttributes: + description: Team notification rule attributes + properties: + email: + $ref: '#/components/schemas/TeamNotificationRuleAttributesEmail' + ms_teams: + $ref: '#/components/schemas/TeamNotificationRuleAttributesMsTeams' + pagerduty: + $ref: '#/components/schemas/TeamNotificationRuleAttributesPagerduty' + slack: + $ref: '#/components/schemas/TeamNotificationRuleAttributesSlack' + type: object + TeamNotificationRuleAttributesEmail: + description: Email notification settings for the team + properties: + enabled: + description: Flag indicating email notification + type: boolean + type: object + TeamNotificationRuleAttributesMsTeams: + description: MS Teams notification settings for the team + properties: + connector_name: + description: Handle for MS Teams + type: string + type: object + TeamNotificationRuleAttributesPagerduty: + description: PagerDuty notification settings for the team + properties: + service_name: + description: Service name for PagerDuty + type: string + type: object + TeamNotificationRuleAttributesSlack: + description: Slack notification settings for the team + properties: + channel: + description: Channel for Slack notification + type: string + workspace: + description: Workspace for Slack notification + type: string + type: object + TeamNotificationRuleRequest: + description: Request to create or update a team notification rule + properties: + data: + $ref: '#/components/schemas/TeamNotificationRule' + required: + - data + type: object + TeamNotificationRuleResponse: + description: Team notification rule response + properties: + data: + $ref: '#/components/schemas/TeamNotificationRule' + type: object + TeamNotificationRuleType: + default: team_notification_rules + description: Team notification rule type + enum: + - team_notification_rules + example: team_notification_rules + type: string + x-enum-varnames: + - TEAM_NOTIFICATION_RULES + TeamNotificationRulesResponse: + description: Team notification rules response + properties: + data: + description: Team notification rules response data + items: + $ref: '#/components/schemas/TeamNotificationRule' + type: array + meta: + $ref: '#/components/schemas/TeamNotificationRulesResponseMeta' + type: object + TeamNotificationRulesResponseMeta: + description: Metadata that is included in the response when querying the team + notification rules + properties: + page: + $ref: '#/components/schemas/TeamNotificationRulesResponseMetaPage' + type: object + TeamNotificationRulesResponseMetaPage: + description: Metadata related to paging information that is included in the + response when querying the team notification rules + properties: + first_offset: + description: The first offset. + format: int64 + type: integer + last_offset: + description: The last offset. + format: int64 + type: integer + limit: + description: Pagination limit. + format: int64 + type: integer + next_offset: + description: The next offset. + format: int64 + nullable: true + type: integer + offset: + description: The offset. + format: int64 + type: integer + prev_offset: + description: The previous offset. + format: int64 + nullable: true + type: integer + total: + description: Total results. + format: int64 + type: integer + type: + description: Offset type. + type: string + type: object TeamOnCallResponders: description: Root object representing a team's on-call responder configuration. example: @@ -87408,6 +87545,230 @@ paths: operator: OR permissions: - teams_read + /api/v2/team/{team_id}/notification-rules: + get: + operationId: GetTeamNotificationRules + parameters: + - description: None + in: path + name: team_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamNotificationRulesResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Get team notification rules + tags: + - Teams + x-permission: + operator: OR + permissions: + - teams_read + post: + operationId: CreateTeamNotificationRule + parameters: + - description: None + in: path + name: team_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TeamNotificationRuleRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamNotificationRuleResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Create team notification rule + tags: + - Teams + x-permission: + operator: OR + permissions: + - teams_read + /api/v2/team/{team_id}/notification-rules/{rule_id}: + delete: + operationId: DeleteTeamNotificationRule + parameters: + - description: None + in: path + name: team_id + required: true + schema: + type: string + - description: None + in: path + name: rule_id + required: true + schema: + type: string + responses: + '204': + description: No Content + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Delete team notification rule + tags: + - Teams + x-permission: + operator: OR + permissions: + - teams_read + get: + operationId: GetTeamNotificationRule + parameters: + - description: None + in: path + name: team_id + required: true + schema: + type: string + - description: None + in: path + name: rule_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamNotificationRuleResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Get team notification rule + tags: + - Teams + x-permission: + operator: OR + permissions: + - teams_read + put: + operationId: UpdateTeamNotificationRule + parameters: + - description: None + in: path + name: team_id + required: true + schema: + type: string + - description: None + in: path + name: rule_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TeamNotificationRuleRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamNotificationRuleResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Update team notification rule + tags: + - Teams + x-permission: + operator: OR + permissions: + - teams_read /api/v2/team/{team_id}/permission-settings: get: description: Get all permission settings for a given team. diff --git a/cassettes/features/v2/teams/Create-team-notification-rule-returns-API-error-response-response.frozen b/cassettes/features/v2/teams/Create-team-notification-rule-returns-API-error-response-response.frozen new file mode 100644 index 00000000000..f2b43c76655 --- /dev/null +++ b/cassettes/features/v2/teams/Create-team-notification-rule-returns-API-error-response-response.frozen @@ -0,0 +1 @@ +2025-12-23T15:27:22.080Z \ No newline at end of file diff --git a/cassettes/features/v2/teams/Create-team-notification-rule-returns-API-error-response-response.yml b/cassettes/features/v2/teams/Create-team-notification-rule-returns-API-error-response-response.yml new file mode 100644 index 00000000000..5b1b163b447 --- /dev/null +++ b/cassettes/features/v2/teams/Create-team-notification-rule-returns-API-error-response-response.yml @@ -0,0 +1,85 @@ +http_interactions: +- recorded_at: Tue, 23 Dec 2025 15:27:22 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"handle":"test-handle-416b8af9ae1d2bbe","name":"test-name-416b8af9ae1d2bbe"},"type":"team"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"f3b7fcd4-f37c-4e11-b288-f6cfa4b0df44","type":"team","attributes":{"avatar":null,"banner":5,"created_at":"2025-12-23T15:27:22.204713+00:00","description":null,"handle":"test-handle-416b8af9ae1d2bbe","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-12-23T15:27:22.204713+00:00","name":"test-name-416b8af9ae1d2bbe","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/f3b7fcd4-f37c-4e11-b288-f6cfa4b0df44/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/f3b7fcd4-f37c-4e11-b288-f6cfa4b0df44/permission-settings"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 15:27:22 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":{"enabled":true},"slack":{"channel":"aaa-omg-ops","workspace":"Datadog"}},"type":"team_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team/f3b7fcd4-f37c-4e11-b288-f6cfa4b0df44/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"56627a0f-4c41-491d-b789-14d660c391ee","type":"team_notification_rules","attributes":{"email":{"enabled":true},"slack":{"workspace":"Datadog","channel":"aaa-omg-ops"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 15:27:22 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":{"enabled":true},"slack":{"channel":"aaa-omg-ops","workspace":"Datadog"}},"type":"team_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team/f3b7fcd4-f37c-4e11-b288-f6cfa4b0df44/notification-rules + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"409","title":"Conflict","detail":"notification + rule already exists for this team"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 409 + message: Conflict +- recorded_at: Tue, 23 Dec 2025 15:27:22 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/f3b7fcd4-f37c-4e11-b288-f6cfa4b0df44 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/teams/Create-team-notification-rule-returns-OK-response.frozen b/cassettes/features/v2/teams/Create-team-notification-rule-returns-OK-response.frozen new file mode 100644 index 00000000000..64017239608 --- /dev/null +++ b/cassettes/features/v2/teams/Create-team-notification-rule-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-12-23T15:28:02.140Z \ No newline at end of file diff --git a/cassettes/features/v2/teams/Create-team-notification-rule-returns-OK-response.yml b/cassettes/features/v2/teams/Create-team-notification-rule-returns-OK-response.yml new file mode 100644 index 00000000000..425606e0d23 --- /dev/null +++ b/cassettes/features/v2/teams/Create-team-notification-rule-returns-OK-response.yml @@ -0,0 +1,62 @@ +http_interactions: +- recorded_at: Tue, 23 Dec 2025 15:28:02 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"handle":"test-handle-72b192d95e937252","name":"test-name-72b192d95e937252"},"type":"team"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"04eae0c8-e225-4f2c-97ec-39dab13dfc38","type":"team","attributes":{"avatar":null,"banner":13,"created_at":"2025-12-23T15:28:02.268616+00:00","description":null,"handle":"test-handle-72b192d95e937252","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-12-23T15:28:02.268616+00:00","name":"test-name-72b192d95e937252","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/04eae0c8-e225-4f2c-97ec-39dab13dfc38/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/04eae0c8-e225-4f2c-97ec-39dab13dfc38/permission-settings"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 15:28:02 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":{"enabled":true},"slack":{"channel":"aaa-omg-ops","workspace":"Datadog"}},"type":"team_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team/04eae0c8-e225-4f2c-97ec-39dab13dfc38/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"bba76d10-a5c6-4cb5-ba1a-5a9145f2b364","type":"team_notification_rules","attributes":{"email":{"enabled":true},"slack":{"workspace":"Datadog","channel":"aaa-omg-ops"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 15:28:02 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/04eae0c8-e225-4f2c-97ec-39dab13dfc38 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/teams/Delete-team-notification-rule-returns-API-error-response-response.frozen b/cassettes/features/v2/teams/Delete-team-notification-rule-returns-API-error-response-response.frozen new file mode 100644 index 00000000000..1cedb251b03 --- /dev/null +++ b/cassettes/features/v2/teams/Delete-team-notification-rule-returns-API-error-response-response.frozen @@ -0,0 +1 @@ +2025-12-23T16:10:38.852Z \ No newline at end of file diff --git a/cassettes/features/v2/teams/Delete-team-notification-rule-returns-API-error-response-response.yml b/cassettes/features/v2/teams/Delete-team-notification-rule-returns-API-error-response-response.yml new file mode 100644 index 00000000000..4e1955a517a --- /dev/null +++ b/cassettes/features/v2/teams/Delete-team-notification-rule-returns-API-error-response-response.yml @@ -0,0 +1,81 @@ +http_interactions: +- recorded_at: Tue, 23 Dec 2025 16:10:38 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"handle":"test-handle-7ecc01265306da71","name":"test-name-7ecc01265306da71"},"type":"team"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"9bd7798e-a955-48e0-9a36-13820e1ff74b","type":"team","attributes":{"avatar":null,"banner":2,"created_at":"2025-12-23T16:10:38.996803+00:00","description":null,"handle":"test-handle-7ecc01265306da71","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-12-23T16:10:38.996803+00:00","name":"test-name-7ecc01265306da71","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/9bd7798e-a955-48e0-9a36-13820e1ff74b/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/9bd7798e-a955-48e0-9a36-13820e1ff74b/permission-settings"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 16:10:38 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":{"enabled":true},"slack":{"channel":"aaa-omg-ops","workspace":"Datadog"}},"type":"team_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team/9bd7798e-a955-48e0-9a36-13820e1ff74b/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"87b5e6e4-000d-4d9d-bb1c-bc62728a8ab8","type":"team_notification_rules","attributes":{"email":{"enabled":true},"slack":{"workspace":"Datadog","channel":"aaa-omg-ops"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 16:10:38 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/9bd7798e-a955-48e0-9a36-13820e1ff74b/notification-rules/3d031bb2-e1da-4d34-a670-1b5557b032c9 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","detail":"rule ID 3d031bb2-e1da-4d34-a670-1b5557b032c9 + was not found in team ID 9bd7798e-a955-48e0-9a36-13820e1ff74b"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +- recorded_at: Tue, 23 Dec 2025 16:10:38 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/9bd7798e-a955-48e0-9a36-13820e1ff74b + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/teams/Delete-team-notification-rule-returns-No-Content-response.frozen b/cassettes/features/v2/teams/Delete-team-notification-rule-returns-No-Content-response.frozen new file mode 100644 index 00000000000..6552fdc24f6 --- /dev/null +++ b/cassettes/features/v2/teams/Delete-team-notification-rule-returns-No-Content-response.frozen @@ -0,0 +1 @@ +2025-12-23T15:28:45.586Z \ No newline at end of file diff --git a/cassettes/features/v2/teams/Delete-team-notification-rule-returns-No-Content-response.yml b/cassettes/features/v2/teams/Delete-team-notification-rule-returns-No-Content-response.yml new file mode 100644 index 00000000000..23243c09c8e --- /dev/null +++ b/cassettes/features/v2/teams/Delete-team-notification-rule-returns-No-Content-response.yml @@ -0,0 +1,78 @@ +http_interactions: +- recorded_at: Tue, 23 Dec 2025 15:28:45 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"handle":"test-handle-4f30392b8132329e","name":"test-name-4f30392b8132329e"},"type":"team"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"204d172a-83e4-420c-a840-d914be2cd5ed","type":"team","attributes":{"avatar":null,"banner":4,"created_at":"2025-12-23T15:28:45.710450+00:00","description":null,"handle":"test-handle-4f30392b8132329e","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-12-23T15:28:45.710450+00:00","name":"test-name-4f30392b8132329e","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/204d172a-83e4-420c-a840-d914be2cd5ed/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/204d172a-83e4-420c-a840-d914be2cd5ed/permission-settings"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 15:28:45 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":{"enabled":true},"slack":{"channel":"aaa-omg-ops","workspace":"Datadog"}},"type":"team_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team/204d172a-83e4-420c-a840-d914be2cd5ed/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"d4abbaab-11b3-41ea-a6e3-ed366522a39e","type":"team_notification_rules","attributes":{"email":{"enabled":true},"slack":{"workspace":"Datadog","channel":"aaa-omg-ops"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 15:28:45 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/204d172a-83e4-420c-a840-d914be2cd5ed/notification-rules/d4abbaab-11b3-41ea-a6e3-ed366522a39e + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Tue, 23 Dec 2025 15:28:45 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/204d172a-83e4-420c-a840-d914be2cd5ed + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/teams/Get-team-notification-rule-returns-API-error-response-response.frozen b/cassettes/features/v2/teams/Get-team-notification-rule-returns-API-error-response-response.frozen new file mode 100644 index 00000000000..6113189ccb1 --- /dev/null +++ b/cassettes/features/v2/teams/Get-team-notification-rule-returns-API-error-response-response.frozen @@ -0,0 +1 @@ +2025-12-23T15:29:05.686Z \ No newline at end of file diff --git a/cassettes/features/v2/teams/Get-team-notification-rule-returns-API-error-response-response.yml b/cassettes/features/v2/teams/Get-team-notification-rule-returns-API-error-response-response.yml new file mode 100644 index 00000000000..07b46b30514 --- /dev/null +++ b/cassettes/features/v2/teams/Get-team-notification-rule-returns-API-error-response-response.yml @@ -0,0 +1,80 @@ +http_interactions: +- recorded_at: Tue, 23 Dec 2025 15:29:05 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"handle":"test-handle-903f29be232384f8","name":"test-name-903f29be232384f8"},"type":"team"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"54fb1795-4bee-4e8f-9ccd-1aca53d24f8e","type":"team","attributes":{"avatar":null,"banner":14,"created_at":"2025-12-23T15:29:05.802966+00:00","description":null,"handle":"test-handle-903f29be232384f8","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-12-23T15:29:05.802966+00:00","name":"test-name-903f29be232384f8","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/54fb1795-4bee-4e8f-9ccd-1aca53d24f8e/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/54fb1795-4bee-4e8f-9ccd-1aca53d24f8e/permission-settings"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 15:29:05 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":{"enabled":true},"slack":{"channel":"aaa-omg-ops","workspace":"Datadog"}},"type":"team_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team/54fb1795-4bee-4e8f-9ccd-1aca53d24f8e/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"51f01e40-e075-4c25-8878-9fd3f7800770","type":"team_notification_rules","attributes":{"email":{"enabled":true},"slack":{"workspace":"Datadog","channel":"aaa-omg-ops"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 15:29:05 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/team/54fb1795-4bee-4e8f-9ccd-1aca53d24f8e/notification-rules/54fb1795-4bee-4e8f-9ccd-1aca53d24f8e + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","title":"Not Found","detail":"rule not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +- recorded_at: Tue, 23 Dec 2025 15:29:05 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/54fb1795-4bee-4e8f-9ccd-1aca53d24f8e + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/teams/Get-team-notification-rule-returns-OK-response.frozen b/cassettes/features/v2/teams/Get-team-notification-rule-returns-OK-response.frozen new file mode 100644 index 00000000000..9ed298dca56 --- /dev/null +++ b/cassettes/features/v2/teams/Get-team-notification-rule-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-12-23T15:29:22.965Z \ No newline at end of file diff --git a/cassettes/features/v2/teams/Get-team-notification-rule-returns-OK-response.yml b/cassettes/features/v2/teams/Get-team-notification-rule-returns-OK-response.yml new file mode 100644 index 00000000000..1bec39b4eea --- /dev/null +++ b/cassettes/features/v2/teams/Get-team-notification-rule-returns-OK-response.yml @@ -0,0 +1,80 @@ +http_interactions: +- recorded_at: Tue, 23 Dec 2025 15:29:22 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"handle":"test-handle-ee0eead53fe855d3","name":"test-name-ee0eead53fe855d3"},"type":"team"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"a7145aa7-d043-4f4d-bd45-fd02669b47d7","type":"team","attributes":{"avatar":null,"banner":14,"created_at":"2025-12-23T15:29:23.130502+00:00","description":null,"handle":"test-handle-ee0eead53fe855d3","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-12-23T15:29:23.130502+00:00","name":"test-name-ee0eead53fe855d3","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/a7145aa7-d043-4f4d-bd45-fd02669b47d7/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/a7145aa7-d043-4f4d-bd45-fd02669b47d7/permission-settings"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 15:29:22 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":{"enabled":true},"slack":{"channel":"aaa-omg-ops","workspace":"Datadog"}},"type":"team_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team/a7145aa7-d043-4f4d-bd45-fd02669b47d7/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"68717b60-b443-49ac-b7ca-75664cb53c29","type":"team_notification_rules","attributes":{"email":{"enabled":true},"slack":{"workspace":"Datadog","channel":"aaa-omg-ops"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 15:29:22 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/team/a7145aa7-d043-4f4d-bd45-fd02669b47d7/notification-rules/68717b60-b443-49ac-b7ca-75664cb53c29 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"68717b60-b443-49ac-b7ca-75664cb53c29","type":"team_notification_rules","attributes":{"email":{"enabled":true},"slack":{"workspace":"Datadog","channel":"aaa-omg-ops"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Tue, 23 Dec 2025 15:29:22 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/a7145aa7-d043-4f4d-bd45-fd02669b47d7 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/teams/Get-team-notification-rules-returns-OK-response.frozen b/cassettes/features/v2/teams/Get-team-notification-rules-returns-OK-response.frozen new file mode 100644 index 00000000000..754f3a36dbc --- /dev/null +++ b/cassettes/features/v2/teams/Get-team-notification-rules-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-12-23T15:29:44.007Z \ No newline at end of file diff --git a/cassettes/features/v2/teams/Get-team-notification-rules-returns-OK-response.yml b/cassettes/features/v2/teams/Get-team-notification-rules-returns-OK-response.yml new file mode 100644 index 00000000000..9c4f5d909eb --- /dev/null +++ b/cassettes/features/v2/teams/Get-team-notification-rules-returns-OK-response.yml @@ -0,0 +1,80 @@ +http_interactions: +- recorded_at: Tue, 23 Dec 2025 15:29:44 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"handle":"test-handle-470a68e726826798","name":"test-name-470a68e726826798"},"type":"team"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"a3101ed3-6329-48f6-86fa-17f3680205a3","type":"team","attributes":{"avatar":null,"banner":14,"created_at":"2025-12-23T15:29:44.163043+00:00","description":null,"handle":"test-handle-470a68e726826798","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-12-23T15:29:44.163043+00:00","name":"test-name-470a68e726826798","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/a3101ed3-6329-48f6-86fa-17f3680205a3/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/a3101ed3-6329-48f6-86fa-17f3680205a3/permission-settings"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 15:29:44 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":{"enabled":true},"slack":{"channel":"aaa-omg-ops","workspace":"Datadog"}},"type":"team_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team/a3101ed3-6329-48f6-86fa-17f3680205a3/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"136542b0-6555-4240-bcc9-5d040c17cd54","type":"team_notification_rules","attributes":{"email":{"enabled":true},"slack":{"workspace":"Datadog","channel":"aaa-omg-ops"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 15:29:44 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/team/a3101ed3-6329-48f6-86fa-17f3680205a3/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":[{"id":"136542b0-6555-4240-bcc9-5d040c17cd54","type":"team_notification_rules","attributes":{"email":{"enabled":true},"slack":{"workspace":"Datadog","channel":"aaa-omg-ops"}}}],"meta":{"page":{"type":"offset_limit","offset":0,"limit":100,"total":1,"first_offset":0,"prev_offset":null,"next_offset":null,"last_offset":0}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Tue, 23 Dec 2025 15:29:44 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/a3101ed3-6329-48f6-86fa-17f3680205a3 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/teams/Update-team-notification-rule-returns-API-error-response-response.frozen b/cassettes/features/v2/teams/Update-team-notification-rule-returns-API-error-response-response.frozen new file mode 100644 index 00000000000..fa21b8c82ef --- /dev/null +++ b/cassettes/features/v2/teams/Update-team-notification-rule-returns-API-error-response-response.frozen @@ -0,0 +1 @@ +2025-12-23T16:10:18.143Z \ No newline at end of file diff --git a/cassettes/features/v2/teams/Update-team-notification-rule-returns-API-error-response-response.yml b/cassettes/features/v2/teams/Update-team-notification-rule-returns-API-error-response-response.yml new file mode 100644 index 00000000000..155713731c8 --- /dev/null +++ b/cassettes/features/v2/teams/Update-team-notification-rule-returns-API-error-response-response.yml @@ -0,0 +1,85 @@ +http_interactions: +- recorded_at: Tue, 23 Dec 2025 16:10:18 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"handle":"test-handle-191ec67f8f79c1b1","name":"test-name-191ec67f8f79c1b1"},"type":"team"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"30484b70-7506-41b9-b1c6-4fcf6c13e5e4","type":"team","attributes":{"avatar":null,"banner":2,"created_at":"2025-12-23T16:10:18.284603+00:00","description":null,"handle":"test-handle-191ec67f8f79c1b1","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-12-23T16:10:18.284603+00:00","name":"test-name-191ec67f8f79c1b1","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/30484b70-7506-41b9-b1c6-4fcf6c13e5e4/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/30484b70-7506-41b9-b1c6-4fcf6c13e5e4/permission-settings"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 16:10:18 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":{"enabled":true},"slack":{"channel":"aaa-omg-ops","workspace":"Datadog"}},"type":"team_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team/30484b70-7506-41b9-b1c6-4fcf6c13e5e4/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"5b80babd-fa31-4ab5-b180-5e36af751704","type":"team_notification_rules","attributes":{"email":{"enabled":true},"slack":{"workspace":"Datadog","channel":"aaa-omg-ops"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 16:10:18 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"pagerduty":{"service_name":"Datadog-prod"},"slack":{"channel":"aaa-governance-ops","workspace":"Datadog"}},"id":"30484b70-7506-41b9-b1c6-4fcf6c13e5e4","type":"team_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/team/30484b70-7506-41b9-b1c6-4fcf6c13e5e4/notification-rules/3d031bb2-e1da-4d34-a670-1b5557b032c9 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"409","title":"Conflict","detail":"rule id does + not match with team''s rule id"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 409 + message: Conflict +- recorded_at: Tue, 23 Dec 2025 16:10:18 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/30484b70-7506-41b9-b1c6-4fcf6c13e5e4 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/teams/Update-team-notification-rule-returns-OK-response.frozen b/cassettes/features/v2/teams/Update-team-notification-rule-returns-OK-response.frozen new file mode 100644 index 00000000000..edbc02f6ecf --- /dev/null +++ b/cassettes/features/v2/teams/Update-team-notification-rule-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-12-23T15:30:20.002Z \ No newline at end of file diff --git a/cassettes/features/v2/teams/Update-team-notification-rule-returns-OK-response.yml b/cassettes/features/v2/teams/Update-team-notification-rule-returns-OK-response.yml new file mode 100644 index 00000000000..c6d62d98306 --- /dev/null +++ b/cassettes/features/v2/teams/Update-team-notification-rule-returns-OK-response.yml @@ -0,0 +1,84 @@ +http_interactions: +- recorded_at: Tue, 23 Dec 2025 15:30:20 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"handle":"test-handle-129c4638a0cbf5ab","name":"test-name-129c4638a0cbf5ab"},"type":"team"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"b103bc00-af0b-48ee-ad0a-2cae69341320","type":"team","attributes":{"avatar":null,"banner":8,"created_at":"2025-12-23T15:30:20.131472+00:00","description":null,"handle":"test-handle-129c4638a0cbf5ab","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-12-23T15:30:20.131472+00:00","name":"test-name-129c4638a0cbf5ab","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/b103bc00-af0b-48ee-ad0a-2cae69341320/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/b103bc00-af0b-48ee-ad0a-2cae69341320/permission-settings"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 15:30:20 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"email":{"enabled":true},"slack":{"channel":"aaa-omg-ops","workspace":"Datadog"}},"type":"team_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/team/b103bc00-af0b-48ee-ad0a-2cae69341320/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"5bff55f5-6777-4494-a2bd-23e0a6a3d751","type":"team_notification_rules","attributes":{"email":{"enabled":true},"slack":{"workspace":"Datadog","channel":"aaa-omg-ops"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 23 Dec 2025 15:30:20 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"pagerduty":{"service_name":"Datadog-prod"},"slack":{"channel":"aaa-governance-ops","workspace":"Datadog"}},"id":"5bff55f5-6777-4494-a2bd-23e0a6a3d751","type":"team_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/team/b103bc00-af0b-48ee-ad0a-2cae69341320/notification-rules/5bff55f5-6777-4494-a2bd-23e0a6a3d751 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"5bff55f5-6777-4494-a2bd-23e0a6a3d751","type":"team_notification_rules","attributes":{"pagerduty":{"service_name":"Datadog-prod"},"slack":{"workspace":"Datadog","channel":"aaa-governance-ops"}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Tue, 23 Dec 2025 15:30:20 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/team/b103bc00-af0b-48ee-ad0a-2cae69341320 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/examples/v2/teams/CreateTeamNotificationRule.rb b/examples/v2/teams/CreateTeamNotificationRule.rb new file mode 100644 index 00000000000..20ae187539b --- /dev/null +++ b/examples/v2/teams/CreateTeamNotificationRule.rb @@ -0,0 +1,23 @@ +# Create team notification rule returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::TeamsAPI.new + +# there is a valid "dd_team" in the system +DD_TEAM_DATA_ID = ENV["DD_TEAM_DATA_ID"] + +body = DatadogAPIClient::V2::TeamNotificationRuleRequest.new({ + data: DatadogAPIClient::V2::TeamNotificationRule.new({ + type: DatadogAPIClient::V2::TeamNotificationRuleType::TEAM_NOTIFICATION_RULES, + attributes: DatadogAPIClient::V2::TeamNotificationRuleAttributes.new({ + email: DatadogAPIClient::V2::TeamNotificationRuleAttributesEmail.new({ + enabled: true, + }), + slack: DatadogAPIClient::V2::TeamNotificationRuleAttributesSlack.new({ + workspace: "Datadog", + channel: "aaa-omg-ops", + }), + }), + }), +}) +p api_instance.create_team_notification_rule(DD_TEAM_DATA_ID, body) diff --git a/examples/v2/teams/DeleteTeamNotificationRule.rb b/examples/v2/teams/DeleteTeamNotificationRule.rb new file mode 100644 index 00000000000..81061be6f65 --- /dev/null +++ b/examples/v2/teams/DeleteTeamNotificationRule.rb @@ -0,0 +1,11 @@ +# Delete team notification rule returns "No Content" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::TeamsAPI.new + +# there is a valid "dd_team" in the system +DD_TEAM_DATA_ID = ENV["DD_TEAM_DATA_ID"] + +# there is a valid "team_notification_rule" in the system +TEAM_NOTIFICATION_RULE_DATA_ID = ENV["TEAM_NOTIFICATION_RULE_DATA_ID"] +api_instance.delete_team_notification_rule(DD_TEAM_DATA_ID, TEAM_NOTIFICATION_RULE_DATA_ID) diff --git a/examples/v2/teams/GetTeamNotificationRule.rb b/examples/v2/teams/GetTeamNotificationRule.rb new file mode 100644 index 00000000000..23f47696654 --- /dev/null +++ b/examples/v2/teams/GetTeamNotificationRule.rb @@ -0,0 +1,11 @@ +# Get team notification rule returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::TeamsAPI.new + +# there is a valid "dd_team" in the system +DD_TEAM_DATA_ID = ENV["DD_TEAM_DATA_ID"] + +# there is a valid "team_notification_rule" in the system +TEAM_NOTIFICATION_RULE_DATA_ID = ENV["TEAM_NOTIFICATION_RULE_DATA_ID"] +p api_instance.get_team_notification_rule(DD_TEAM_DATA_ID, TEAM_NOTIFICATION_RULE_DATA_ID) diff --git a/examples/v2/teams/GetTeamNotificationRules.rb b/examples/v2/teams/GetTeamNotificationRules.rb new file mode 100644 index 00000000000..c0bebedbdd7 --- /dev/null +++ b/examples/v2/teams/GetTeamNotificationRules.rb @@ -0,0 +1,8 @@ +# Get team notification rules returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::TeamsAPI.new + +# there is a valid "dd_team" in the system +DD_TEAM_DATA_ID = ENV["DD_TEAM_DATA_ID"] +p api_instance.get_team_notification_rules(DD_TEAM_DATA_ID) diff --git a/examples/v2/teams/UpdateTeamNotificationRule.rb b/examples/v2/teams/UpdateTeamNotificationRule.rb new file mode 100644 index 00000000000..5dafeddc0c5 --- /dev/null +++ b/examples/v2/teams/UpdateTeamNotificationRule.rb @@ -0,0 +1,27 @@ +# Update team notification rule returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::TeamsAPI.new + +# there is a valid "dd_team" in the system +DD_TEAM_DATA_ID = ENV["DD_TEAM_DATA_ID"] + +# there is a valid "team_notification_rule" in the system +TEAM_NOTIFICATION_RULE_DATA_ID = ENV["TEAM_NOTIFICATION_RULE_DATA_ID"] + +body = DatadogAPIClient::V2::TeamNotificationRuleRequest.new({ + data: DatadogAPIClient::V2::TeamNotificationRule.new({ + type: DatadogAPIClient::V2::TeamNotificationRuleType::TEAM_NOTIFICATION_RULES, + id: TEAM_NOTIFICATION_RULE_DATA_ID, + attributes: DatadogAPIClient::V2::TeamNotificationRuleAttributes.new({ + pagerduty: DatadogAPIClient::V2::TeamNotificationRuleAttributesPagerduty.new({ + service_name: "Datadog-prod", + }), + slack: DatadogAPIClient::V2::TeamNotificationRuleAttributesSlack.new({ + workspace: "Datadog", + channel: "aaa-governance-ops", + }), + }), + }), +}) +p api_instance.update_team_notification_rule(DD_TEAM_DATA_ID, TEAM_NOTIFICATION_RULE_DATA_ID, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 30bfb170383..5980fcaf991 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3336,6 +3336,26 @@ "user_id" => "String", "body" => "UserTeamUpdateRequest", }, + "v2.GetTeamNotificationRules" => { + "team_id" => "String", + }, + "v2.CreateTeamNotificationRule" => { + "team_id" => "String", + "body" => "TeamNotificationRuleRequest", + }, + "v2.DeleteTeamNotificationRule" => { + "team_id" => "String", + "rule_id" => "String", + }, + "v2.GetTeamNotificationRule" => { + "team_id" => "String", + "rule_id" => "String", + }, + "v2.UpdateTeamNotificationRule" => { + "team_id" => "String", + "rule_id" => "String", + "body" => "TeamNotificationRuleRequest", + }, "v2.GetTeamPermissionSettings" => { "team_id" => "String", }, diff --git a/features/v2/given.json b/features/v2/given.json index 7b4bb83964b..aa08181879c 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -1256,6 +1256,22 @@ "tag": "Teams", "operationId": "CreateTeamMembership" }, + { + "parameters": [ + { + "name": "team_id", + "source": "dd_team.data.id" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"team_notification_rules\",\n \"attributes\": {\n \"email\": {\n \"enabled\": true\n },\n \"slack\": {\n \"workspace\": \"Datadog\",\n \"channel\": \"aaa-omg-ops\"\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"team_notification_rule\" in the system", + "key": "team_notification_rule", + "tag": "Teams", + "operationId": "CreateTeamNotificationRule" + }, { "parameters": [ { diff --git a/features/v2/teams.feature b/features/v2/teams.feature index 41b57b14746..722cc22c405 100644 --- a/features/v2/teams.feature +++ b/features/v2/teams.feature @@ -147,6 +147,25 @@ Feature: Teams And the response "data.data[0].relationships.connected_team.data.id" is equal to "@MyGitHubAccount/my-team-name" And the response "data.data[0].type" is equal to "team_connection" + @team:DataDog/aaa-omg + Scenario: Create team notification rule returns "API error response." response + Given new "CreateTeamNotificationRule" request + And there is a valid "dd_team" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And there is a valid "team_notification_rule" in the system + And body with value {"data": {"type": "team_notification_rules", "attributes": {"email": {"enabled": true}, "slack": {"workspace": "Datadog", "channel": "aaa-omg-ops"}}}} + When the request is sent + Then the response status is 409 API error response. + + @team:DataDog/aaa-omg + Scenario: Create team notification rule returns "OK" response + Given new "CreateTeamNotificationRule" request + And there is a valid "dd_team" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And body with value {"data": {"type": "team_notification_rules", "attributes": {"email": {"enabled": true}, "slack": {"workspace": "Datadog", "channel": "aaa-omg-ops"}}}} + When the request is sent + Then the response status is 201 Created + @skip @team:DataDog/aaa-omg Scenario: Delete team connections returns "Bad Request" response Given operation "DeleteTeamConnections" enabled @@ -169,6 +188,26 @@ Feature: Teams When the request is sent Then the response status is 404 Not Found + @team:DataDog/aaa-omg + Scenario: Delete team notification rule returns "API error response." response + Given new "DeleteTeamNotificationRule" request + And there is a valid "dd_team" in the system + And there is a valid "team_notification_rule" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "rule_id" parameter with value "3d031bb2-e1da-4d34-a670-1b5557b032c9" + When the request is sent + Then the response status is 404 API error response. + + @team:DataDog/aaa-omg + Scenario: Delete team notification rule returns "No Content" response + Given new "DeleteTeamNotificationRule" request + And there is a valid "dd_team" in the system + And there is a valid "team_notification_rule" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "rule_id" parameter from "team_notification_rule.data.id" + When the request is sent + Then the response status is 204 No Content + @team:DataDog/aaa-omg Scenario: Get a team hierarchy link returns "API error response." response Given new "GetTeamHierarchyLink" request @@ -355,6 +394,43 @@ Feature: Teams Then the response status is 200 OK And the response has 3 items + @team:DataDog/aaa-omg + Scenario: Get team notification rule returns "API error response." response + Given new "GetTeamNotificationRule" request + And there is a valid "dd_team" in the system + And there is a valid "team_notification_rule" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "rule_id" parameter from "dd_team.data.id" + When the request is sent + Then the response status is 404 API error response. + + @team:DataDog/aaa-omg + Scenario: Get team notification rule returns "OK" response + Given new "GetTeamNotificationRule" request + And there is a valid "dd_team" in the system + And there is a valid "team_notification_rule" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "rule_id" parameter from "team_notification_rule.data.id" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-omg + Scenario: Get team notification rules returns "API error response." response + Given new "GetTeamNotificationRules" request + And request contains "team_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 API error response. + + @team:DataDog/aaa-omg + Scenario: Get team notification rules returns "OK" response + Given new "GetTeamNotificationRules" request + And there is a valid "dd_team" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And there is a valid "team_notification_rule" in the system + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + @generated @skip @team:DataDog/aaa-omg Scenario: Get team sync configurations returns "OK" response Given new "GetTeamSync" request @@ -609,3 +685,27 @@ Feature: Teams And body with value {"data": {"attributes": {"value": "admins"}, "type": "team_permission_settings"}} When the request is sent Then the response status is 200 OK + + @team:DataDog/aaa-omg + Scenario: Update team notification rule returns "API error response." response + Given new "UpdateTeamNotificationRule" request + And there is a valid "dd_team" in the system + And there is a valid "team_notification_rule" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "rule_id" parameter with value "3d031bb2-e1da-4d34-a670-1b5557b032c9" + And body with value {"data": {"type": "team_notification_rules", "id": "{{dd_team.data.id}}", "attributes": {"pagerduty": {"service_name": "Datadog-prod"}, "slack": {"workspace": "Datadog", "channel": "aaa-governance-ops"}}}} + When the request is sent + Then the response status is 409 API error response. + + @team:DataDog/aaa-omg + Scenario: Update team notification rule returns "OK" response + Given new "UpdateTeamNotificationRule" request + And there is a valid "dd_team" in the system + And there is a valid "team_notification_rule" in the system + And request contains "team_id" parameter from "dd_team.data.id" + And request contains "rule_id" parameter from "team_notification_rule.data.id" + And body with value {"data": {"type": "team_notification_rules", "id": "{{team_notification_rule.data.id}}", "attributes": {"pagerduty": {"service_name": "Datadog-prod"}, "slack": {"workspace": "Datadog", "channel": "aaa-governance-ops"}}}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.slack.channel" is equal to "aaa-governance-ops" + And the response "data.attributes.pagerduty.service_name" is equal to "Datadog-prod" diff --git a/features/v2/undo.json b/features/v2/undo.json index 2116e11f2ae..eb43f26dbec 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -4758,6 +4758,36 @@ "type": "idempotent" } }, + "GetTeamNotificationRules": { + "tag": "Teams", + "undo": { + "type": "safe" + } + }, + "CreateTeamNotificationRule": { + "tag": "Teams", + "undo": { + "type": "safe" + } + }, + "DeleteTeamNotificationRule": { + "tag": "Teams", + "undo": { + "type": "idempotent" + } + }, + "GetTeamNotificationRule": { + "tag": "Teams", + "undo": { + "type": "safe" + } + }, + "UpdateTeamNotificationRule": { + "tag": "Teams", + "undo": { + "type": "idempotent" + } + }, "GetTeamPermissionSettings": { "tag": "Teams", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 136e5b7ed87..022391df787 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -4377,6 +4377,18 @@ def overrides "v2.team_link_response" => "TeamLinkResponse", "v2.team_links_response" => "TeamLinksResponse", "v2.team_link_type" => "TeamLinkType", + "v2.team_notification_rule" => "TeamNotificationRule", + "v2.team_notification_rule_attributes" => "TeamNotificationRuleAttributes", + "v2.team_notification_rule_attributes_email" => "TeamNotificationRuleAttributesEmail", + "v2.team_notification_rule_attributes_ms_teams" => "TeamNotificationRuleAttributesMsTeams", + "v2.team_notification_rule_attributes_pagerduty" => "TeamNotificationRuleAttributesPagerduty", + "v2.team_notification_rule_attributes_slack" => "TeamNotificationRuleAttributesSlack", + "v2.team_notification_rule_request" => "TeamNotificationRuleRequest", + "v2.team_notification_rule_response" => "TeamNotificationRuleResponse", + "v2.team_notification_rules_response" => "TeamNotificationRulesResponse", + "v2.team_notification_rules_response_meta" => "TeamNotificationRulesResponseMeta", + "v2.team_notification_rules_response_meta_page" => "TeamNotificationRulesResponseMetaPage", + "v2.team_notification_rule_type" => "TeamNotificationRuleType", "v2.team_on_call_responders" => "TeamOnCallResponders", "v2.team_on_call_responders_data" => "TeamOnCallRespondersData", "v2.team_on_call_responders_data_relationships" => "TeamOnCallRespondersDataRelationships", diff --git a/lib/datadog_api_client/v2/api/teams_api.rb b/lib/datadog_api_client/v2/api/teams_api.rb index 4403821b379..5e6e724b8be 100644 --- a/lib/datadog_api_client/v2/api/teams_api.rb +++ b/lib/datadog_api_client/v2/api/teams_api.rb @@ -455,6 +455,75 @@ def create_team_membership_with_http_info(team_id, body, opts = {}) return data, status_code, headers end + # Create team notification rule. + # + # @see #create_team_notification_rule_with_http_info + def create_team_notification_rule(team_id, body, opts = {}) + data, _status_code, _headers = create_team_notification_rule_with_http_info(team_id, body, opts) + data + end + + # Create team notification rule. + # @param team_id [String] None + # @param body [TeamNotificationRuleRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(TeamNotificationRuleResponse, Integer, Hash)>] TeamNotificationRuleResponse data, response status code and response headers + def create_team_notification_rule_with_http_info(team_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TeamsAPI.create_team_notification_rule ...' + end + # verify the required parameter 'team_id' is set + if @api_client.config.client_side_validation && team_id.nil? + fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.create_team_notification_rule" + 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 TeamsAPI.create_team_notification_rule" + end + # resource path + local_var_path = '/api/v2/team/{team_id}/notification-rules'.sub('{team_id}', CGI.escape(team_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] || 'TeamNotificationRuleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_team_notification_rule, + :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: TeamsAPI#create_team_notification_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Remove a team. # # @see #delete_team_with_http_info @@ -729,6 +798,73 @@ def delete_team_membership_with_http_info(team_id, user_id, opts = {}) return data, status_code, headers end + # Delete team notification rule. + # + # @see #delete_team_notification_rule_with_http_info + def delete_team_notification_rule(team_id, rule_id, opts = {}) + delete_team_notification_rule_with_http_info(team_id, rule_id, opts) + nil + end + + # Delete team notification rule. + # @param team_id [String] None + # @param rule_id [String] None + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_team_notification_rule_with_http_info(team_id, rule_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TeamsAPI.delete_team_notification_rule ...' + end + # verify the required parameter 'team_id' is set + if @api_client.config.client_side_validation && team_id.nil? + fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.delete_team_notification_rule" + end + # verify the required parameter 'rule_id' is set + if @api_client.config.client_side_validation && rule_id.nil? + fail ArgumentError, "Missing the required parameter 'rule_id' when calling TeamsAPI.delete_team_notification_rule" + end + # resource path + local_var_path = '/api/v2/team/{team_id}/notification-rules/{rule_id}'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')).sub('{rule_id}', CGI.escape(rule_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_team_notification_rule, + :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: TeamsAPI#delete_team_notification_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get a team. # # @see #get_team_with_http_info @@ -1093,6 +1229,135 @@ def get_team_memberships_with_pagination(team_id, opts = {}) end end + # Get team notification rule. + # + # @see #get_team_notification_rule_with_http_info + def get_team_notification_rule(team_id, rule_id, opts = {}) + data, _status_code, _headers = get_team_notification_rule_with_http_info(team_id, rule_id, opts) + data + end + + # Get team notification rule. + # @param team_id [String] None + # @param rule_id [String] None + # @param opts [Hash] the optional parameters + # @return [Array<(TeamNotificationRuleResponse, Integer, Hash)>] TeamNotificationRuleResponse data, response status code and response headers + def get_team_notification_rule_with_http_info(team_id, rule_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TeamsAPI.get_team_notification_rule ...' + end + # verify the required parameter 'team_id' is set + if @api_client.config.client_side_validation && team_id.nil? + fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.get_team_notification_rule" + end + # verify the required parameter 'rule_id' is set + if @api_client.config.client_side_validation && rule_id.nil? + fail ArgumentError, "Missing the required parameter 'rule_id' when calling TeamsAPI.get_team_notification_rule" + end + # resource path + local_var_path = '/api/v2/team/{team_id}/notification-rules/{rule_id}'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')).sub('{rule_id}', CGI.escape(rule_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] || 'TeamNotificationRuleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_team_notification_rule, + :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: TeamsAPI#get_team_notification_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get team notification rules. + # + # @see #get_team_notification_rules_with_http_info + def get_team_notification_rules(team_id, opts = {}) + data, _status_code, _headers = get_team_notification_rules_with_http_info(team_id, opts) + data + end + + # Get team notification rules. + # @param team_id [String] None + # @param opts [Hash] the optional parameters + # @return [Array<(TeamNotificationRulesResponse, Integer, Hash)>] TeamNotificationRulesResponse data, response status code and response headers + def get_team_notification_rules_with_http_info(team_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TeamsAPI.get_team_notification_rules ...' + end + # verify the required parameter 'team_id' is set + if @api_client.config.client_side_validation && team_id.nil? + fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.get_team_notification_rules" + end + # resource path + local_var_path = '/api/v2/team/{team_id}/notification-rules'.sub('{team_id}', CGI.escape(team_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] || 'TeamNotificationRulesResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_team_notification_rules, + :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: TeamsAPI#get_team_notification_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get permission settings for a team. # # @see #get_team_permission_settings_with_http_info @@ -2138,6 +2403,80 @@ def update_team_membership_with_http_info(team_id, user_id, body, opts = {}) return data, status_code, headers end + # Update team notification rule. + # + # @see #update_team_notification_rule_with_http_info + def update_team_notification_rule(team_id, rule_id, body, opts = {}) + data, _status_code, _headers = update_team_notification_rule_with_http_info(team_id, rule_id, body, opts) + data + end + + # Update team notification rule. + # @param team_id [String] None + # @param rule_id [String] None + # @param body [TeamNotificationRuleRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(TeamNotificationRuleResponse, Integer, Hash)>] TeamNotificationRuleResponse data, response status code and response headers + def update_team_notification_rule_with_http_info(team_id, rule_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: TeamsAPI.update_team_notification_rule ...' + end + # verify the required parameter 'team_id' is set + if @api_client.config.client_side_validation && team_id.nil? + fail ArgumentError, "Missing the required parameter 'team_id' when calling TeamsAPI.update_team_notification_rule" + end + # verify the required parameter 'rule_id' is set + if @api_client.config.client_side_validation && rule_id.nil? + fail ArgumentError, "Missing the required parameter 'rule_id' when calling TeamsAPI.update_team_notification_rule" + 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 TeamsAPI.update_team_notification_rule" + end + # resource path + local_var_path = '/api/v2/team/{team_id}/notification-rules/{rule_id}'.sub('{team_id}', CGI.escape(team_id.to_s).gsub('%2F', '/')).sub('{rule_id}', CGI.escape(rule_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] || 'TeamNotificationRuleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_team_notification_rule, + :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::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: TeamsAPI#update_team_notification_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update permission setting for team. # # @see #update_team_permission_setting_with_http_info diff --git a/lib/datadog_api_client/v2/models/team_notification_rule.rb b/lib/datadog_api_client/v2/models/team_notification_rule.rb new file mode 100644 index 00000000000..dd459d726be --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_notification_rule.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 + # Team notification rule + class TeamNotificationRule + include BaseGenericModel + + # Team notification rule attributes + attr_reader :attributes + + # The identifier of the team notification rule + attr_accessor :id + + # Team notification rule type + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'TeamNotificationRuleAttributes', + :'id' => :'String', + :'type' => :'TeamNotificationRuleType' + } + 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::TeamNotificationRule` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @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 + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_notification_rule_attributes.rb b/lib/datadog_api_client/v2/models/team_notification_rule_attributes.rb new file mode 100644 index 00000000000..91499b185ab --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_notification_rule_attributes.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Team notification rule attributes + class TeamNotificationRuleAttributes + include BaseGenericModel + + # Email notification settings for the team + attr_accessor :email + + # MS Teams notification settings for the team + attr_accessor :ms_teams + + # PagerDuty notification settings for the team + attr_accessor :pagerduty + + # Slack notification settings for the team + attr_accessor :slack + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'email' => :'email', + :'ms_teams' => :'ms_teams', + :'pagerduty' => :'pagerduty', + :'slack' => :'slack' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'email' => :'TeamNotificationRuleAttributesEmail', + :'ms_teams' => :'TeamNotificationRuleAttributesMsTeams', + :'pagerduty' => :'TeamNotificationRuleAttributesPagerduty', + :'slack' => :'TeamNotificationRuleAttributesSlack' + } + 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::TeamNotificationRuleAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'ms_teams') + self.ms_teams = attributes[:'ms_teams'] + end + + if attributes.key?(:'pagerduty') + self.pagerduty = attributes[:'pagerduty'] + end + + if attributes.key?(:'slack') + self.slack = attributes[:'slack'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + email == o.email && + ms_teams == o.ms_teams && + pagerduty == o.pagerduty && + slack == o.slack && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [email, ms_teams, pagerduty, slack, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_notification_rule_attributes_email.rb b/lib/datadog_api_client/v2/models/team_notification_rule_attributes_email.rb new file mode 100644 index 00000000000..8c82fdeb13c --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_notification_rule_attributes_email.rb @@ -0,0 +1,105 @@ +=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 + # Email notification settings for the team + class TeamNotificationRuleAttributesEmail + include BaseGenericModel + + # Flag indicating email notification + attr_accessor :enabled + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'enabled' => :'enabled' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'enabled' => :'Boolean' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TeamNotificationRuleAttributesEmail` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [enabled, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_notification_rule_attributes_ms_teams.rb b/lib/datadog_api_client/v2/models/team_notification_rule_attributes_ms_teams.rb new file mode 100644 index 00000000000..a76207b92a6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_notification_rule_attributes_ms_teams.rb @@ -0,0 +1,105 @@ +=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 + # MS Teams notification settings for the team + class TeamNotificationRuleAttributesMsTeams + include BaseGenericModel + + # Handle for MS Teams + attr_accessor :connector_name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'connector_name' => :'connector_name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'connector_name' => :'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::TeamNotificationRuleAttributesMsTeams` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'connector_name') + self.connector_name = attributes[:'connector_name'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + connector_name == o.connector_name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [connector_name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_notification_rule_attributes_pagerduty.rb b/lib/datadog_api_client/v2/models/team_notification_rule_attributes_pagerduty.rb new file mode 100644 index 00000000000..8b61e9ff0c9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_notification_rule_attributes_pagerduty.rb @@ -0,0 +1,105 @@ +=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 + # PagerDuty notification settings for the team + class TeamNotificationRuleAttributesPagerduty + include BaseGenericModel + + # Service name for PagerDuty + attr_accessor :service_name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'service_name' => :'service_name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'service_name' => :'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::TeamNotificationRuleAttributesPagerduty` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'service_name') + self.service_name = attributes[:'service_name'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + service_name == o.service_name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [service_name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_notification_rule_attributes_slack.rb b/lib/datadog_api_client/v2/models/team_notification_rule_attributes_slack.rb new file mode 100644 index 00000000000..0045b3120d3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_notification_rule_attributes_slack.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Slack notification settings for the team + class TeamNotificationRuleAttributesSlack + include BaseGenericModel + + # Channel for Slack notification + attr_accessor :channel + + # Workspace for Slack notification + attr_accessor :workspace + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'channel' => :'channel', + :'workspace' => :'workspace' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'channel' => :'String', + :'workspace' => :'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::TeamNotificationRuleAttributesSlack` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'workspace') + self.workspace = attributes[:'workspace'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + channel == o.channel && + workspace == o.workspace && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [channel, workspace, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_notification_rule_request.rb b/lib/datadog_api_client/v2/models/team_notification_rule_request.rb new file mode 100644 index 00000000000..72d12950abf --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_notification_rule_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request to create or update a team notification rule + class TeamNotificationRuleRequest + include BaseGenericModel + + # Team notification rule + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TeamNotificationRule' + } + 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::TeamNotificationRuleRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_notification_rule_response.rb b/lib/datadog_api_client/v2/models/team_notification_rule_response.rb new file mode 100644 index 00000000000..050f3763070 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_notification_rule_response.rb @@ -0,0 +1,105 @@ +=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 + # Team notification rule response + class TeamNotificationRuleResponse + include BaseGenericModel + + # Team notification rule + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'TeamNotificationRule' + } + 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::TeamNotificationRuleResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_notification_rule_type.rb b/lib/datadog_api_client/v2/models/team_notification_rule_type.rb new file mode 100644 index 00000000000..b8ae46e2c99 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_notification_rule_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Team notification rule type + class TeamNotificationRuleType + include BaseEnumModel + + TEAM_NOTIFICATION_RULES = "team_notification_rules".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/team_notification_rules_response.rb b/lib/datadog_api_client/v2/models/team_notification_rules_response.rb new file mode 100644 index 00000000000..72724723469 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_notification_rules_response.rb @@ -0,0 +1,117 @@ +=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 + # Team notification rules response + class TeamNotificationRulesResponse + include BaseGenericModel + + # Team notification rules response data + attr_accessor :data + + # Metadata that is included in the response when querying the team notification rules + attr_accessor :meta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'meta' => :'TeamNotificationRulesResponseMeta' + } + 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::TeamNotificationRulesResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + meta == o.meta && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, meta, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_notification_rules_response_meta.rb b/lib/datadog_api_client/v2/models/team_notification_rules_response_meta.rb new file mode 100644 index 00000000000..3cd14183654 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_notification_rules_response_meta.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Metadata that is included in the response when querying the team notification rules + class TeamNotificationRulesResponseMeta + include BaseGenericModel + + # Metadata related to paging information that is included in the response when querying the team notification rules + attr_accessor :page + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'page' => :'page' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'page' => :'TeamNotificationRulesResponseMetaPage' + } + 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::TeamNotificationRulesResponseMeta` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'page') + self.page = attributes[:'page'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + page == o.page && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [page, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/team_notification_rules_response_meta_page.rb b/lib/datadog_api_client/v2/models/team_notification_rules_response_meta_page.rb new file mode 100644 index 00000000000..2d50b105cd8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/team_notification_rules_response_meta_page.rb @@ -0,0 +1,184 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Metadata related to paging information that is included in the response when querying the team notification rules + class TeamNotificationRulesResponseMetaPage + include BaseGenericModel + + # The first offset. + attr_accessor :first_offset + + # The last offset. + attr_accessor :last_offset + + # Pagination limit. + attr_accessor :limit + + # The next offset. + attr_accessor :next_offset + + # The offset. + attr_accessor :offset + + # The previous offset. + attr_accessor :prev_offset + + # Total results. + attr_accessor :total + + # Offset type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'first_offset' => :'first_offset', + :'last_offset' => :'last_offset', + :'limit' => :'limit', + :'next_offset' => :'next_offset', + :'offset' => :'offset', + :'prev_offset' => :'prev_offset', + :'total' => :'total', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'first_offset' => :'Integer', + :'last_offset' => :'Integer', + :'limit' => :'Integer', + :'next_offset' => :'Integer', + :'offset' => :'Integer', + :'prev_offset' => :'Integer', + :'total' => :'Integer', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'next_offset', + :'prev_offset', + ]) + 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::TeamNotificationRulesResponseMetaPage` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'first_offset') + self.first_offset = attributes[:'first_offset'] + end + + if attributes.key?(:'last_offset') + self.last_offset = attributes[:'last_offset'] + end + + if attributes.key?(:'limit') + self.limit = attributes[:'limit'] + end + + if attributes.key?(:'next_offset') + self.next_offset = attributes[:'next_offset'] + end + + if attributes.key?(:'offset') + self.offset = attributes[:'offset'] + end + + if attributes.key?(:'prev_offset') + self.prev_offset = attributes[:'prev_offset'] + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + first_offset == o.first_offset && + last_offset == o.last_offset && + limit == o.limit && + next_offset == o.next_offset && + offset == o.offset && + prev_offset == o.prev_offset && + total == o.total && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [first_offset, last_offset, limit, next_offset, offset, prev_offset, total, type, additional_properties].hash + end + end +end