From 025ea7cd23e29441ff4b6712df3de63ae5a83a92 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 22 Dec 2025 16:16:33 +0000 Subject: [PATCH] Regenerate client from commit 01101e0 of spec repo --- .generator/schemas/v2/openapi.yaml | 327 ++++++++++++++++++ docs/datadog_api_client.v2.model.rst | 56 +++ .../v2/teams/CreateTeamNotificationRule.py | 31 ++ .../v2/teams/DeleteTeamNotificationRule.py | 14 + examples/v2/teams/GetTeamNotificationRule.py | 16 + examples/v2/teams/GetTeamNotificationRules.py | 15 + .../v2/teams/UpdateTeamNotificationRule.py | 31 ++ src/datadog_api_client/v2/api/teams_api.py | 239 +++++++++++++ .../v2/model/team_notification_rule.py | 54 +++ .../team_notification_rule_attributes.py | 88 +++++ ...team_notification_rule_attributes_email.py | 36 ++ ...m_notification_rule_attributes_ms_teams.py | 36 ++ ..._notification_rule_attributes_pagerduty.py | 36 ++ ...team_notification_rule_attributes_slack.py | 43 +++ .../model/team_notification_rules_response.py | 56 +++ .../team_notification_rules_response_meta.py | 97 ++++++ src/datadog_api_client/v2/models/__init__.py | 18 + tests/v2/features/teams.feature | 80 +++++ tests/v2/features/undo.json | 41 +++ 19 files changed, 1314 insertions(+) create mode 100644 examples/v2/teams/CreateTeamNotificationRule.py create mode 100644 examples/v2/teams/DeleteTeamNotificationRule.py create mode 100644 examples/v2/teams/GetTeamNotificationRule.py create mode 100644 examples/v2/teams/GetTeamNotificationRules.py create mode 100644 examples/v2/teams/UpdateTeamNotificationRule.py create mode 100644 src/datadog_api_client/v2/model/team_notification_rule.py create mode 100644 src/datadog_api_client/v2/model/team_notification_rule_attributes.py create mode 100644 src/datadog_api_client/v2/model/team_notification_rule_attributes_email.py create mode 100644 src/datadog_api_client/v2/model/team_notification_rule_attributes_ms_teams.py create mode 100644 src/datadog_api_client/v2/model/team_notification_rule_attributes_pagerduty.py create mode 100644 src/datadog_api_client/v2/model/team_notification_rule_attributes_slack.py create mode 100644 src/datadog_api_client/v2/model/team_notification_rules_response.py create mode 100644 src/datadog_api_client/v2/model/team_notification_rules_response_meta.py diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index cfbcb7286a..f271758322 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -54290,6 +54290,109 @@ 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: 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 + 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 related to paging information that is included in the + response when querying the team notification rules + properties: + first_number: + description: First page number. + format: int64 + type: integer + last_number: + description: Last page number. + format: int64 + type: integer + next_number: + description: Next page number. + format: int64 + nullable: true + type: integer + number: + description: Page number. + format: int64 + type: integer + prev_number: + description: Previous page number. + format: int64 + nullable: true + type: integer + size: + description: Page size. + format: int64 + type: integer + total: + description: Total number of results. + format: int64 + type: integer + type: + description: Pagination type. + example: number_size + type: string + type: object TeamOnCallResponders: description: Root object representing a team's on-call responder configuration. example: @@ -86882,6 +86985,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/TeamNotificationRule' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamNotificationRule' + 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: rule_id + required: true + schema: + type: string + - description: None + in: path + name: team_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: rule_id + required: true + schema: + type: string + - description: None + in: path + name: team_id + required: true + schema: + type: string + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamNotificationRule' + 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: rule_id + required: true + schema: + type: string + - description: None + in: path + name: team_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TeamNotificationRule' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamNotificationRule' + 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/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 6220d558aa..111b17c52b 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -23923,6 +23923,62 @@ datadog\_api\_client.v2.model.team\_links\_response module :members: :show-inheritance: +datadog\_api\_client.v2.model.team\_notification\_rule module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.team_notification_rule + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.team\_notification\_rule\_attributes module +------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.team_notification_rule_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.team\_notification\_rule\_attributes\_email module +-------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.team_notification_rule_attributes_email + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.team\_notification\_rule\_attributes\_ms\_teams module +------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.team_notification_rule_attributes_ms_teams + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.team\_notification\_rule\_attributes\_pagerduty module +------------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.team_notification_rule_attributes_pagerduty + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.team\_notification\_rule\_attributes\_slack module +-------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.team_notification_rule_attributes_slack + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.team\_notification\_rules\_response module +------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.team_notification_rules_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.team\_notification\_rules\_response\_meta module +------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.team_notification_rules_response_meta + :members: + :show-inheritance: + datadog\_api\_client.v2.model.team\_on\_call\_responders module --------------------------------------------------------------- diff --git a/examples/v2/teams/CreateTeamNotificationRule.py b/examples/v2/teams/CreateTeamNotificationRule.py new file mode 100644 index 0000000000..cf1bb6c44f --- /dev/null +++ b/examples/v2/teams/CreateTeamNotificationRule.py @@ -0,0 +1,31 @@ +""" +Create team notification rule returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.teams_api import TeamsApi +from datadog_api_client.v2.model.team_notification_rule import TeamNotificationRule +from datadog_api_client.v2.model.team_notification_rule_attributes import TeamNotificationRuleAttributes +from datadog_api_client.v2.model.team_notification_rule_attributes_email import TeamNotificationRuleAttributesEmail +from datadog_api_client.v2.model.team_notification_rule_attributes_ms_teams import TeamNotificationRuleAttributesMsTeams +from datadog_api_client.v2.model.team_notification_rule_attributes_pagerduty import ( + TeamNotificationRuleAttributesPagerduty, +) +from datadog_api_client.v2.model.team_notification_rule_attributes_slack import TeamNotificationRuleAttributesSlack + +body = TeamNotificationRule( + attributes=TeamNotificationRuleAttributes( + email=TeamNotificationRuleAttributesEmail(), + ms_teams=TeamNotificationRuleAttributesMsTeams(), + pagerduty=TeamNotificationRuleAttributesPagerduty(), + slack=TeamNotificationRuleAttributesSlack(), + ), + id="b8626d7e-cedd-11eb-abf5-da7ad0900001", +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = TeamsApi(api_client) + response = api_instance.create_team_notification_rule(team_id="team_id", body=body) + + print(response) diff --git a/examples/v2/teams/DeleteTeamNotificationRule.py b/examples/v2/teams/DeleteTeamNotificationRule.py new file mode 100644 index 0000000000..cb449a4609 --- /dev/null +++ b/examples/v2/teams/DeleteTeamNotificationRule.py @@ -0,0 +1,14 @@ +""" +Delete team notification rule returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.teams_api import TeamsApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = TeamsApi(api_client) + api_instance.delete_team_notification_rule( + rule_id="rule_id", + team_id="team_id", + ) diff --git a/examples/v2/teams/GetTeamNotificationRule.py b/examples/v2/teams/GetTeamNotificationRule.py new file mode 100644 index 0000000000..127e90a94d --- /dev/null +++ b/examples/v2/teams/GetTeamNotificationRule.py @@ -0,0 +1,16 @@ +""" +Get team notification rule returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.teams_api import TeamsApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = TeamsApi(api_client) + response = api_instance.get_team_notification_rule( + rule_id="rule_id", + team_id="team_id", + ) + + print(response) diff --git a/examples/v2/teams/GetTeamNotificationRules.py b/examples/v2/teams/GetTeamNotificationRules.py new file mode 100644 index 0000000000..1a1d17e064 --- /dev/null +++ b/examples/v2/teams/GetTeamNotificationRules.py @@ -0,0 +1,15 @@ +""" +Get team notification rules returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.teams_api import TeamsApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = TeamsApi(api_client) + response = api_instance.get_team_notification_rules( + team_id="team_id", + ) + + print(response) diff --git a/examples/v2/teams/UpdateTeamNotificationRule.py b/examples/v2/teams/UpdateTeamNotificationRule.py new file mode 100644 index 0000000000..b5100c3718 --- /dev/null +++ b/examples/v2/teams/UpdateTeamNotificationRule.py @@ -0,0 +1,31 @@ +""" +Update team notification rule returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.teams_api import TeamsApi +from datadog_api_client.v2.model.team_notification_rule import TeamNotificationRule +from datadog_api_client.v2.model.team_notification_rule_attributes import TeamNotificationRuleAttributes +from datadog_api_client.v2.model.team_notification_rule_attributes_email import TeamNotificationRuleAttributesEmail +from datadog_api_client.v2.model.team_notification_rule_attributes_ms_teams import TeamNotificationRuleAttributesMsTeams +from datadog_api_client.v2.model.team_notification_rule_attributes_pagerduty import ( + TeamNotificationRuleAttributesPagerduty, +) +from datadog_api_client.v2.model.team_notification_rule_attributes_slack import TeamNotificationRuleAttributesSlack + +body = TeamNotificationRule( + attributes=TeamNotificationRuleAttributes( + email=TeamNotificationRuleAttributesEmail(), + ms_teams=TeamNotificationRuleAttributesMsTeams(), + pagerduty=TeamNotificationRuleAttributesPagerduty(), + slack=TeamNotificationRuleAttributesSlack(), + ), + id="b8626d7e-cedd-11eb-abf5-da7ad0900001", +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = TeamsApi(api_client) + response = api_instance.update_team_notification_rule(rule_id="rule_id", team_id="team_id", body=body) + + print(response) diff --git a/src/datadog_api_client/v2/api/teams_api.py b/src/datadog_api_client/v2/api/teams_api.py index 2cdd66167e..56bd498a83 100644 --- a/src/datadog_api_client/v2/api/teams_api.py +++ b/src/datadog_api_client/v2/api/teams_api.py @@ -44,6 +44,8 @@ from datadog_api_client.v2.model.user_team_response import UserTeamResponse from datadog_api_client.v2.model.user_team_request import UserTeamRequest from datadog_api_client.v2.model.user_team_update_request import UserTeamUpdateRequest +from datadog_api_client.v2.model.team_notification_rules_response import TeamNotificationRulesResponse +from datadog_api_client.v2.model.team_notification_rule import TeamNotificationRule from datadog_api_client.v2.model.team_permission_settings_response import TeamPermissionSettingsResponse from datadog_api_client.v2.model.team_permission_setting_response import TeamPermissionSettingResponse from datadog_api_client.v2.model.team_permission_setting_update_request import TeamPermissionSettingUpdateRequest @@ -197,6 +199,32 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_team_notification_rule_endpoint = _Endpoint( + settings={ + "response_type": (TeamNotificationRule,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/team/{team_id}/notification-rules", + "operation_id": "create_team_notification_rule", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "team_id": { + "required": True, + "openapi_types": (str,), + "attribute": "team_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (TeamNotificationRule,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._delete_team_endpoint = _Endpoint( settings={ "response_type": None, @@ -298,6 +326,35 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_team_notification_rule_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/team/{team_id}/notification-rules/{rule_id}", + "operation_id": "delete_team_notification_rule", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "rule_id": { + "required": True, + "openapi_types": (str,), + "attribute": "rule_id", + "location": "path", + }, + "team_id": { + "required": True, + "openapi_types": (str,), + "attribute": "team_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._get_team_endpoint = _Endpoint( settings={ "response_type": (TeamResponse,), @@ -439,6 +496,58 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_team_notification_rule_endpoint = _Endpoint( + settings={ + "response_type": (TeamNotificationRule,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/team/{team_id}/notification-rules/{rule_id}", + "operation_id": "get_team_notification_rule", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "rule_id": { + "required": True, + "openapi_types": (str,), + "attribute": "rule_id", + "location": "path", + }, + "team_id": { + "required": True, + "openapi_types": (str,), + "attribute": "team_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._get_team_notification_rules_endpoint = _Endpoint( + settings={ + "response_type": (TeamNotificationRulesResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/team/{team_id}/notification-rules", + "operation_id": "get_team_notification_rules", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "team_id": { + "required": True, + "openapi_types": (str,), + "attribute": "team_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._get_team_permission_settings_endpoint = _Endpoint( settings={ "response_type": (TeamPermissionSettingsResponse,), @@ -851,6 +960,38 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._update_team_notification_rule_endpoint = _Endpoint( + settings={ + "response_type": (TeamNotificationRule,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/team/{team_id}/notification-rules/{rule_id}", + "operation_id": "update_team_notification_rule", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "rule_id": { + "required": True, + "openapi_types": (str,), + "attribute": "rule_id", + "location": "path", + }, + "team_id": { + "required": True, + "openapi_types": (str,), + "attribute": "team_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (TeamNotificationRule,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._update_team_permission_setting_endpoint = _Endpoint( settings={ "response_type": (TeamPermissionSettingResponse,), @@ -1001,6 +1142,25 @@ def create_team_membership( return self._create_team_membership_endpoint.call_with_http_info(**kwargs) + def create_team_notification_rule( + self, + team_id: str, + body: TeamNotificationRule, + ) -> TeamNotificationRule: + """Create team notification rule. + + :param team_id: None + :type team_id: str + :type body: TeamNotificationRule + :rtype: TeamNotificationRule + """ + kwargs: Dict[str, Any] = {} + kwargs["team_id"] = team_id + + kwargs["body"] = body + + return self._create_team_notification_rule_endpoint.call_with_http_info(**kwargs) + def delete_team( self, team_id: str, @@ -1080,6 +1240,26 @@ def delete_team_membership( return self._delete_team_membership_endpoint.call_with_http_info(**kwargs) + def delete_team_notification_rule( + self, + rule_id: str, + team_id: str, + ) -> None: + """Delete team notification rule. + + :param rule_id: None + :type rule_id: str + :param team_id: None + :type team_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["rule_id"] = rule_id + + kwargs["team_id"] = team_id + + return self._delete_team_notification_rule_endpoint.call_with_http_info(**kwargs) + def get_team( self, team_id: str, @@ -1249,6 +1429,41 @@ def get_team_memberships_with_pagination( } return endpoint.call_with_http_info_paginated(pagination) + def get_team_notification_rule( + self, + rule_id: str, + team_id: str, + ) -> TeamNotificationRule: + """Get team notification rule. + + :param rule_id: None + :type rule_id: str + :param team_id: None + :type team_id: str + :rtype: TeamNotificationRule + """ + kwargs: Dict[str, Any] = {} + kwargs["rule_id"] = rule_id + + kwargs["team_id"] = team_id + + return self._get_team_notification_rule_endpoint.call_with_http_info(**kwargs) + + def get_team_notification_rules( + self, + team_id: str, + ) -> TeamNotificationRulesResponse: + """Get team notification rules. + + :param team_id: None + :type team_id: str + :rtype: TeamNotificationRulesResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["team_id"] = team_id + + return self._get_team_notification_rules_endpoint.call_with_http_info(**kwargs) + def get_team_permission_settings( self, team_id: str, @@ -1852,6 +2067,30 @@ def update_team_membership( return self._update_team_membership_endpoint.call_with_http_info(**kwargs) + def update_team_notification_rule( + self, + rule_id: str, + team_id: str, + body: TeamNotificationRule, + ) -> TeamNotificationRule: + """Update team notification rule. + + :param rule_id: None + :type rule_id: str + :param team_id: None + :type team_id: str + :type body: TeamNotificationRule + :rtype: TeamNotificationRule + """ + kwargs: Dict[str, Any] = {} + kwargs["rule_id"] = rule_id + + kwargs["team_id"] = team_id + + kwargs["body"] = body + + return self._update_team_notification_rule_endpoint.call_with_http_info(**kwargs) + def update_team_permission_setting( self, team_id: str, diff --git a/src/datadog_api_client/v2/model/team_notification_rule.py b/src/datadog_api_client/v2/model/team_notification_rule.py new file mode 100644 index 0000000000..10abc2f799 --- /dev/null +++ b/src/datadog_api_client/v2/model/team_notification_rule.py @@ -0,0 +1,54 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.team_notification_rule_attributes import TeamNotificationRuleAttributes + + +class TeamNotificationRule(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.team_notification_rule_attributes import TeamNotificationRuleAttributes + + return { + "attributes": (TeamNotificationRuleAttributes,), + "id": (str,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + } + + def __init__( + self_, + attributes: Union[TeamNotificationRuleAttributes, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Team notification rule + + :param attributes: Team notification rule attributes + :type attributes: TeamNotificationRuleAttributes, optional + + :param id: The identifier of the team notification rule + :type id: str, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/team_notification_rule_attributes.py b/src/datadog_api_client/v2/model/team_notification_rule_attributes.py new file mode 100644 index 0000000000..dd2aff8f73 --- /dev/null +++ b/src/datadog_api_client/v2/model/team_notification_rule_attributes.py @@ -0,0 +1,88 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.team_notification_rule_attributes_email import TeamNotificationRuleAttributesEmail + from datadog_api_client.v2.model.team_notification_rule_attributes_ms_teams import ( + TeamNotificationRuleAttributesMsTeams, + ) + from datadog_api_client.v2.model.team_notification_rule_attributes_pagerduty import ( + TeamNotificationRuleAttributesPagerduty, + ) + from datadog_api_client.v2.model.team_notification_rule_attributes_slack import TeamNotificationRuleAttributesSlack + + +class TeamNotificationRuleAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.team_notification_rule_attributes_email import ( + TeamNotificationRuleAttributesEmail, + ) + from datadog_api_client.v2.model.team_notification_rule_attributes_ms_teams import ( + TeamNotificationRuleAttributesMsTeams, + ) + from datadog_api_client.v2.model.team_notification_rule_attributes_pagerduty import ( + TeamNotificationRuleAttributesPagerduty, + ) + from datadog_api_client.v2.model.team_notification_rule_attributes_slack import ( + TeamNotificationRuleAttributesSlack, + ) + + return { + "email": (TeamNotificationRuleAttributesEmail,), + "ms_teams": (TeamNotificationRuleAttributesMsTeams,), + "pagerduty": (TeamNotificationRuleAttributesPagerduty,), + "slack": (TeamNotificationRuleAttributesSlack,), + } + + attribute_map = { + "email": "email", + "ms_teams": "ms_teams", + "pagerduty": "pagerduty", + "slack": "slack", + } + + def __init__( + self_, + email: Union[TeamNotificationRuleAttributesEmail, UnsetType] = unset, + ms_teams: Union[TeamNotificationRuleAttributesMsTeams, UnsetType] = unset, + pagerduty: Union[TeamNotificationRuleAttributesPagerduty, UnsetType] = unset, + slack: Union[TeamNotificationRuleAttributesSlack, UnsetType] = unset, + **kwargs, + ): + """ + Team notification rule attributes + + :param email: Email notification settings for the team + :type email: TeamNotificationRuleAttributesEmail, optional + + :param ms_teams: MS Teams notification settings for the team + :type ms_teams: TeamNotificationRuleAttributesMsTeams, optional + + :param pagerduty: PagerDuty notification settings for the team + :type pagerduty: TeamNotificationRuleAttributesPagerduty, optional + + :param slack: Slack notification settings for the team + :type slack: TeamNotificationRuleAttributesSlack, optional + """ + if email is not unset: + kwargs["email"] = email + if ms_teams is not unset: + kwargs["ms_teams"] = ms_teams + if pagerduty is not unset: + kwargs["pagerduty"] = pagerduty + if slack is not unset: + kwargs["slack"] = slack + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/team_notification_rule_attributes_email.py b/src/datadog_api_client/v2/model/team_notification_rule_attributes_email.py new file mode 100644 index 0000000000..6d734cc25d --- /dev/null +++ b/src/datadog_api_client/v2/model/team_notification_rule_attributes_email.py @@ -0,0 +1,36 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class TeamNotificationRuleAttributesEmail(ModelNormal): + @cached_property + def openapi_types(_): + return { + "enabled": (bool,), + } + + attribute_map = { + "enabled": "enabled", + } + + def __init__(self_, enabled: Union[bool, UnsetType] = unset, **kwargs): + """ + Email notification settings for the team + + :param enabled: Flag indicating email notification + :type enabled: bool, optional + """ + if enabled is not unset: + kwargs["enabled"] = enabled + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/team_notification_rule_attributes_ms_teams.py b/src/datadog_api_client/v2/model/team_notification_rule_attributes_ms_teams.py new file mode 100644 index 0000000000..7d600ad076 --- /dev/null +++ b/src/datadog_api_client/v2/model/team_notification_rule_attributes_ms_teams.py @@ -0,0 +1,36 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class TeamNotificationRuleAttributesMsTeams(ModelNormal): + @cached_property + def openapi_types(_): + return { + "connector_name": (str,), + } + + attribute_map = { + "connector_name": "connector_name", + } + + def __init__(self_, connector_name: Union[str, UnsetType] = unset, **kwargs): + """ + MS Teams notification settings for the team + + :param connector_name: Handle for MS Teams + :type connector_name: str, optional + """ + if connector_name is not unset: + kwargs["connector_name"] = connector_name + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/team_notification_rule_attributes_pagerduty.py b/src/datadog_api_client/v2/model/team_notification_rule_attributes_pagerduty.py new file mode 100644 index 0000000000..486e6c7795 --- /dev/null +++ b/src/datadog_api_client/v2/model/team_notification_rule_attributes_pagerduty.py @@ -0,0 +1,36 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class TeamNotificationRuleAttributesPagerduty(ModelNormal): + @cached_property + def openapi_types(_): + return { + "service_name": (str,), + } + + attribute_map = { + "service_name": "service_name", + } + + def __init__(self_, service_name: Union[str, UnsetType] = unset, **kwargs): + """ + PagerDuty notification settings for the team + + :param service_name: Service name for PagerDuty + :type service_name: str, optional + """ + if service_name is not unset: + kwargs["service_name"] = service_name + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/team_notification_rule_attributes_slack.py b/src/datadog_api_client/v2/model/team_notification_rule_attributes_slack.py new file mode 100644 index 0000000000..58c90677a4 --- /dev/null +++ b/src/datadog_api_client/v2/model/team_notification_rule_attributes_slack.py @@ -0,0 +1,43 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class TeamNotificationRuleAttributesSlack(ModelNormal): + @cached_property + def openapi_types(_): + return { + "channel": (str,), + "workspace": (str,), + } + + attribute_map = { + "channel": "channel", + "workspace": "workspace", + } + + def __init__(self_, channel: Union[str, UnsetType] = unset, workspace: Union[str, UnsetType] = unset, **kwargs): + """ + Slack notification settings for the team + + :param channel: Channel for slack notification + :type channel: str, optional + + :param workspace: Workspace for slack notification + :type workspace: str, optional + """ + if channel is not unset: + kwargs["channel"] = channel + if workspace is not unset: + kwargs["workspace"] = workspace + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/team_notification_rules_response.py b/src/datadog_api_client/v2/model/team_notification_rules_response.py new file mode 100644 index 0000000000..f5a9d07729 --- /dev/null +++ b/src/datadog_api_client/v2/model/team_notification_rules_response.py @@ -0,0 +1,56 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.team_notification_rule import TeamNotificationRule + from datadog_api_client.v2.model.team_notification_rules_response_meta import TeamNotificationRulesResponseMeta + + +class TeamNotificationRulesResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.team_notification_rule import TeamNotificationRule + from datadog_api_client.v2.model.team_notification_rules_response_meta import TeamNotificationRulesResponseMeta + + return { + "data": ([TeamNotificationRule],), + "meta": (TeamNotificationRulesResponseMeta,), + } + + attribute_map = { + "data": "data", + "meta": "meta", + } + + def __init__( + self_, + data: Union[List[TeamNotificationRule], UnsetType] = unset, + meta: Union[TeamNotificationRulesResponseMeta, UnsetType] = unset, + **kwargs, + ): + """ + Team notification rules response + + :param data: Team notification rules response data + :type data: [TeamNotificationRule], optional + + :param meta: Metadata related to paging information that is included in the response when querying the team notification rules + :type meta: TeamNotificationRulesResponseMeta, optional + """ + if data is not unset: + kwargs["data"] = data + if meta is not unset: + kwargs["meta"] = meta + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/team_notification_rules_response_meta.py b/src/datadog_api_client/v2/model/team_notification_rules_response_meta.py new file mode 100644 index 0000000000..2d9fa98465 --- /dev/null +++ b/src/datadog_api_client/v2/model/team_notification_rules_response_meta.py @@ -0,0 +1,97 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +class TeamNotificationRulesResponseMeta(ModelNormal): + @cached_property + def openapi_types(_): + return { + "first_number": (int,), + "last_number": (int,), + "next_number": (int, none_type), + "number": (int,), + "prev_number": (int, none_type), + "size": (int,), + "total": (int,), + "type": (str,), + } + + attribute_map = { + "first_number": "first_number", + "last_number": "last_number", + "next_number": "next_number", + "number": "number", + "prev_number": "prev_number", + "size": "size", + "total": "total", + "type": "type", + } + + def __init__( + self_, + first_number: Union[int, UnsetType] = unset, + last_number: Union[int, UnsetType] = unset, + next_number: Union[int, none_type, UnsetType] = unset, + number: Union[int, UnsetType] = unset, + prev_number: Union[int, none_type, UnsetType] = unset, + size: Union[int, UnsetType] = unset, + total: Union[int, UnsetType] = unset, + type: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Metadata related to paging information that is included in the response when querying the team notification rules + + :param first_number: First page number. + :type first_number: int, optional + + :param last_number: Last page number. + :type last_number: int, optional + + :param next_number: Next page number. + :type next_number: int, none_type, optional + + :param number: Page number. + :type number: int, optional + + :param prev_number: Previous page number. + :type prev_number: int, none_type, optional + + :param size: Page size. + :type size: int, optional + + :param total: Total number of results. + :type total: int, optional + + :param type: Pagination type. + :type type: str, optional + """ + if first_number is not unset: + kwargs["first_number"] = first_number + if last_number is not unset: + kwargs["last_number"] = last_number + if next_number is not unset: + kwargs["next_number"] = next_number + if number is not unset: + kwargs["number"] = number + if prev_number is not unset: + kwargs["prev_number"] = prev_number + if size is not unset: + kwargs["size"] = size + if total is not unset: + kwargs["total"] = total + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 8217f826ec..ad76403469 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -4762,6 +4762,16 @@ from datadog_api_client.v2.model.team_link_response import TeamLinkResponse from datadog_api_client.v2.model.team_link_type import TeamLinkType from datadog_api_client.v2.model.team_links_response import TeamLinksResponse +from datadog_api_client.v2.model.team_notification_rule import TeamNotificationRule +from datadog_api_client.v2.model.team_notification_rule_attributes import TeamNotificationRuleAttributes +from datadog_api_client.v2.model.team_notification_rule_attributes_email import TeamNotificationRuleAttributesEmail +from datadog_api_client.v2.model.team_notification_rule_attributes_ms_teams import TeamNotificationRuleAttributesMsTeams +from datadog_api_client.v2.model.team_notification_rule_attributes_pagerduty import ( + TeamNotificationRuleAttributesPagerduty, +) +from datadog_api_client.v2.model.team_notification_rule_attributes_slack import TeamNotificationRuleAttributesSlack +from datadog_api_client.v2.model.team_notification_rules_response import TeamNotificationRulesResponse +from datadog_api_client.v2.model.team_notification_rules_response_meta import TeamNotificationRulesResponseMeta from datadog_api_client.v2.model.team_on_call_responders import TeamOnCallResponders from datadog_api_client.v2.model.team_on_call_responders_data import TeamOnCallRespondersData from datadog_api_client.v2.model.team_on_call_responders_data_relationships import TeamOnCallRespondersDataRelationships @@ -8544,6 +8554,14 @@ "TeamLinkResponse", "TeamLinkType", "TeamLinksResponse", + "TeamNotificationRule", + "TeamNotificationRuleAttributes", + "TeamNotificationRuleAttributesEmail", + "TeamNotificationRuleAttributesMsTeams", + "TeamNotificationRuleAttributesPagerduty", + "TeamNotificationRuleAttributesSlack", + "TeamNotificationRulesResponse", + "TeamNotificationRulesResponseMeta", "TeamOnCallResponders", "TeamOnCallRespondersData", "TeamOnCallRespondersDataRelationships", diff --git a/tests/v2/features/teams.feature b/tests/v2/features/teams.feature index 9deac2e88a..08d1f9631d 100644 --- a/tests/v2/features/teams.feature +++ b/tests/v2/features/teams.feature @@ -144,6 +144,22 @@ 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" + @generated @skip @team:DataDog/aaa-omg + Scenario: Create team notification rule returns "API error response." response + Given new "CreateTeamNotificationRule" request + And request contains "team_id" parameter from "REPLACE.ME" + And body with value {"attributes": {"email": {}, "ms_teams": {}, "pagerduty": {}, "slack": {}}, "id": "b8626d7e-cedd-11eb-abf5-da7ad0900001"} + When the request is sent + Then the response status is 409 API error response. + + @generated @skip @team:DataDog/aaa-omg + Scenario: Create team notification rule returns "OK" response + Given new "CreateTeamNotificationRule" request + And request contains "team_id" parameter from "REPLACE.ME" + And body with value {"attributes": {"email": {}, "ms_teams": {}, "pagerduty": {}, "slack": {}}, "id": "b8626d7e-cedd-11eb-abf5-da7ad0900001"} + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/aaa-omg Scenario: Delete team connections returns "Bad Request" response Given operation "DeleteTeamConnections" enabled @@ -166,6 +182,22 @@ Feature: Teams When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/aaa-omg + Scenario: Delete team notification rule returns "API error response." response + Given new "DeleteTeamNotificationRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And request contains "team_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 API error response. + + @generated @skip @team:DataDog/aaa-omg + Scenario: Delete team notification rule returns "No Content" response + Given new "DeleteTeamNotificationRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And request contains "team_id" parameter from "REPLACE.ME" + 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 @@ -352,6 +384,36 @@ Feature: Teams Then the response status is 200 OK And the response has 3 items + @generated @skip @team:DataDog/aaa-omg + Scenario: Get team notification rule returns "API error response." response + Given new "GetTeamNotificationRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And request contains "team_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 API error response. + + @generated @skip @team:DataDog/aaa-omg + Scenario: Get team notification rule returns "OK" response + Given new "GetTeamNotificationRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And request contains "team_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 201 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. + + @generated @skip @team:DataDog/aaa-omg + Scenario: Get team notification rules returns "OK" response + Given new "GetTeamNotificationRules" request + And request contains "team_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/aaa-omg Scenario: Get team sync configurations returns "OK" response Given new "GetTeamSync" request @@ -606,3 +668,21 @@ 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 + + @generated @skip @team:DataDog/aaa-omg + Scenario: Update team notification rule returns "API error response." response + Given new "UpdateTeamNotificationRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And request contains "team_id" parameter from "REPLACE.ME" + And body with value {"attributes": {"email": {}, "ms_teams": {}, "pagerduty": {}, "slack": {}}, "id": "b8626d7e-cedd-11eb-abf5-da7ad0900001"} + When the request is sent + Then the response status is 404 API error response. + + @generated @skip @team:DataDog/aaa-omg + Scenario: Update team notification rule returns "OK" response + Given new "UpdateTeamNotificationRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And request contains "team_id" parameter from "REPLACE.ME" + And body with value {"attributes": {"email": {}, "ms_teams": {}, "pagerduty": {}, "slack": {}}, "id": "b8626d7e-cedd-11eb-abf5-da7ad0900001"} + When the request is sent + Then the response status is 200 OK diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index e0f0b98d0c..8113423fc7 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -4705,6 +4705,47 @@ "type": "idempotent" } }, + "GetTeamNotificationRules": { + "tag": "Teams", + "undo": { + "type": "safe" + } + }, + "CreateTeamNotificationRule": { + "tag": "Teams", + "undo": { + "operationId": "DeleteTeamNotificationRule", + "parameters": [ + { + "name": "rule_id", + "source": "" + }, + { + "name": "team_id", + "source": "" + } + ], + "type": "unsafe" + } + }, + "DeleteTeamNotificationRule": { + "tag": "Teams", + "undo": { + "type": "idempotent" + } + }, + "GetTeamNotificationRule": { + "tag": "Teams", + "undo": { + "type": "safe" + } + }, + "UpdateTeamNotificationRule": { + "tag": "Teams", + "undo": { + "type": "idempotent" + } + }, "GetTeamPermissionSettings": { "tag": "Teams", "undo": {