From 2ccb8901f52e09cdd7aba728ddd1e0fd3d350418 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 6 Apr 2026 06:54:58 +0000 Subject: [PATCH] Regenerate client from commit ea5d61f of spec repo --- .generator/schemas/v2/openapi.yaml | 1046 ++++++++++++++++- docs/datadog_api_client.v2.api.rst | 14 +- docs/datadog_api_client.v2.model.rst | 126 ++ .../v2/scorecards/CreateScorecardCampaign.py | 41 + .../CreateScorecardOutcomesBatch.py | 4 +- .../CreateScorecardRule.py | 11 +- .../v2/scorecards/DeleteScorecardCampaign.py | 13 + .../DeleteScorecardRule.py | 5 +- .../v2/scorecards/GetScorecardCampaign.py | 15 + .../v2/scorecards/ListScorecardCampaigns.py | 13 + .../ListScorecardOutcomes.py | 5 +- .../ListScorecardOutcomes_2663454275.py | 5 +- .../ListScorecardRules.py | 5 +- .../ListScorecardRules_4057666343.py | 5 +- examples/v2/scorecards/ListScorecards.py | 13 + .../v2/scorecards/UpdateScorecardCampaign.py | 40 + .../v2/scorecards/UpdateScorecardOutcomes.py | 33 + .../UpdateScorecardOutcomes_2262047257.py} | 7 +- examples/v2/scorecards/UpdateScorecardRule.py | 30 + .../UpdateScorecardRule_1831541184.py} | 11 +- src/datadog_api_client/configuration.py | 6 - ...ce_scorecards_api.py => scorecards_api.py} | 397 ++++++- src/datadog_api_client/v2/apis/__init__.py | 4 +- .../v2/model/campaign_response.py | 40 + .../v2/model/campaign_response_attributes.py | 115 ++ .../v2/model/campaign_response_data.py | 54 + .../v2/model/campaign_status.py | 41 + .../v2/model/campaign_type.py | 35 + .../v2/model/create_campaign_request.py | 40 + .../create_campaign_request_attributes.py | 115 ++ .../v2/model/create_campaign_request_data.py | 48 + .../v2/model/create_rule_request_data.py | 15 +- .../v2/model/list_campaigns_response.py | 48 + .../v2/model/list_scorecards_response.py | 40 + .../v2/model/paginated_response_meta.py | 51 + .../v2/model/rule_attributes.py | 8 + .../v2/model/rule_attributes_request.py | 95 ++ .../scorecard_list_response_attributes.py | 63 + .../v2/model/scorecard_list_response_data.py | 54 + .../v2/model/scorecard_list_type.py | 35 + .../v2/model/update_campaign_request.py | 40 + .../update_campaign_request_attributes.py | 109 ++ .../v2/model/update_campaign_request_data.py | 48 + .../v2/model/update_rule_request_data.py | 15 +- src/datadog_api_client/v2/models/__init__.py | 36 + ...ns_rule_updated_successfully_response.yaml | 2 +- tests/v2/features/given.json | 2 +- tests/v2/features/scorecards.feature | 289 +++++ tests/v2/features/service_scorecards.feature | 189 --- tests/v2/features/undo.json | 52 +- 50 files changed, 3214 insertions(+), 314 deletions(-) create mode 100644 examples/v2/scorecards/CreateScorecardCampaign.py rename examples/v2/{service-scorecards => scorecards}/CreateScorecardOutcomesBatch.py (91%) rename examples/v2/{service-scorecards => scorecards}/CreateScorecardRule.py (66%) create mode 100644 examples/v2/scorecards/DeleteScorecardCampaign.py rename examples/v2/{service-scorecards => scorecards}/DeleteScorecardRule.py (68%) create mode 100644 examples/v2/scorecards/GetScorecardCampaign.py create mode 100644 examples/v2/scorecards/ListScorecardCampaigns.py rename examples/v2/{service-scorecards => scorecards}/ListScorecardOutcomes.py (56%) rename examples/v2/{service-scorecards => scorecards}/ListScorecardOutcomes_2663454275.py (67%) rename examples/v2/{service-scorecards => scorecards}/ListScorecardRules.py (55%) rename examples/v2/{service-scorecards => scorecards}/ListScorecardRules_4057666343.py (66%) create mode 100644 examples/v2/scorecards/ListScorecards.py create mode 100644 examples/v2/scorecards/UpdateScorecardCampaign.py create mode 100644 examples/v2/scorecards/UpdateScorecardOutcomes.py rename examples/v2/{service-scorecards/UpdateScorecardOutcomesAsync.py => scorecards/UpdateScorecardOutcomes_2262047257.py} (84%) create mode 100644 examples/v2/scorecards/UpdateScorecardRule.py rename examples/v2/{service-scorecards/UpdateScorecardRule.py => scorecards/UpdateScorecardRule_1831541184.py} (78%) rename src/datadog_api_client/v2/api/{service_scorecards_api.py => scorecards_api.py} (64%) create mode 100644 src/datadog_api_client/v2/model/campaign_response.py create mode 100644 src/datadog_api_client/v2/model/campaign_response_attributes.py create mode 100644 src/datadog_api_client/v2/model/campaign_response_data.py create mode 100644 src/datadog_api_client/v2/model/campaign_status.py create mode 100644 src/datadog_api_client/v2/model/campaign_type.py create mode 100644 src/datadog_api_client/v2/model/create_campaign_request.py create mode 100644 src/datadog_api_client/v2/model/create_campaign_request_attributes.py create mode 100644 src/datadog_api_client/v2/model/create_campaign_request_data.py create mode 100644 src/datadog_api_client/v2/model/list_campaigns_response.py create mode 100644 src/datadog_api_client/v2/model/list_scorecards_response.py create mode 100644 src/datadog_api_client/v2/model/paginated_response_meta.py create mode 100644 src/datadog_api_client/v2/model/rule_attributes_request.py create mode 100644 src/datadog_api_client/v2/model/scorecard_list_response_attributes.py create mode 100644 src/datadog_api_client/v2/model/scorecard_list_response_data.py create mode 100644 src/datadog_api_client/v2/model/scorecard_list_type.py create mode 100644 src/datadog_api_client/v2/model/update_campaign_request.py create mode 100644 src/datadog_api_client/v2/model/update_campaign_request_attributes.py create mode 100644 src/datadog_api_client/v2/model/update_campaign_request_data.py create mode 100644 tests/v2/features/scorecards.feature delete mode 100644 tests/v2/features/service_scorecards.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 45672b441b..16c0a17b6e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -9420,6 +9420,110 @@ components: - name - expression type: object + CampaignResponse: + description: Response containing campaign data. + properties: + data: + $ref: "#/components/schemas/CampaignResponseData" + required: + - data + type: object + CampaignResponseAttributes: + description: Campaign attributes. + properties: + created_at: + description: Creation time of the campaign. + example: "2023-12-15T10:30:00Z" + format: date-time + type: string + description: + description: The description of the campaign. + example: Campaign to improve security posture for Q1 2024. + type: string + due_date: + description: The due date of the campaign. + example: "2024-03-31T23:59:59Z" + format: date-time + type: string + entity_scope: + description: Entity scope query to filter entities for this campaign. + example: kind:service AND team:platform + type: string + guidance: + description: Guidance for the campaign. + example: Please ensure all services pass the security requirements. + type: string + key: + description: The unique key for the campaign. + example: q1-security-2024 + type: string + modified_at: + description: Time of last campaign modification. + example: "2024-01-05T14:20:00Z" + format: date-time + type: string + name: + description: The name of the campaign. + example: Q1 Security Campaign + type: string + owner: + description: The UUID of the campaign owner. + example: 550e8400-e29b-41d4-a716-446655440000 + type: string + start_date: + description: The start date of the campaign. + example: "2024-01-01T00:00:00Z" + format: date-time + type: string + status: + description: The status of the campaign. + example: in_progress + type: string + required: + - key + - name + - owner + - status + - start_date + - created_at + - modified_at + type: object + CampaignResponseData: + description: Campaign data. + properties: + attributes: + $ref: "#/components/schemas/CampaignResponseAttributes" + id: + description: The unique ID of the campaign. + example: c10ODp0VCrrIpXmz + type: string + type: + $ref: "#/components/schemas/CampaignType" + required: + - id + - type + - attributes + type: object + CampaignStatus: + description: The status of the campaign. + enum: + - in_progress + - not_started + - completed + example: in_progress + type: string + x-enum-varnames: + - IN_PROGRESS + - NOT_STARTED + - COMPLETED + CampaignType: + description: The JSON:API type for campaigns. + enum: + - campaign + example: campaign + type: string + x-enum-varnames: + - CAMPAIGN CancelDataDeletionResponseBody: description: The response from the cancel data deletion request endpoint. properties: @@ -14402,6 +14506,78 @@ components: example: Postmortem-IR-123 type: string type: object + CreateCampaignRequest: + description: Request to create a new campaign. + properties: + data: + $ref: "#/components/schemas/CreateCampaignRequestData" + required: + - data + type: object + CreateCampaignRequestAttributes: + description: Attributes for creating a new campaign. + properties: + description: + description: The description of the campaign. + example: Campaign to improve security posture for Q1 2024. + type: string + due_date: + description: The due date of the campaign. + example: "2024-03-31T23:59:59Z" + format: date-time + type: string + entity_scope: + description: Entity scope query to filter entities for this campaign. + example: kind:service AND team:platform + type: string + guidance: + description: Guidance for the campaign. + example: Please ensure all services pass the security requirements. + type: string + key: + description: The unique key for the campaign. + example: q1-security-2024 + type: string + name: + description: The name of the campaign. + example: Q1 Security Campaign + type: string + owner_id: + description: The UUID of the campaign owner. + example: 550e8400-e29b-41d4-a716-446655440000 + type: string + rule_ids: + description: Array of rule IDs associated with this campaign. + example: ["q8MQxk8TCqrHnWkx", "r9NRyl9UDrsIoXly"] + items: + description: The unique ID of a scorecard rule. + type: string + type: array + start_date: + description: The start date of the campaign. + example: "2024-01-01T00:00:00Z" + format: date-time + type: string + status: + $ref: "#/components/schemas/CampaignStatus" + required: + - name + - key + - owner_id + - start_date + - rule_ids + type: object + CreateCampaignRequestData: + description: Data for creating a new campaign. + properties: + attributes: + $ref: "#/components/schemas/CreateCampaignRequestAttributes" + type: + $ref: "#/components/schemas/CampaignType" + required: + - type + - attributes + type: object CreateCaseRequestArray: description: List of requests to create cases for security findings. properties: @@ -15509,7 +15685,7 @@ components: description: Scorecard create rule request data. properties: attributes: - $ref: "#/components/schemas/RuleAttributes" + $ref: "#/components/schemas/RuleAttributesRequest" type: $ref: "#/components/schemas/RuleType" type: object @@ -36795,6 +36971,22 @@ components: required: - data type: object + ListCampaignsResponse: + description: Response containing a list of campaigns. + properties: + data: + $ref: "#/components/schemas/ListCampaignsResponseData" + meta: + $ref: "#/components/schemas/PaginatedResponseMeta" + required: + - data + - meta + type: object + ListCampaignsResponseData: + description: Array of campaigns. + items: + $ref: "#/components/schemas/CampaignResponseData" + type: array ListConnectionsResponse: description: Response containing the list of all data source connections configured for an entity. example: @@ -37258,6 +37450,19 @@ components: example: "/api/v2/scorecard/rules?page%5Blimit%5D=2&page%5Boffset%5D=2&page%5Bsize%5D=2" type: string type: object + ListScorecardsResponse: + description: Response containing a list of scorecards. + properties: + data: + $ref: "#/components/schemas/ListScorecardsResponseData" + required: + - data + type: object + ListScorecardsResponseData: + description: Array of scorecards. + items: + $ref: "#/components/schemas/ScorecardListResponseData" + type: array ListSecurityFindingsResponse: description: The expected response schema when listing security findings. properties: @@ -47892,6 +48097,35 @@ components: x-enum-varnames: - LOW - HIGH + PaginatedResponseMeta: + description: Metadata for scores response. + properties: + count: + description: Number of entities in this response. + example: 10 + format: int64 + type: integer + limit: + description: Pagination limit. + example: 10 + format: int64 + type: integer + offset: + description: Pagination offset. + example: 0 + format: int64 + type: integer + total: + description: Total number of entities available. + example: 150 + format: int64 + type: integer + required: + - count + - total + - limit + - offset + type: object Pagination: description: Pagination object. properties: @@ -53763,6 +53997,38 @@ components: owner: description: Owner of the rule. type: string + scope_query: + description: A query to filter which entities this rule applies to. + example: "kind:service" + type: string + scorecard_name: + description: The scorecard name to which this rule must belong. + example: Deployments automated via Deployment Trains + type: string + type: object + RuleAttributesRequest: + description: Attributes for creating or updating a rule. Server-managed fields (created_at, modified_at, custom) are excluded. + properties: + description: + description: Explanation of the rule. + type: string + enabled: + description: If enabled, the rule is calculated as part of the score. + example: true + type: boolean + level: + $ref: "#/components/schemas/RuleLevel" + name: + description: Name of the rule. + example: Team Defined + type: string + owner: + description: Owner of the rule. + type: string + scope_query: + description: A query to filter which entities this rule applies to. + example: "kind:service" + type: string scorecard_name: description: The scorecard name to which this rule must belong. example: Deployments automated via Deployment Trains @@ -56268,6 +56534,56 @@ components: type: string x-enum-varnames: - USERS + ScorecardListResponseAttributes: + description: Scorecard attributes. + properties: + created_at: + description: Creation time of the scorecard. + example: "2023-01-15T10:30:00Z" + format: date-time + type: string + description: + description: The description of the scorecard. + example: Best practices for observability. + type: string + modified_at: + description: Time of last scorecard modification. + example: "2024-01-05T14:20:00Z" + format: date-time + type: string + name: + description: The name of the scorecard. + example: Observability Best Practices + type: string + required: + - name + - created_at + - modified_at + type: object + ScorecardListResponseData: + description: Scorecard data. + properties: + attributes: + $ref: "#/components/schemas/ScorecardListResponseAttributes" + id: + description: The unique ID of the scorecard. + example: q8MQxk8TCqrHnWkx + type: string + type: + $ref: "#/components/schemas/ScorecardListType" + required: + - id + - type + - attributes + type: object + ScorecardListType: + description: The JSON:API type for scorecard list. + enum: + - scorecard + example: scorecard + type: string + x-enum-varnames: + - SCORECARD ScorecardType: default: scorecard description: The JSON:API type for scorecard. @@ -70205,6 +70521,80 @@ components: description: The display name of the datastore. type: string type: object + UpdateCampaignRequest: + description: Request to update a campaign. + properties: + data: + $ref: "#/components/schemas/UpdateCampaignRequestData" + required: + - data + type: object + UpdateCampaignRequestAttributes: + description: Attributes for updating a campaign. + properties: + description: + description: The description of the campaign. + example: Campaign to improve security posture for Q1 2024. + type: string + due_date: + description: The due date of the campaign. + example: "2024-03-31T23:59:59Z" + format: date-time + type: string + entity_scope: + description: Entity scope query to filter entities for this campaign. + example: kind:service AND team:platform + type: string + guidance: + description: Guidance for the campaign. + example: Please ensure all services pass the security requirements. + type: string + key: + description: The unique key for the campaign. + example: q1-security-2024 + type: string + name: + description: The name of the campaign. + example: Q1 Security Campaign + type: string + owner_id: + description: The UUID of the campaign owner. + example: 550e8400-e29b-41d4-a716-446655440000 + type: string + rule_ids: + description: Array of rule IDs associated with this campaign. + example: ["q8MQxk8TCqrHnWkx", "r9NRyl9UDrsIoXly"] + items: + description: The unique ID of a scorecard rule. + type: string + type: array + start_date: + description: The start date of the campaign. + example: "2024-01-01T00:00:00Z" + format: date-time + type: string + status: + description: The status of the campaign. + example: in_progress + type: string + required: + - name + - owner_id + - status + - start_date + - rule_ids + type: object + UpdateCampaignRequestData: + description: Data for updating a campaign. + properties: + attributes: + $ref: "#/components/schemas/UpdateCampaignRequestAttributes" + type: + $ref: "#/components/schemas/CampaignType" + required: + - type + - attributes + type: object UpdateConnectionRequest: description: Request body for updating an existing data source connection by adding, modifying, or removing fields. example: @@ -70787,7 +71177,7 @@ components: description: Data for the request to update a scorecard rule. properties: attributes: - $ref: "#/components/schemas/RuleAttributes" + $ref: "#/components/schemas/RuleAttributesRequest" type: $ref: "#/components/schemas/RuleType" type: object @@ -100867,6 +101257,389 @@ paths: operator: OR permissions: - org_management + /api/v2/scorecard/campaigns: + get: + description: Fetches all scorecard campaigns. + operationId: ListScorecardCampaigns + parameters: + - description: Maximum number of campaigns to return. + in: query + name: page[limit] + required: false + schema: + default: 10 + example: 10 + format: int64 + type: integer + - description: Offset for pagination. + in: query + name: page[offset] + required: false + schema: + default: 0 + example: 0 + format: int64 + type: integer + - description: Filter campaigns by name (full-text search). + in: query + name: filter[campaign][name] + required: false + schema: + example: security + type: string + - description: Filter campaigns by status. + in: query + name: filter[campaign][status] + required: false + schema: + example: in_progress + type: string + - description: Filter campaigns by owner UUID. + in: query + name: filter[campaign][owner] + required: false + schema: + example: 550e8400-e29b-41d4-a716-446655440000 + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + created_at: "2026-01-01T00:00:00Z" + entity_scope: kind:service + key: test-campaign-1 + modified_at: "2026-01-01T00:00:00Z" + name: Test Campaign 1 + owner: "" + start_date: "2026-01-01T00:00:00Z" + status: in_progress + id: campaign-1 + meta: + entity_count: 25 + rule_count: 2 + relationships: + rules: + data: + - id: rule-1 + type: rule + - id: rule-2 + type: rule + type: campaign + meta: + count: 1 + limit: 10 + offset: 0 + total: 1 + schema: + $ref: "#/components/schemas/ListCampaignsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - apm_service_catalog_read + - cases_read + summary: List all campaigns + tags: + - Scorecards + post: + description: Creates a new scorecard campaign. + operationId: CreateScorecardCampaign + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/CreateCampaignRequest" + description: Campaign data. + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2026-01-01T00:00:00Z" + key: minimal-campaign + modified_at: "2026-01-01T00:00:00Z" + name: Minimal Campaign + owner: 21f98ae1-4ae2-11eb-958f-07e105a6e810 + start_date: "2026-01-01T00:00:00Z" + status: in_progress + id: campaign-2 + relationships: + rules: + data: + - id: rule-1 + type: rule + type: campaign + schema: + $ref: "#/components/schemas/CampaignResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - apm_service_catalog_write + - cases_write + summary: Create a new campaign + tags: + - Scorecards + /api/v2/scorecard/campaigns/{campaign_id}: + delete: + description: Deletes a single campaign by ID or key. + operationId: DeleteScorecardCampaign + parameters: + - description: Campaign ID or key. + in: path + name: campaign_id + required: true + schema: + example: c10ODp0VCrrIpXmz + type: string + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - apm_service_catalog_write + - cases_write + summary: Delete a campaign + tags: + - Scorecards + get: + description: Fetches a single campaign by ID or key. + operationId: GetScorecardCampaign + parameters: + - description: Campaign ID or key. + in: path + name: campaign_id + required: true + schema: + example: c10ODp0VCrrIpXmz + type: string + - description: Include related data (for example, scores). + in: query + name: include + required: false + schema: + example: scores + type: string + - description: Include metadata (entity and rule counts). + in: query + name: include_meta + required: false + schema: + example: true + type: boolean + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2026-01-01T00:00:00Z" + key: test-campaign + modified_at: "2026-01-01T00:00:00Z" + name: Test Campaign + owner: "" + start_date: "2026-01-01T00:00:00Z" + status: in_progress + id: c2b79b87-327c-40fa-b726-228f1a60bbb4 + relationships: + campaign_score: + data: + id: c2b79b87-327c-40fa-b726-228f1a60bbb4 + type: score + rule_scores: + data: + - id: rule-1 + type: score + rules: + data: + - id: rule-1 + type: rule + type: campaign + included: + - attributes: + aggregation: campaign + denominator: 13 + numerator: 10 + score: 76.92 + total_fail: 2 + total_no_data: 0 + total_pass: 10 + total_skip: 1 + id: c2b79b87-327c-40fa-b726-228f1a60bbb4 + type: score + schema: + $ref: "#/components/schemas/CampaignResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - apm_service_catalog_read + - cases_read + summary: Get a campaign + tags: + - Scorecards + put: + description: Updates an existing campaign. + operationId: UpdateScorecardCampaign + parameters: + - description: Campaign ID or key. + in: path + name: campaign_id + required: true + schema: + example: c10ODp0VCrrIpXmz + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/UpdateCampaignRequest" + description: Campaign data. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2026-01-01T00:00:00Z" + description: Updated Description + key: updated-campaign + modified_at: "2026-01-02T00:00:00Z" + name: Updated Campaign + owner: 21f98ae1-4ae2-11eb-958f-07e105a6e810 + start_date: "2026-01-01T00:00:00Z" + status: completed + id: 9c15b9ca-5abd-4875-84c2-02e166a45959 + relationships: + rules: + data: + - id: rule-1 + type: rule + - id: rule-2 + type: rule + type: campaign + schema: + $ref: "#/components/schemas/CampaignResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - apm_service_catalog_write + - cases_write + summary: Update a campaign + tags: + - Scorecards /api/v2/scorecard/outcomes: get: description: Fetches all rule outcomes. @@ -100895,21 +101668,21 @@ paths: schema: example: name type: string - - description: Filter the outcomes on a specific service name. + - description: Filter outcomes on a specific service name. in: query name: filter[outcome][service_name] required: false schema: example: web-store type: string - - description: Filter the outcomes by a specific state. + - description: Filter outcomes by a specific state. in: query name: filter[outcome][state] required: false schema: example: fail type: string - - description: Filter outcomes on whether a rule is enabled/disabled. + - description: Filter outcomes based on whether a rule is enabled or disabled. in: query name: filter[rule][enabled] required: false @@ -100934,6 +101707,25 @@ paths: "200": content: application/json: + examples: + default: + value: + data: + - attributes: + created_at: "2026-01-06T12:51:32.000546001Z" + modified_at: "2026-01-06T12:51:32.000546001Z" + remarks: test + service_name: my-service + state: pass + id: a75tJIv_kNQ + relationships: + rule: + data: + id: rule-1 + type: rule + type: outcome + links: + next: /api/v2/scorecard/outcomes?page%5Blimit%5D=100&page%5Boffset%5D=100 schema: $ref: "#/components/schemas/OutcomesResponse" description: OK @@ -100950,17 +101742,14 @@ paths: - apm_service_catalog_read summary: List all rule outcomes tags: - - Service Scorecards + - Scorecards x-pagination: limitParam: page[size] pageOffsetParam: page[offset] resultsPath: data - x-unstable: |- - **Note**: This endpoint is in public beta. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). post: description: Updates multiple scorecard rule outcomes in a single batched request. - operationId: UpdateScorecardOutcomesAsync + operationId: UpdateScorecardOutcomes requestBody: content: application/json: @@ -100984,15 +101773,13 @@ paths: appKeyAuth: [] - AuthZ: - apm_service_catalog_write - summary: Update Scorecard outcomes asynchronously + summary: Update Scorecard outcomes tags: - - Service Scorecards + - Scorecards x-codegen-request-body-name: body - x-unstable: |- - **Note**: This endpoint is in public beta. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/scorecard/outcomes/batch: post: + deprecated: true description: Sets multiple service-rule outcomes in a single batched request. operationId: CreateScorecardOutcomesBatch requestBody: @@ -101006,6 +101793,25 @@ paths: "200": content: application/json: + examples: + default: + value: + data: + - attributes: + modified_at: "2026-03-11T07:37:20.758067Z" + remarks: test remarks + service_name: my-service + state: pass + id: nFs2_9E97Zo + relationships: + rule: + data: + id: rule-1 + type: rule + type: outcome + meta: + total_received: 1 + total_staged: 1 schema: $ref: "#/components/schemas/OutcomesBatchResponse" description: OK @@ -101022,10 +101828,11 @@ paths: - apm_service_catalog_write summary: Create outcomes batch tags: - - Service Scorecards + - Scorecards x-codegen-request-body-name: body + x-sunset: "2026-04-01" x-unstable: |- - **Note**: This endpoint is in public beta. + **Note**: This endpoint is in Preview. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/scorecard/rules: get: @@ -101094,6 +101901,34 @@ paths: "200": content: application/json: + examples: + default: + value: + data: + - attributes: + category: Test Scorecard + created_at: "2026-01-06T12:51:32Z" + custom: true + enabled: true + level: 3 + modified_at: "2026-01-06T12:51:32Z" + name: Test Rule 1 + scorecard_name: Test Scorecard + id: rule-1 + relationships: + scorecard: + data: + id: scorecard-1 + type: scorecard + type: rule + included: + - attributes: + description: Scorecard Description + name: Test Scorecard + id: scorecard-1 + type: scorecard + links: + next: /api/v2/scorecard/rules?include=scorecard&page%5Blimit%5D=100&page%5Boffset%5D=100 schema: $ref: "#/components/schemas/ListRulesResponse" description: OK @@ -101110,20 +101945,27 @@ paths: - apm_service_catalog_read summary: List all rules tags: - - Service Scorecards + - Scorecards x-pagination: limitParam: page[size] pageOffsetParam: page[offset] resultsPath: data - x-unstable: |- - **Note**: This endpoint is in public beta. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). post: description: Creates a new rule. operationId: CreateScorecardRule requestBody: content: application/json: + examples: + default: + value: + data: + attributes: + enabled: true + name: My Rule + owner: Datadog + scorecard_name: My Scorecard + type: rule schema: $ref: "#/components/schemas/CreateRuleRequest" description: Rule attributes. @@ -101132,6 +101974,26 @@ paths: "201": content: application/json: + examples: + default: + value: + data: + attributes: + category: Test Scorecard + created_at: "2026-01-06T12:51:32Z" + custom: true + enabled: true + level: 3 + modified_at: "2026-01-06T12:51:32Z" + name: Test Rule + scorecard_name: Test Scorecard + id: rule-1 + relationships: + scorecard: + data: + id: scorecard-1 + type: scorecard + type: rule schema: $ref: "#/components/schemas/CreateRuleResponse" description: Created @@ -101148,11 +102010,8 @@ paths: - apm_service_catalog_write summary: Create a new rule tags: - - Service Scorecards + - Scorecards x-codegen-request-body-name: body - x-unstable: |- - **Note**: This endpoint is in public beta. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/scorecard/rules/{rule_id}: delete: description: Deletes a single rule. @@ -101177,10 +102036,7 @@ paths: - apm_service_catalog_write summary: Delete a rule tags: - - Service Scorecards - x-unstable: |- - **Note**: This endpoint is in public beta. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + - Scorecards put: description: Updates an existing rule. operationId: UpdateScorecardRule @@ -101189,6 +102045,18 @@ paths: requestBody: content: application/json: + examples: + default: + value: + data: + attributes: + description: Updated Description + enabled: false + name: Updated Rule + owner: team:updated-team + scope_query: kind:service + scorecard_name: Updated Scorecard + type: rule schema: $ref: "#/components/schemas/UpdateRuleRequest" description: Rule attributes. @@ -101197,6 +102065,33 @@ paths: "200": content: application/json: + examples: + default: + value: + data: + attributes: + category: Updated Scorecard + created_at: "2026-01-06T12:51:32Z" + custom: true + description: Updated Description + enabled: false + level: 1 + modified_at: "2026-01-06T13:00:00Z" + name: Updated Rule + owner: team:updated-team + scope_query: kind:service + scorecard_name: Updated Scorecard + id: rule-1 + relationships: + scope: + data: + id: ae07a16e-1319-5e61-bdba-b3026bc2bdcd + type: entity-scope + scorecard: + data: + id: scorecard-2 + type: scorecard + type: rule schema: $ref: "#/components/schemas/UpdateRuleResponse" description: Rule updated successfully @@ -101211,13 +102106,88 @@ paths: appKeyAuth: [] - AuthZ: - apm_service_catalog_write - summary: Update an existing rule + summary: Update an existing scorecard rule tags: - - Service Scorecards + - Scorecards x-codegen-request-body-name: body - x-unstable: |- - **Note**: This endpoint is in public beta. - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/scorecard/scorecards: + get: + description: Fetches all scorecards. + operationId: ListScorecards + parameters: + - description: Offset for pagination. + in: query + name: page[offset] + required: false + schema: + default: 0 + example: 0 + format: int64 + type: integer + - description: Maximum number of scorecards to return. + in: query + name: page[size] + required: false + schema: + default: 100 + example: 10 + format: int64 + type: integer + - description: Filter by scorecard ID. + in: query + name: filter[scorecard][id] + required: false + schema: + example: q8MQxk8TCqrHnWkx + type: string + - description: Filter by scorecard name (partial match). + in: query + name: filter[scorecard][name] + required: false + schema: + example: Observability + type: string + - description: Filter by scorecard description (partial match). + in: query + name: filter[scorecard][description] + required: false + schema: + example: Best Practices + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + created_at: "2026-01-01T00:00:00Z" + description: Best practices for observability. + modified_at: "2026-01-05T14:20:00Z" + name: Observability Best Practices + id: q8MQxk8TCqrHnWkx + type: scorecard + schema: + $ref: "#/components/schemas/ListScorecardsResponse" + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - apm_service_catalog_read + summary: List all scorecards + tags: + - Scorecards /api/v2/seats/users: delete: description: |- @@ -113452,6 +114422,9 @@ tags: - description: |- Manage retention filters through [Manage Applications](https://app.datadoghq.com/rum/list) of RUM for your organization. name: Rum Retention Filters + - description: |- + API to create and update scorecard rules and outcomes. See [Scorecards](https://docs.datadoghq.com/service_catalog/scorecards) for more information. + name: Scorecards - description: |- The seats API allows you to view, assign, and unassign seats for your organization. name: Seats @@ -113476,11 +114449,6 @@ tags: balance feature development with platform stability, and improve communication with internal and external users. name: Service Level Objectives - - description: |- - API to create and update scorecard rules and outcomes. See [Service Scorecards](https://docs.datadoghq.com/service_catalog/scorecards) for more information. - - This feature is currently in BETA. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). - name: Service Scorecards - description: Manage your ServiceNow Integration. ServiceNow is a cloud-based platform that helps organizations manage digital workflows for enterprise operations. name: ServiceNow Integration - description: |- diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index c3be7e8838..1b149a7a4e 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -592,6 +592,13 @@ datadog\_api\_client.v2.api.rum\_retention\_filters\_api module :members: :show-inheritance: +datadog\_api\_client.v2.api.scorecards\_api module +-------------------------------------------------- + +.. automodule:: datadog_api_client.v2.api.scorecards_api + :members: + :show-inheritance: + datadog\_api\_client.v2.api.seats\_api module --------------------------------------------- @@ -641,13 +648,6 @@ datadog\_api\_client.v2.api.service\_now\_integration\_api module :members: :show-inheritance: -datadog\_api\_client.v2.api.service\_scorecards\_api module ------------------------------------------------------------ - -.. automodule:: datadog_api_client.v2.api.service_scorecards_api - :members: - :show-inheritance: - datadog\_api\_client.v2.api.software\_catalog\_api module --------------------------------------------------------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 3325139a68..83afb7dc97 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -3140,6 +3140,41 @@ datadog\_api\_client.v2.model.calculated\_field module :members: :show-inheritance: +datadog\_api\_client.v2.model.campaign\_response module +------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.campaign_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.campaign\_response\_attributes module +------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.campaign_response_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.campaign\_response\_data module +------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.campaign_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.campaign\_status module +----------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.campaign_status + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.campaign\_type module +--------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.campaign_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.cancel\_data\_deletion\_response\_body module --------------------------------------------------------------------------- @@ -5996,6 +6031,27 @@ datadog\_api\_client.v2.model.create\_attachment\_request\_data\_attributes\_att :members: :show-inheritance: +datadog\_api\_client.v2.model.create\_campaign\_request module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_campaign_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_campaign\_request\_attributes module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_campaign_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.create\_campaign\_request\_data module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.create_campaign_request_data + :members: + :show-inheritance: + datadog\_api\_client.v2.model.create\_case\_request\_array module ----------------------------------------------------------------- @@ -15698,6 +15754,13 @@ datadog\_api\_client.v2.model.list\_assets\_sbo\_ms\_response module :members: :show-inheritance: +datadog\_api\_client.v2.model.list\_campaigns\_response module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.list_campaigns_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.list\_connections\_response module ---------------------------------------------------------------- @@ -15943,6 +16006,13 @@ datadog\_api\_client.v2.model.list\_rules\_response\_links module :members: :show-inheritance: +datadog\_api\_client.v2.model.list\_scorecards\_response module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.list_scorecards_response + :members: + :show-inheritance: + datadog\_api\_client.v2.model.list\_security\_findings\_response module ----------------------------------------------------------------------- @@ -21508,6 +21578,13 @@ datadog\_api\_client.v2.model.page\_urgency module :members: :show-inheritance: +datadog\_api\_client.v2.model.paginated\_response\_meta module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.paginated_response_meta + :members: + :show-inheritance: + datadog\_api\_client.v2.model.pagination module ----------------------------------------------- @@ -24077,6 +24154,13 @@ datadog\_api\_client.v2.model.rule\_attributes module :members: :show-inheritance: +datadog\_api\_client.v2.model.rule\_attributes\_request module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.rule_attributes_request + :members: + :show-inheritance: + datadog\_api\_client.v2.model.rule\_outcome\_relationships module ----------------------------------------------------------------- @@ -25575,6 +25659,27 @@ datadog\_api\_client.v2.model.schedule\_user\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.scorecard\_list\_response\_attributes module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.scorecard_list_response_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.scorecard\_list\_response\_data module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.scorecard_list_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.scorecard\_list\_type module +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.scorecard_list_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.scorecard\_type module ---------------------------------------------------- @@ -31840,6 +31945,27 @@ datadog\_api\_client.v2.model.update\_apps\_datastore\_request\_data\_attributes :members: :show-inheritance: +datadog\_api\_client.v2.model.update\_campaign\_request module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.update_campaign_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.update\_campaign\_request\_attributes module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.update_campaign_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.update\_campaign\_request\_data module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.update_campaign_request_data + :members: + :show-inheritance: + datadog\_api\_client.v2.model.update\_connection\_request module ---------------------------------------------------------------- diff --git a/examples/v2/scorecards/CreateScorecardCampaign.py b/examples/v2/scorecards/CreateScorecardCampaign.py new file mode 100644 index 0000000000..e44579c720 --- /dev/null +++ b/examples/v2/scorecards/CreateScorecardCampaign.py @@ -0,0 +1,41 @@ +""" +Create a new campaign returns "Created" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi +from datadog_api_client.v2.model.campaign_status import CampaignStatus +from datadog_api_client.v2.model.campaign_type import CampaignType +from datadog_api_client.v2.model.create_campaign_request import CreateCampaignRequest +from datadog_api_client.v2.model.create_campaign_request_attributes import CreateCampaignRequestAttributes +from datadog_api_client.v2.model.create_campaign_request_data import CreateCampaignRequestData +from datetime import datetime +from dateutil.tz import tzutc + +body = CreateCampaignRequest( + data=CreateCampaignRequestData( + attributes=CreateCampaignRequestAttributes( + description="Campaign to improve security posture for Q1 2024.", + due_date=datetime(2024, 3, 31, 23, 59, 59, tzinfo=tzutc()), + entity_scope="kind:service AND team:platform", + guidance="Please ensure all services pass the security requirements.", + key="q1-security-2024", + name="Q1 Security Campaign", + owner_id="550e8400-e29b-41d4-a716-446655440000", + rule_ids=[ + "q8MQxk8TCqrHnWkx", + "r9NRyl9UDrsIoXly", + ], + start_date=datetime(2024, 1, 1, 0, 0, tzinfo=tzutc()), + status=CampaignStatus.IN_PROGRESS, + ), + type=CampaignType.CAMPAIGN, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ScorecardsApi(api_client) + response = api_instance.create_scorecard_campaign(body=body) + + print(response) diff --git a/examples/v2/service-scorecards/CreateScorecardOutcomesBatch.py b/examples/v2/scorecards/CreateScorecardOutcomesBatch.py similarity index 91% rename from examples/v2/service-scorecards/CreateScorecardOutcomesBatch.py rename to examples/v2/scorecards/CreateScorecardOutcomesBatch.py index 66be42ee9a..0dd3d7900e 100644 --- a/examples/v2/service-scorecards/CreateScorecardOutcomesBatch.py +++ b/examples/v2/scorecards/CreateScorecardOutcomesBatch.py @@ -4,7 +4,7 @@ from os import environ from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.service_scorecards_api import ServiceScorecardsApi +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi from datadog_api_client.v2.model.outcomes_batch_attributes import OutcomesBatchAttributes from datadog_api_client.v2.model.outcomes_batch_request import OutcomesBatchRequest from datadog_api_client.v2.model.outcomes_batch_request_data import OutcomesBatchRequestData @@ -34,7 +34,7 @@ configuration = Configuration() configuration.unstable_operations["create_scorecard_outcomes_batch"] = True with ApiClient(configuration) as api_client: - api_instance = ServiceScorecardsApi(api_client) + api_instance = ScorecardsApi(api_client) response = api_instance.create_scorecard_outcomes_batch(body=body) print(response) diff --git a/examples/v2/service-scorecards/CreateScorecardRule.py b/examples/v2/scorecards/CreateScorecardRule.py similarity index 66% rename from examples/v2/service-scorecards/CreateScorecardRule.py rename to examples/v2/scorecards/CreateScorecardRule.py index 53b3e17e77..af206e4f2d 100644 --- a/examples/v2/service-scorecards/CreateScorecardRule.py +++ b/examples/v2/scorecards/CreateScorecardRule.py @@ -3,17 +3,17 @@ """ from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.service_scorecards_api import ServiceScorecardsApi +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi from datadog_api_client.v2.model.create_rule_request import CreateRuleRequest from datadog_api_client.v2.model.create_rule_request_data import CreateRuleRequestData -from datadog_api_client.v2.model.rule_attributes import RuleAttributes +from datadog_api_client.v2.model.rule_attributes_request import RuleAttributesRequest from datadog_api_client.v2.model.rule_type import RuleType body = CreateRuleRequest( data=CreateRuleRequestData( - attributes=RuleAttributes( + attributes=RuleAttributesRequest( enabled=True, - name="Example-Service-Scorecard", + name="Example-Scorecard", scorecard_name="Observability Best Practices", ), type=RuleType.RULE, @@ -21,9 +21,8 @@ ) configuration = Configuration() -configuration.unstable_operations["create_scorecard_rule"] = True with ApiClient(configuration) as api_client: - api_instance = ServiceScorecardsApi(api_client) + api_instance = ScorecardsApi(api_client) response = api_instance.create_scorecard_rule(body=body) print(response) diff --git a/examples/v2/scorecards/DeleteScorecardCampaign.py b/examples/v2/scorecards/DeleteScorecardCampaign.py new file mode 100644 index 0000000000..e8a7ac7d76 --- /dev/null +++ b/examples/v2/scorecards/DeleteScorecardCampaign.py @@ -0,0 +1,13 @@ +""" +Delete a campaign returns "No Content" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ScorecardsApi(api_client) + api_instance.delete_scorecard_campaign( + campaign_id="c10ODp0VCrrIpXmz", + ) diff --git a/examples/v2/service-scorecards/DeleteScorecardRule.py b/examples/v2/scorecards/DeleteScorecardRule.py similarity index 68% rename from examples/v2/service-scorecards/DeleteScorecardRule.py rename to examples/v2/scorecards/DeleteScorecardRule.py index 98e49856a3..8f5f4683b2 100644 --- a/examples/v2/service-scorecards/DeleteScorecardRule.py +++ b/examples/v2/scorecards/DeleteScorecardRule.py @@ -4,15 +4,14 @@ from os import environ from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.service_scorecards_api import ServiceScorecardsApi +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi # there is a valid "create_scorecard_rule" in the system CREATE_SCORECARD_RULE_DATA_ID = environ["CREATE_SCORECARD_RULE_DATA_ID"] configuration = Configuration() -configuration.unstable_operations["delete_scorecard_rule"] = True with ApiClient(configuration) as api_client: - api_instance = ServiceScorecardsApi(api_client) + api_instance = ScorecardsApi(api_client) api_instance.delete_scorecard_rule( rule_id=CREATE_SCORECARD_RULE_DATA_ID, ) diff --git a/examples/v2/scorecards/GetScorecardCampaign.py b/examples/v2/scorecards/GetScorecardCampaign.py new file mode 100644 index 0000000000..50d9fc1bdf --- /dev/null +++ b/examples/v2/scorecards/GetScorecardCampaign.py @@ -0,0 +1,15 @@ +""" +Get a campaign returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ScorecardsApi(api_client) + response = api_instance.get_scorecard_campaign( + campaign_id="c10ODp0VCrrIpXmz", + ) + + print(response) diff --git a/examples/v2/scorecards/ListScorecardCampaigns.py b/examples/v2/scorecards/ListScorecardCampaigns.py new file mode 100644 index 0000000000..f3d876b907 --- /dev/null +++ b/examples/v2/scorecards/ListScorecardCampaigns.py @@ -0,0 +1,13 @@ +""" +List all campaigns returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ScorecardsApi(api_client) + response = api_instance.list_scorecard_campaigns() + + print(response) diff --git a/examples/v2/service-scorecards/ListScorecardOutcomes.py b/examples/v2/scorecards/ListScorecardOutcomes.py similarity index 56% rename from examples/v2/service-scorecards/ListScorecardOutcomes.py rename to examples/v2/scorecards/ListScorecardOutcomes.py index 88398a8b5b..113300f9de 100644 --- a/examples/v2/service-scorecards/ListScorecardOutcomes.py +++ b/examples/v2/scorecards/ListScorecardOutcomes.py @@ -3,12 +3,11 @@ """ from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.service_scorecards_api import ServiceScorecardsApi +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi configuration = Configuration() -configuration.unstable_operations["list_scorecard_outcomes"] = True with ApiClient(configuration) as api_client: - api_instance = ServiceScorecardsApi(api_client) + api_instance = ScorecardsApi(api_client) response = api_instance.list_scorecard_outcomes() print(response) diff --git a/examples/v2/service-scorecards/ListScorecardOutcomes_2663454275.py b/examples/v2/scorecards/ListScorecardOutcomes_2663454275.py similarity index 67% rename from examples/v2/service-scorecards/ListScorecardOutcomes_2663454275.py rename to examples/v2/scorecards/ListScorecardOutcomes_2663454275.py index a4e1497670..b445d77b47 100644 --- a/examples/v2/service-scorecards/ListScorecardOutcomes_2663454275.py +++ b/examples/v2/scorecards/ListScorecardOutcomes_2663454275.py @@ -3,12 +3,11 @@ """ from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.service_scorecards_api import ServiceScorecardsApi +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi configuration = Configuration() -configuration.unstable_operations["list_scorecard_outcomes"] = True with ApiClient(configuration) as api_client: - api_instance = ServiceScorecardsApi(api_client) + api_instance = ScorecardsApi(api_client) items = api_instance.list_scorecard_outcomes_with_pagination( page_size=2, fields_outcome="state", diff --git a/examples/v2/service-scorecards/ListScorecardRules.py b/examples/v2/scorecards/ListScorecardRules.py similarity index 55% rename from examples/v2/service-scorecards/ListScorecardRules.py rename to examples/v2/scorecards/ListScorecardRules.py index 57debb7e28..4dbf65e1e1 100644 --- a/examples/v2/service-scorecards/ListScorecardRules.py +++ b/examples/v2/scorecards/ListScorecardRules.py @@ -3,12 +3,11 @@ """ from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.service_scorecards_api import ServiceScorecardsApi +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi configuration = Configuration() -configuration.unstable_operations["list_scorecard_rules"] = True with ApiClient(configuration) as api_client: - api_instance = ServiceScorecardsApi(api_client) + api_instance = ScorecardsApi(api_client) response = api_instance.list_scorecard_rules() print(response) diff --git a/examples/v2/service-scorecards/ListScorecardRules_4057666343.py b/examples/v2/scorecards/ListScorecardRules_4057666343.py similarity index 66% rename from examples/v2/service-scorecards/ListScorecardRules_4057666343.py rename to examples/v2/scorecards/ListScorecardRules_4057666343.py index cc4fdc6d9a..2ed9d3a692 100644 --- a/examples/v2/service-scorecards/ListScorecardRules_4057666343.py +++ b/examples/v2/scorecards/ListScorecardRules_4057666343.py @@ -3,12 +3,11 @@ """ from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.service_scorecards_api import ServiceScorecardsApi +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi configuration = Configuration() -configuration.unstable_operations["list_scorecard_rules"] = True with ApiClient(configuration) as api_client: - api_instance = ServiceScorecardsApi(api_client) + api_instance = ScorecardsApi(api_client) items = api_instance.list_scorecard_rules_with_pagination( page_size=2, filter_rule_custom=True, diff --git a/examples/v2/scorecards/ListScorecards.py b/examples/v2/scorecards/ListScorecards.py new file mode 100644 index 0000000000..fde7464f98 --- /dev/null +++ b/examples/v2/scorecards/ListScorecards.py @@ -0,0 +1,13 @@ +""" +List all scorecards returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ScorecardsApi(api_client) + response = api_instance.list_scorecards() + + print(response) diff --git a/examples/v2/scorecards/UpdateScorecardCampaign.py b/examples/v2/scorecards/UpdateScorecardCampaign.py new file mode 100644 index 0000000000..03ebfc4eec --- /dev/null +++ b/examples/v2/scorecards/UpdateScorecardCampaign.py @@ -0,0 +1,40 @@ +""" +Update a campaign returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi +from datadog_api_client.v2.model.campaign_type import CampaignType +from datadog_api_client.v2.model.update_campaign_request import UpdateCampaignRequest +from datadog_api_client.v2.model.update_campaign_request_attributes import UpdateCampaignRequestAttributes +from datadog_api_client.v2.model.update_campaign_request_data import UpdateCampaignRequestData +from datetime import datetime +from dateutil.tz import tzutc + +body = UpdateCampaignRequest( + data=UpdateCampaignRequestData( + attributes=UpdateCampaignRequestAttributes( + description="Campaign to improve security posture for Q1 2024.", + due_date=datetime(2024, 3, 31, 23, 59, 59, tzinfo=tzutc()), + entity_scope="kind:service AND team:platform", + guidance="Please ensure all services pass the security requirements.", + key="q1-security-2024", + name="Q1 Security Campaign", + owner_id="550e8400-e29b-41d4-a716-446655440000", + rule_ids=[ + "q8MQxk8TCqrHnWkx", + "r9NRyl9UDrsIoXly", + ], + start_date=datetime(2024, 1, 1, 0, 0, tzinfo=tzutc()), + status="in_progress", + ), + type=CampaignType.CAMPAIGN, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ScorecardsApi(api_client) + response = api_instance.update_scorecard_campaign(campaign_id="c10ODp0VCrrIpXmz", body=body) + + print(response) diff --git a/examples/v2/scorecards/UpdateScorecardOutcomes.py b/examples/v2/scorecards/UpdateScorecardOutcomes.py new file mode 100644 index 0000000000..663bc29cef --- /dev/null +++ b/examples/v2/scorecards/UpdateScorecardOutcomes.py @@ -0,0 +1,33 @@ +""" +Update Scorecard outcomes returns "Accepted" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi +from datadog_api_client.v2.model.state import State +from datadog_api_client.v2.model.update_outcomes_async_attributes import UpdateOutcomesAsyncAttributes +from datadog_api_client.v2.model.update_outcomes_async_request import UpdateOutcomesAsyncRequest +from datadog_api_client.v2.model.update_outcomes_async_request_data import UpdateOutcomesAsyncRequestData +from datadog_api_client.v2.model.update_outcomes_async_request_item import UpdateOutcomesAsyncRequestItem +from datadog_api_client.v2.model.update_outcomes_async_type import UpdateOutcomesAsyncType + +body = UpdateOutcomesAsyncRequest( + data=UpdateOutcomesAsyncRequestData( + attributes=UpdateOutcomesAsyncAttributes( + results=[ + UpdateOutcomesAsyncRequestItem( + entity_reference="service:my-service", + remarks='See: Services', + rule_id="q8MQxk8TCqrHnWkx", + state=State.PASS, + ), + ], + ), + type=UpdateOutcomesAsyncType.BATCHED_OUTCOME, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ScorecardsApi(api_client) + api_instance.update_scorecard_outcomes(body=body) diff --git a/examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.py b/examples/v2/scorecards/UpdateScorecardOutcomes_2262047257.py similarity index 84% rename from examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.py rename to examples/v2/scorecards/UpdateScorecardOutcomes_2262047257.py index edee85101e..28d5a1015a 100644 --- a/examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.py +++ b/examples/v2/scorecards/UpdateScorecardOutcomes_2262047257.py @@ -4,7 +4,7 @@ from os import environ from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.service_scorecards_api import ServiceScorecardsApi +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi from datadog_api_client.v2.model.state import State from datadog_api_client.v2.model.update_outcomes_async_attributes import UpdateOutcomesAsyncAttributes from datadog_api_client.v2.model.update_outcomes_async_request import UpdateOutcomesAsyncRequest @@ -32,7 +32,6 @@ ) configuration = Configuration() -configuration.unstable_operations["update_scorecard_outcomes_async"] = True with ApiClient(configuration) as api_client: - api_instance = ServiceScorecardsApi(api_client) - api_instance.update_scorecard_outcomes_async(body=body) + api_instance = ScorecardsApi(api_client) + api_instance.update_scorecard_outcomes(body=body) diff --git a/examples/v2/scorecards/UpdateScorecardRule.py b/examples/v2/scorecards/UpdateScorecardRule.py new file mode 100644 index 0000000000..6e4dc26934 --- /dev/null +++ b/examples/v2/scorecards/UpdateScorecardRule.py @@ -0,0 +1,30 @@ +""" +Update an existing scorecard rule returns "Rule updated successfully" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi +from datadog_api_client.v2.model.rule_attributes_request import RuleAttributesRequest +from datadog_api_client.v2.model.rule_type import RuleType +from datadog_api_client.v2.model.update_rule_request import UpdateRuleRequest +from datadog_api_client.v2.model.update_rule_request_data import UpdateRuleRequestData + +body = UpdateRuleRequest( + data=UpdateRuleRequestData( + attributes=RuleAttributesRequest( + enabled=True, + level=2, + name="Team Defined", + scope_query="kind:service", + scorecard_name="Deployments automated via Deployment Trains", + ), + type=RuleType.RULE, + ), +) + +configuration = Configuration() +with ApiClient(configuration) as api_client: + api_instance = ScorecardsApi(api_client) + response = api_instance.update_scorecard_rule(rule_id="rule_id", body=body) + + print(response) diff --git a/examples/v2/service-scorecards/UpdateScorecardRule.py b/examples/v2/scorecards/UpdateScorecardRule_1831541184.py similarity index 78% rename from examples/v2/service-scorecards/UpdateScorecardRule.py rename to examples/v2/scorecards/UpdateScorecardRule_1831541184.py index cba74500fa..02c4c9d1eb 100644 --- a/examples/v2/service-scorecards/UpdateScorecardRule.py +++ b/examples/v2/scorecards/UpdateScorecardRule_1831541184.py @@ -4,8 +4,9 @@ from os import environ from datadog_api_client import ApiClient, Configuration -from datadog_api_client.v2.api.service_scorecards_api import ServiceScorecardsApi -from datadog_api_client.v2.model.rule_attributes import RuleAttributes +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi +from datadog_api_client.v2.model.rule_attributes_request import RuleAttributesRequest +from datadog_api_client.v2.model.rule_type import RuleType from datadog_api_client.v2.model.update_rule_request import UpdateRuleRequest from datadog_api_client.v2.model.update_rule_request_data import UpdateRuleRequestData @@ -16,7 +17,8 @@ body = UpdateRuleRequest( data=UpdateRuleRequestData( - attributes=RuleAttributes( + type=RuleType.RULE, + attributes=RuleAttributesRequest( enabled=True, name=CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME, scorecard_name=CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME, @@ -26,9 +28,8 @@ ) configuration = Configuration() -configuration.unstable_operations["update_scorecard_rule"] = True with ApiClient(configuration) as api_client: - api_instance = ServiceScorecardsApi(api_client) + api_instance = ScorecardsApi(api_client) response = api_instance.update_scorecard_rule(rule_id=CREATE_SCORECARD_RULE_DATA_ID, body=body) print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index c40c8ba9fc..84c9ad4641 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -447,12 +447,6 @@ def __init__( "v2.query_users": False, "v2.update_connection": False, "v2.create_scorecard_outcomes_batch": False, - "v2.create_scorecard_rule": False, - "v2.delete_scorecard_rule": False, - "v2.list_scorecard_outcomes": False, - "v2.list_scorecard_rules": False, - "v2.update_scorecard_outcomes_async": False, - "v2.update_scorecard_rule": False, "v2.list_entity_risk_scores": False, "v2.create_incident_service": False, "v2.delete_incident_service": False, diff --git a/src/datadog_api_client/v2/api/service_scorecards_api.py b/src/datadog_api_client/v2/api/scorecards_api.py similarity index 64% rename from src/datadog_api_client/v2/api/service_scorecards_api.py rename to src/datadog_api_client/v2/api/scorecards_api.py index 17f1b0de83..e0a71e0df4 100644 --- a/src/datadog_api_client/v2/api/service_scorecards_api.py +++ b/src/datadog_api_client/v2/api/scorecards_api.py @@ -5,6 +5,7 @@ import collections from typing import Any, Dict, Union +import warnings from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint from datadog_api_client.configuration import Configuration @@ -14,6 +15,10 @@ UnsetType, unset, ) +from datadog_api_client.v2.model.list_campaigns_response import ListCampaignsResponse +from datadog_api_client.v2.model.campaign_response import CampaignResponse +from datadog_api_client.v2.model.create_campaign_request import CreateCampaignRequest +from datadog_api_client.v2.model.update_campaign_request import UpdateCampaignRequest from datadog_api_client.v2.model.outcomes_response import OutcomesResponse from datadog_api_client.v2.model.outcomes_response_data_item import OutcomesResponseDataItem from datadog_api_client.v2.model.update_outcomes_async_request import UpdateOutcomesAsyncRequest @@ -25,13 +30,12 @@ from datadog_api_client.v2.model.create_rule_request import CreateRuleRequest from datadog_api_client.v2.model.update_rule_response import UpdateRuleResponse from datadog_api_client.v2.model.update_rule_request import UpdateRuleRequest +from datadog_api_client.v2.model.list_scorecards_response import ListScorecardsResponse -class ServiceScorecardsApi: +class ScorecardsApi: """ - API to create and update scorecard rules and outcomes. See `Service Scorecards `_ for more information. - - This feature is currently in BETA. If you have any feedback, contact `Datadog support `_. + API to create and update scorecard rules and outcomes. See `Scorecards `_ for more information. """ def __init__(self, api_client=None): @@ -39,6 +43,26 @@ def __init__(self, api_client=None): api_client = ApiClient(Configuration()) self.api_client = api_client + self._create_scorecard_campaign_endpoint = _Endpoint( + settings={ + "response_type": (CampaignResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/scorecard/campaigns", + "operation_id": "create_scorecard_campaign", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (CreateCampaignRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._create_scorecard_outcomes_batch_endpoint = _Endpoint( settings={ "response_type": (OutcomesBatchResponse,), @@ -79,6 +103,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_scorecard_campaign_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/scorecard/campaigns/{campaign_id}", + "operation_id": "delete_scorecard_campaign", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "campaign_id": { + "required": True, + "openapi_types": (str,), + "attribute": "campaign_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._delete_scorecard_rule_endpoint = _Endpoint( settings={ "response_type": None, @@ -102,6 +149,81 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_scorecard_campaign_endpoint = _Endpoint( + settings={ + "response_type": (CampaignResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/scorecard/campaigns/{campaign_id}", + "operation_id": "get_scorecard_campaign", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "campaign_id": { + "required": True, + "openapi_types": (str,), + "attribute": "campaign_id", + "location": "path", + }, + "include": { + "openapi_types": (str,), + "attribute": "include", + "location": "query", + }, + "include_meta": { + "openapi_types": (bool,), + "attribute": "include_meta", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._list_scorecard_campaigns_endpoint = _Endpoint( + settings={ + "response_type": (ListCampaignsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/scorecard/campaigns", + "operation_id": "list_scorecard_campaigns", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "page_limit": { + "openapi_types": (int,), + "attribute": "page[limit]", + "location": "query", + }, + "page_offset": { + "openapi_types": (int,), + "attribute": "page[offset]", + "location": "query", + }, + "filter_campaign_name": { + "openapi_types": (str,), + "attribute": "filter[campaign][name]", + "location": "query", + }, + "filter_campaign_status": { + "openapi_types": (str,), + "attribute": "filter[campaign][status]", + "location": "query", + }, + "filter_campaign_owner": { + "openapi_types": (str,), + "attribute": "filter[campaign][owner]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_scorecard_outcomes_endpoint = _Endpoint( settings={ "response_type": (OutcomesResponse,), @@ -236,12 +358,80 @@ def __init__(self, api_client=None): api_client=api_client, ) - self._update_scorecard_outcomes_async_endpoint = _Endpoint( + self._list_scorecards_endpoint = _Endpoint( + settings={ + "response_type": (ListScorecardsResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/scorecard/scorecards", + "operation_id": "list_scorecards", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "page_offset": { + "openapi_types": (int,), + "attribute": "page[offset]", + "location": "query", + }, + "page_size": { + "openapi_types": (int,), + "attribute": "page[size]", + "location": "query", + }, + "filter_scorecard_id": { + "openapi_types": (str,), + "attribute": "filter[scorecard][id]", + "location": "query", + }, + "filter_scorecard_name": { + "openapi_types": (str,), + "attribute": "filter[scorecard][name]", + "location": "query", + }, + "filter_scorecard_description": { + "openapi_types": (str,), + "attribute": "filter[scorecard][description]", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + + self._update_scorecard_campaign_endpoint = _Endpoint( + settings={ + "response_type": (CampaignResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/scorecard/campaigns/{campaign_id}", + "operation_id": "update_scorecard_campaign", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "campaign_id": { + "required": True, + "openapi_types": (str,), + "attribute": "campaign_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (UpdateCampaignRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._update_scorecard_outcomes_endpoint = _Endpoint( settings={ "response_type": None, "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], "endpoint_path": "/api/v2/scorecard/outcomes", - "operation_id": "update_scorecard_outcomes_async", + "operation_id": "update_scorecard_outcomes", "http_method": "POST", "version": "v2", }, @@ -282,11 +472,28 @@ def __init__(self, api_client=None): api_client=api_client, ) + def create_scorecard_campaign( + self, + body: CreateCampaignRequest, + ) -> CampaignResponse: + """Create a new campaign. + + Creates a new scorecard campaign. + + :param body: Campaign data. + :type body: CreateCampaignRequest + :rtype: CampaignResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_scorecard_campaign_endpoint.call_with_http_info(**kwargs) + def create_scorecard_outcomes_batch( self, body: OutcomesBatchRequest, ) -> OutcomesBatchResponse: - """Create outcomes batch. + """Create outcomes batch. **Deprecated**. Sets multiple service-rule outcomes in a single batched request. @@ -297,6 +504,7 @@ def create_scorecard_outcomes_batch( kwargs: Dict[str, Any] = {} kwargs["body"] = body + warnings.warn("create_scorecard_outcomes_batch is deprecated", DeprecationWarning, stacklevel=2) return self._create_scorecard_outcomes_batch_endpoint.call_with_http_info(**kwargs) def create_scorecard_rule( @@ -316,6 +524,23 @@ def create_scorecard_rule( return self._create_scorecard_rule_endpoint.call_with_http_info(**kwargs) + def delete_scorecard_campaign( + self, + campaign_id: str, + ) -> None: + """Delete a campaign. + + Deletes a single campaign by ID or key. + + :param campaign_id: Campaign ID or key. + :type campaign_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["campaign_id"] = campaign_id + + return self._delete_scorecard_campaign_endpoint.call_with_http_info(**kwargs) + def delete_scorecard_rule( self, rule_id: str, @@ -333,6 +558,79 @@ def delete_scorecard_rule( return self._delete_scorecard_rule_endpoint.call_with_http_info(**kwargs) + def get_scorecard_campaign( + self, + campaign_id: str, + *, + include: Union[str, UnsetType] = unset, + include_meta: Union[bool, UnsetType] = unset, + ) -> CampaignResponse: + """Get a campaign. + + Fetches a single campaign by ID or key. + + :param campaign_id: Campaign ID or key. + :type campaign_id: str + :param include: Include related data (for example, scores). + :type include: str, optional + :param include_meta: Include metadata (entity and rule counts). + :type include_meta: bool, optional + :rtype: CampaignResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["campaign_id"] = campaign_id + + if include is not unset: + kwargs["include"] = include + + if include_meta is not unset: + kwargs["include_meta"] = include_meta + + return self._get_scorecard_campaign_endpoint.call_with_http_info(**kwargs) + + def list_scorecard_campaigns( + self, + *, + page_limit: Union[int, UnsetType] = unset, + page_offset: Union[int, UnsetType] = unset, + filter_campaign_name: Union[str, UnsetType] = unset, + filter_campaign_status: Union[str, UnsetType] = unset, + filter_campaign_owner: Union[str, UnsetType] = unset, + ) -> ListCampaignsResponse: + """List all campaigns. + + Fetches all scorecard campaigns. + + :param page_limit: Maximum number of campaigns to return. + :type page_limit: int, optional + :param page_offset: Offset for pagination. + :type page_offset: int, optional + :param filter_campaign_name: Filter campaigns by name (full-text search). + :type filter_campaign_name: str, optional + :param filter_campaign_status: Filter campaigns by status. + :type filter_campaign_status: str, optional + :param filter_campaign_owner: Filter campaigns by owner UUID. + :type filter_campaign_owner: str, optional + :rtype: ListCampaignsResponse + """ + kwargs: Dict[str, Any] = {} + if page_limit is not unset: + kwargs["page_limit"] = page_limit + + if page_offset is not unset: + kwargs["page_offset"] = page_offset + + if filter_campaign_name is not unset: + kwargs["filter_campaign_name"] = filter_campaign_name + + if filter_campaign_status is not unset: + kwargs["filter_campaign_status"] = filter_campaign_status + + if filter_campaign_owner is not unset: + kwargs["filter_campaign_owner"] = filter_campaign_owner + + return self._list_scorecard_campaigns_endpoint.call_with_http_info(**kwargs) + def list_scorecard_outcomes( self, *, @@ -361,11 +659,11 @@ def list_scorecard_outcomes( :type fields_outcome: str, optional :param fields_rule: Return only specified values in the included rule details. :type fields_rule: str, optional - :param filter_outcome_service_name: Filter the outcomes on a specific service name. + :param filter_outcome_service_name: Filter outcomes on a specific service name. :type filter_outcome_service_name: str, optional - :param filter_outcome_state: Filter the outcomes by a specific state. + :param filter_outcome_state: Filter outcomes by a specific state. :type filter_outcome_state: str, optional - :param filter_rule_enabled: Filter outcomes on whether a rule is enabled/disabled. + :param filter_rule_enabled: Filter outcomes based on whether a rule is enabled or disabled. :type filter_rule_enabled: bool, optional :param filter_rule_id: Filter outcomes based on rule ID. :type filter_rule_id: str, optional @@ -434,11 +732,11 @@ def list_scorecard_outcomes_with_pagination( :type fields_outcome: str, optional :param fields_rule: Return only specified values in the included rule details. :type fields_rule: str, optional - :param filter_outcome_service_name: Filter the outcomes on a specific service name. + :param filter_outcome_service_name: Filter outcomes on a specific service name. :type filter_outcome_service_name: str, optional - :param filter_outcome_state: Filter the outcomes by a specific state. + :param filter_outcome_state: Filter outcomes by a specific state. :type filter_outcome_state: str, optional - :param filter_rule_enabled: Filter outcomes on whether a rule is enabled/disabled. + :param filter_rule_enabled: Filter outcomes based on whether a rule is enabled or disabled. :type filter_rule_enabled: bool, optional :param filter_rule_id: Filter outcomes based on rule ID. :type filter_rule_id: str, optional @@ -649,11 +947,76 @@ def list_scorecard_rules_with_pagination( } return endpoint.call_with_http_info_paginated(pagination) - def update_scorecard_outcomes_async( + def list_scorecards( + self, + *, + page_offset: Union[int, UnsetType] = unset, + page_size: Union[int, UnsetType] = unset, + filter_scorecard_id: Union[str, UnsetType] = unset, + filter_scorecard_name: Union[str, UnsetType] = unset, + filter_scorecard_description: Union[str, UnsetType] = unset, + ) -> ListScorecardsResponse: + """List all scorecards. + + Fetches all scorecards. + + :param page_offset: Offset for pagination. + :type page_offset: int, optional + :param page_size: Maximum number of scorecards to return. + :type page_size: int, optional + :param filter_scorecard_id: Filter by scorecard ID. + :type filter_scorecard_id: str, optional + :param filter_scorecard_name: Filter by scorecard name (partial match). + :type filter_scorecard_name: str, optional + :param filter_scorecard_description: Filter by scorecard description (partial match). + :type filter_scorecard_description: str, optional + :rtype: ListScorecardsResponse + """ + kwargs: Dict[str, Any] = {} + if page_offset is not unset: + kwargs["page_offset"] = page_offset + + if page_size is not unset: + kwargs["page_size"] = page_size + + if filter_scorecard_id is not unset: + kwargs["filter_scorecard_id"] = filter_scorecard_id + + if filter_scorecard_name is not unset: + kwargs["filter_scorecard_name"] = filter_scorecard_name + + if filter_scorecard_description is not unset: + kwargs["filter_scorecard_description"] = filter_scorecard_description + + return self._list_scorecards_endpoint.call_with_http_info(**kwargs) + + def update_scorecard_campaign( + self, + campaign_id: str, + body: UpdateCampaignRequest, + ) -> CampaignResponse: + """Update a campaign. + + Updates an existing campaign. + + :param campaign_id: Campaign ID or key. + :type campaign_id: str + :param body: Campaign data. + :type body: UpdateCampaignRequest + :rtype: CampaignResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["campaign_id"] = campaign_id + + kwargs["body"] = body + + return self._update_scorecard_campaign_endpoint.call_with_http_info(**kwargs) + + def update_scorecard_outcomes( self, body: UpdateOutcomesAsyncRequest, ) -> None: - """Update Scorecard outcomes asynchronously. + """Update Scorecard outcomes. Updates multiple scorecard rule outcomes in a single batched request. @@ -664,14 +1027,14 @@ def update_scorecard_outcomes_async( kwargs: Dict[str, Any] = {} kwargs["body"] = body - return self._update_scorecard_outcomes_async_endpoint.call_with_http_info(**kwargs) + return self._update_scorecard_outcomes_endpoint.call_with_http_info(**kwargs) def update_scorecard_rule( self, rule_id: str, body: UpdateRuleRequest, ) -> UpdateRuleResponse: - """Update an existing rule. + """Update an existing scorecard rule. Updates an existing rule. diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index db7cdb8ab0..a25c3dd13c 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -82,13 +82,13 @@ from datadog_api_client.v2.api.rum_replay_sessions_api import RumReplaySessionsApi from datadog_api_client.v2.api.rum_replay_viewership_api import RumReplayViewershipApi from datadog_api_client.v2.api.rum_retention_filters_api import RumRetentionFiltersApi +from datadog_api_client.v2.api.scorecards_api import ScorecardsApi from datadog_api_client.v2.api.seats_api import SeatsApi from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi from datadog_api_client.v2.api.sensitive_data_scanner_api import SensitiveDataScannerApi from datadog_api_client.v2.api.service_accounts_api import ServiceAccountsApi from datadog_api_client.v2.api.service_definition_api import ServiceDefinitionApi from datadog_api_client.v2.api.service_level_objectives_api import ServiceLevelObjectivesApi -from datadog_api_client.v2.api.service_scorecards_api import ServiceScorecardsApi from datadog_api_client.v2.api.service_now_integration_api import ServiceNowIntegrationApi from datadog_api_client.v2.api.software_catalog_api import SoftwareCatalogApi from datadog_api_client.v2.api.spa_api import SpaApi @@ -190,13 +190,13 @@ "RumReplaySessionsApi", "RumReplayViewershipApi", "RumRetentionFiltersApi", + "ScorecardsApi", "SeatsApi", "SecurityMonitoringApi", "SensitiveDataScannerApi", "ServiceAccountsApi", "ServiceDefinitionApi", "ServiceLevelObjectivesApi", - "ServiceScorecardsApi", "ServiceNowIntegrationApi", "SoftwareCatalogApi", "SpaApi", diff --git a/src/datadog_api_client/v2/model/campaign_response.py b/src/datadog_api_client/v2/model/campaign_response.py new file mode 100644 index 0000000000..a2c3a99d28 --- /dev/null +++ b/src/datadog_api_client/v2/model/campaign_response.py @@ -0,0 +1,40 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.campaign_response_data import CampaignResponseData + + +class CampaignResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.campaign_response_data import CampaignResponseData + + return { + "data": (CampaignResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CampaignResponseData, **kwargs): + """ + Response containing campaign data. + + :param data: Campaign data. + :type data: CampaignResponseData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/campaign_response_attributes.py b/src/datadog_api_client/v2/model/campaign_response_attributes.py new file mode 100644 index 0000000000..e1579f8016 --- /dev/null +++ b/src/datadog_api_client/v2/model/campaign_response_attributes.py @@ -0,0 +1,115 @@ +# 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, + datetime, + unset, + UnsetType, +) + + +class CampaignResponseAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "created_at": (datetime,), + "description": (str,), + "due_date": (datetime,), + "entity_scope": (str,), + "guidance": (str,), + "key": (str,), + "modified_at": (datetime,), + "name": (str,), + "owner": (str,), + "start_date": (datetime,), + "status": (str,), + } + + attribute_map = { + "created_at": "created_at", + "description": "description", + "due_date": "due_date", + "entity_scope": "entity_scope", + "guidance": "guidance", + "key": "key", + "modified_at": "modified_at", + "name": "name", + "owner": "owner", + "start_date": "start_date", + "status": "status", + } + + def __init__( + self_, + created_at: datetime, + key: str, + modified_at: datetime, + name: str, + owner: str, + start_date: datetime, + status: str, + description: Union[str, UnsetType] = unset, + due_date: Union[datetime, UnsetType] = unset, + entity_scope: Union[str, UnsetType] = unset, + guidance: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Campaign attributes. + + :param created_at: Creation time of the campaign. + :type created_at: datetime + + :param description: The description of the campaign. + :type description: str, optional + + :param due_date: The due date of the campaign. + :type due_date: datetime, optional + + :param entity_scope: Entity scope query to filter entities for this campaign. + :type entity_scope: str, optional + + :param guidance: Guidance for the campaign. + :type guidance: str, optional + + :param key: The unique key for the campaign. + :type key: str + + :param modified_at: Time of last campaign modification. + :type modified_at: datetime + + :param name: The name of the campaign. + :type name: str + + :param owner: The UUID of the campaign owner. + :type owner: str + + :param start_date: The start date of the campaign. + :type start_date: datetime + + :param status: The status of the campaign. + :type status: str + """ + if description is not unset: + kwargs["description"] = description + if due_date is not unset: + kwargs["due_date"] = due_date + if entity_scope is not unset: + kwargs["entity_scope"] = entity_scope + if guidance is not unset: + kwargs["guidance"] = guidance + super().__init__(kwargs) + + self_.created_at = created_at + self_.key = key + self_.modified_at = modified_at + self_.name = name + self_.owner = owner + self_.start_date = start_date + self_.status = status diff --git a/src/datadog_api_client/v2/model/campaign_response_data.py b/src/datadog_api_client/v2/model/campaign_response_data.py new file mode 100644 index 0000000000..e933789262 --- /dev/null +++ b/src/datadog_api_client/v2/model/campaign_response_data.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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.campaign_response_attributes import CampaignResponseAttributes + from datadog_api_client.v2.model.campaign_type import CampaignType + + +class CampaignResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.campaign_response_attributes import CampaignResponseAttributes + from datadog_api_client.v2.model.campaign_type import CampaignType + + return { + "attributes": (CampaignResponseAttributes,), + "id": (str,), + "type": (CampaignType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: CampaignResponseAttributes, id: str, type: CampaignType, **kwargs): + """ + Campaign data. + + :param attributes: Campaign attributes. + :type attributes: CampaignResponseAttributes + + :param id: The unique ID of the campaign. + :type id: str + + :param type: The JSON:API type for campaigns. + :type type: CampaignType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/campaign_status.py b/src/datadog_api_client/v2/model/campaign_status.py new file mode 100644 index 0000000000..0f95364353 --- /dev/null +++ b/src/datadog_api_client/v2/model/campaign_status.py @@ -0,0 +1,41 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CampaignStatus(ModelSimple): + """ + The status of the campaign. + + :param value: Must be one of ["in_progress", "not_started", "completed"]. + :type value: str + """ + + allowed_values = { + "in_progress", + "not_started", + "completed", + } + IN_PROGRESS: ClassVar["CampaignStatus"] + NOT_STARTED: ClassVar["CampaignStatus"] + COMPLETED: ClassVar["CampaignStatus"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CampaignStatus.IN_PROGRESS = CampaignStatus("in_progress") +CampaignStatus.NOT_STARTED = CampaignStatus("not_started") +CampaignStatus.COMPLETED = CampaignStatus("completed") diff --git a/src/datadog_api_client/v2/model/campaign_type.py b/src/datadog_api_client/v2/model/campaign_type.py new file mode 100644 index 0000000000..ad488b91d0 --- /dev/null +++ b/src/datadog_api_client/v2/model/campaign_type.py @@ -0,0 +1,35 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class CampaignType(ModelSimple): + """ + The JSON:API type for campaigns. + + :param value: If omitted defaults to "campaign". Must be one of ["campaign"]. + :type value: str + """ + + allowed_values = { + "campaign", + } + CAMPAIGN: ClassVar["CampaignType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +CampaignType.CAMPAIGN = CampaignType("campaign") diff --git a/src/datadog_api_client/v2/model/create_campaign_request.py b/src/datadog_api_client/v2/model/create_campaign_request.py new file mode 100644 index 0000000000..658bb1cedc --- /dev/null +++ b/src/datadog_api_client/v2/model/create_campaign_request.py @@ -0,0 +1,40 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_campaign_request_data import CreateCampaignRequestData + + +class CreateCampaignRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_campaign_request_data import CreateCampaignRequestData + + return { + "data": (CreateCampaignRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: CreateCampaignRequestData, **kwargs): + """ + Request to create a new campaign. + + :param data: Data for creating a new campaign. + :type data: CreateCampaignRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/create_campaign_request_attributes.py b/src/datadog_api_client/v2/model/create_campaign_request_attributes.py new file mode 100644 index 0000000000..8eade9761c --- /dev/null +++ b/src/datadog_api_client/v2/model/create_campaign_request_attributes.py @@ -0,0 +1,115 @@ +# 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, + datetime, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.campaign_status import CampaignStatus + + +class CreateCampaignRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.campaign_status import CampaignStatus + + return { + "description": (str,), + "due_date": (datetime,), + "entity_scope": (str,), + "guidance": (str,), + "key": (str,), + "name": (str,), + "owner_id": (str,), + "rule_ids": ([str],), + "start_date": (datetime,), + "status": (CampaignStatus,), + } + + attribute_map = { + "description": "description", + "due_date": "due_date", + "entity_scope": "entity_scope", + "guidance": "guidance", + "key": "key", + "name": "name", + "owner_id": "owner_id", + "rule_ids": "rule_ids", + "start_date": "start_date", + "status": "status", + } + + def __init__( + self_, + key: str, + name: str, + owner_id: str, + rule_ids: List[str], + start_date: datetime, + description: Union[str, UnsetType] = unset, + due_date: Union[datetime, UnsetType] = unset, + entity_scope: Union[str, UnsetType] = unset, + guidance: Union[str, UnsetType] = unset, + status: Union[CampaignStatus, UnsetType] = unset, + **kwargs, + ): + """ + Attributes for creating a new campaign. + + :param description: The description of the campaign. + :type description: str, optional + + :param due_date: The due date of the campaign. + :type due_date: datetime, optional + + :param entity_scope: Entity scope query to filter entities for this campaign. + :type entity_scope: str, optional + + :param guidance: Guidance for the campaign. + :type guidance: str, optional + + :param key: The unique key for the campaign. + :type key: str + + :param name: The name of the campaign. + :type name: str + + :param owner_id: The UUID of the campaign owner. + :type owner_id: str + + :param rule_ids: Array of rule IDs associated with this campaign. + :type rule_ids: [str] + + :param start_date: The start date of the campaign. + :type start_date: datetime + + :param status: The status of the campaign. + :type status: CampaignStatus, optional + """ + if description is not unset: + kwargs["description"] = description + if due_date is not unset: + kwargs["due_date"] = due_date + if entity_scope is not unset: + kwargs["entity_scope"] = entity_scope + if guidance is not unset: + kwargs["guidance"] = guidance + if status is not unset: + kwargs["status"] = status + super().__init__(kwargs) + + self_.key = key + self_.name = name + self_.owner_id = owner_id + self_.rule_ids = rule_ids + self_.start_date = start_date diff --git a/src/datadog_api_client/v2/model/create_campaign_request_data.py b/src/datadog_api_client/v2/model/create_campaign_request_data.py new file mode 100644 index 0000000000..c9e307e1f4 --- /dev/null +++ b/src/datadog_api_client/v2/model/create_campaign_request_data.py @@ -0,0 +1,48 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.create_campaign_request_attributes import CreateCampaignRequestAttributes + from datadog_api_client.v2.model.campaign_type import CampaignType + + +class CreateCampaignRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.create_campaign_request_attributes import CreateCampaignRequestAttributes + from datadog_api_client.v2.model.campaign_type import CampaignType + + return { + "attributes": (CreateCampaignRequestAttributes,), + "type": (CampaignType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: CreateCampaignRequestAttributes, type: CampaignType, **kwargs): + """ + Data for creating a new campaign. + + :param attributes: Attributes for creating a new campaign. + :type attributes: CreateCampaignRequestAttributes + + :param type: The JSON:API type for campaigns. + :type type: CampaignType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/create_rule_request_data.py b/src/datadog_api_client/v2/model/create_rule_request_data.py index ff44f6c2a8..25ac9ed0ea 100644 --- a/src/datadog_api_client/v2/model/create_rule_request_data.py +++ b/src/datadog_api_client/v2/model/create_rule_request_data.py @@ -14,18 +14,18 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.rule_attributes import RuleAttributes + from datadog_api_client.v2.model.rule_attributes_request import RuleAttributesRequest from datadog_api_client.v2.model.rule_type import RuleType class CreateRuleRequestData(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.rule_attributes import RuleAttributes + from datadog_api_client.v2.model.rule_attributes_request import RuleAttributesRequest from datadog_api_client.v2.model.rule_type import RuleType return { - "attributes": (RuleAttributes,), + "attributes": (RuleAttributesRequest,), "type": (RuleType,), } @@ -35,13 +35,16 @@ def openapi_types(_): } def __init__( - self_, attributes: Union[RuleAttributes, UnsetType] = unset, type: Union[RuleType, UnsetType] = unset, **kwargs + self_, + attributes: Union[RuleAttributesRequest, UnsetType] = unset, + type: Union[RuleType, UnsetType] = unset, + **kwargs, ): """ Scorecard create rule request data. - :param attributes: Details of a rule. - :type attributes: RuleAttributes, optional + :param attributes: Attributes for creating or updating a rule. Server-managed fields (created_at, modified_at, custom) are excluded. + :type attributes: RuleAttributesRequest, optional :param type: The JSON:API type for scorecard rules. :type type: RuleType, optional diff --git a/src/datadog_api_client/v2/model/list_campaigns_response.py b/src/datadog_api_client/v2/model/list_campaigns_response.py new file mode 100644 index 0000000000..062a11da07 --- /dev/null +++ b/src/datadog_api_client/v2/model/list_campaigns_response.py @@ -0,0 +1,48 @@ +# 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, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.campaign_response_data import CampaignResponseData + from datadog_api_client.v2.model.paginated_response_meta import PaginatedResponseMeta + + +class ListCampaignsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.campaign_response_data import CampaignResponseData + from datadog_api_client.v2.model.paginated_response_meta import PaginatedResponseMeta + + return { + "data": ([CampaignResponseData],), + "meta": (PaginatedResponseMeta,), + } + + attribute_map = { + "data": "data", + "meta": "meta", + } + + def __init__(self_, data: List[CampaignResponseData], meta: PaginatedResponseMeta, **kwargs): + """ + Response containing a list of campaigns. + + :param data: Array of campaigns. + :type data: [CampaignResponseData] + + :param meta: Metadata for scores response. + :type meta: PaginatedResponseMeta + """ + super().__init__(kwargs) + + self_.data = data + self_.meta = meta diff --git a/src/datadog_api_client/v2/model/list_scorecards_response.py b/src/datadog_api_client/v2/model/list_scorecards_response.py new file mode 100644 index 0000000000..4685773b40 --- /dev/null +++ b/src/datadog_api_client/v2/model/list_scorecards_response.py @@ -0,0 +1,40 @@ +# 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, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.scorecard_list_response_data import ScorecardListResponseData + + +class ListScorecardsResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.scorecard_list_response_data import ScorecardListResponseData + + return { + "data": ([ScorecardListResponseData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[ScorecardListResponseData], **kwargs): + """ + Response containing a list of scorecards. + + :param data: Array of scorecards. + :type data: [ScorecardListResponseData] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/paginated_response_meta.py b/src/datadog_api_client/v2/model/paginated_response_meta.py new file mode 100644 index 0000000000..56939d857c --- /dev/null +++ b/src/datadog_api_client/v2/model/paginated_response_meta.py @@ -0,0 +1,51 @@ +# 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 datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class PaginatedResponseMeta(ModelNormal): + @cached_property + def openapi_types(_): + return { + "count": (int,), + "limit": (int,), + "offset": (int,), + "total": (int,), + } + + attribute_map = { + "count": "count", + "limit": "limit", + "offset": "offset", + "total": "total", + } + + def __init__(self_, count: int, limit: int, offset: int, total: int, **kwargs): + """ + Metadata for scores response. + + :param count: Number of entities in this response. + :type count: int + + :param limit: Pagination limit. + :type limit: int + + :param offset: Pagination offset. + :type offset: int + + :param total: Total number of entities available. + :type total: int + """ + super().__init__(kwargs) + + self_.count = count + self_.limit = limit + self_.offset = offset + self_.total = total diff --git a/src/datadog_api_client/v2/model/rule_attributes.py b/src/datadog_api_client/v2/model/rule_attributes.py index 25ad024b5e..54718394b8 100644 --- a/src/datadog_api_client/v2/model/rule_attributes.py +++ b/src/datadog_api_client/v2/model/rule_attributes.py @@ -34,6 +34,7 @@ def openapi_types(_): "modified_at": (datetime,), "name": (str,), "owner": (str,), + "scope_query": (str,), "scorecard_name": (str,), } @@ -47,6 +48,7 @@ def openapi_types(_): "modified_at": "modified_at", "name": "name", "owner": "owner", + "scope_query": "scope_query", "scorecard_name": "scorecard_name", } @@ -61,6 +63,7 @@ def __init__( modified_at: Union[datetime, UnsetType] = unset, name: Union[str, UnsetType] = unset, owner: Union[str, UnsetType] = unset, + scope_query: Union[str, UnsetType] = unset, scorecard_name: Union[str, UnsetType] = unset, **kwargs, ): @@ -94,6 +97,9 @@ def __init__( :param owner: Owner of the rule. :type owner: str, optional + :param scope_query: A query to filter which entities this rule applies to. + :type scope_query: str, optional + :param scorecard_name: The scorecard name to which this rule must belong. :type scorecard_name: str, optional """ @@ -115,6 +121,8 @@ def __init__( kwargs["name"] = name if owner is not unset: kwargs["owner"] = owner + if scope_query is not unset: + kwargs["scope_query"] = scope_query if scorecard_name is not unset: kwargs["scorecard_name"] = scorecard_name super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/rule_attributes_request.py b/src/datadog_api_client/v2/model/rule_attributes_request.py new file mode 100644 index 0000000000..1f6f100904 --- /dev/null +++ b/src/datadog_api_client/v2/model/rule_attributes_request.py @@ -0,0 +1,95 @@ +# 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 RuleAttributesRequest(ModelNormal): + validations = { + "level": { + "inclusive_maximum": 3, + "inclusive_minimum": 1, + }, + } + + @cached_property + def openapi_types(_): + return { + "description": (str,), + "enabled": (bool,), + "level": (int,), + "name": (str,), + "owner": (str,), + "scope_query": (str,), + "scorecard_name": (str,), + } + + attribute_map = { + "description": "description", + "enabled": "enabled", + "level": "level", + "name": "name", + "owner": "owner", + "scope_query": "scope_query", + "scorecard_name": "scorecard_name", + } + + def __init__( + self_, + description: Union[str, UnsetType] = unset, + enabled: Union[bool, UnsetType] = unset, + level: Union[int, UnsetType] = unset, + name: Union[str, UnsetType] = unset, + owner: Union[str, UnsetType] = unset, + scope_query: Union[str, UnsetType] = unset, + scorecard_name: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Attributes for creating or updating a rule. Server-managed fields (created_at, modified_at, custom) are excluded. + + :param description: Explanation of the rule. + :type description: str, optional + + :param enabled: If enabled, the rule is calculated as part of the score. + :type enabled: bool, optional + + :param level: The maturity level of the rule (1, 2, or 3). + :type level: int, optional + + :param name: Name of the rule. + :type name: str, optional + + :param owner: Owner of the rule. + :type owner: str, optional + + :param scope_query: A query to filter which entities this rule applies to. + :type scope_query: str, optional + + :param scorecard_name: The scorecard name to which this rule must belong. + :type scorecard_name: str, optional + """ + if description is not unset: + kwargs["description"] = description + if enabled is not unset: + kwargs["enabled"] = enabled + if level is not unset: + kwargs["level"] = level + if name is not unset: + kwargs["name"] = name + if owner is not unset: + kwargs["owner"] = owner + if scope_query is not unset: + kwargs["scope_query"] = scope_query + if scorecard_name is not unset: + kwargs["scorecard_name"] = scorecard_name + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/scorecard_list_response_attributes.py b/src/datadog_api_client/v2/model/scorecard_list_response_attributes.py new file mode 100644 index 0000000000..db0ea8b618 --- /dev/null +++ b/src/datadog_api_client/v2/model/scorecard_list_response_attributes.py @@ -0,0 +1,63 @@ +# 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, + datetime, + unset, + UnsetType, +) + + +class ScorecardListResponseAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "created_at": (datetime,), + "description": (str,), + "modified_at": (datetime,), + "name": (str,), + } + + attribute_map = { + "created_at": "created_at", + "description": "description", + "modified_at": "modified_at", + "name": "name", + } + + def __init__( + self_, + created_at: datetime, + modified_at: datetime, + name: str, + description: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Scorecard attributes. + + :param created_at: Creation time of the scorecard. + :type created_at: datetime + + :param description: The description of the scorecard. + :type description: str, optional + + :param modified_at: Time of last scorecard modification. + :type modified_at: datetime + + :param name: The name of the scorecard. + :type name: str + """ + if description is not unset: + kwargs["description"] = description + super().__init__(kwargs) + + self_.created_at = created_at + self_.modified_at = modified_at + self_.name = name diff --git a/src/datadog_api_client/v2/model/scorecard_list_response_data.py b/src/datadog_api_client/v2/model/scorecard_list_response_data.py new file mode 100644 index 0000000000..f0cf6821dd --- /dev/null +++ b/src/datadog_api_client/v2/model/scorecard_list_response_data.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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.scorecard_list_response_attributes import ScorecardListResponseAttributes + from datadog_api_client.v2.model.scorecard_list_type import ScorecardListType + + +class ScorecardListResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.scorecard_list_response_attributes import ScorecardListResponseAttributes + from datadog_api_client.v2.model.scorecard_list_type import ScorecardListType + + return { + "attributes": (ScorecardListResponseAttributes,), + "id": (str,), + "type": (ScorecardListType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: ScorecardListResponseAttributes, id: str, type: ScorecardListType, **kwargs): + """ + Scorecard data. + + :param attributes: Scorecard attributes. + :type attributes: ScorecardListResponseAttributes + + :param id: The unique ID of the scorecard. + :type id: str + + :param type: The JSON:API type for scorecard list. + :type type: ScorecardListType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/scorecard_list_type.py b/src/datadog_api_client/v2/model/scorecard_list_type.py new file mode 100644 index 0000000000..264cf27f80 --- /dev/null +++ b/src/datadog_api_client/v2/model/scorecard_list_type.py @@ -0,0 +1,35 @@ +# 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 datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class ScorecardListType(ModelSimple): + """ + The JSON:API type for scorecard list. + + :param value: If omitted defaults to "scorecard". Must be one of ["scorecard"]. + :type value: str + """ + + allowed_values = { + "scorecard", + } + SCORECARD: ClassVar["ScorecardListType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +ScorecardListType.SCORECARD = ScorecardListType("scorecard") diff --git a/src/datadog_api_client/v2/model/update_campaign_request.py b/src/datadog_api_client/v2/model/update_campaign_request.py new file mode 100644 index 0000000000..4ef257e37a --- /dev/null +++ b/src/datadog_api_client/v2/model/update_campaign_request.py @@ -0,0 +1,40 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.update_campaign_request_data import UpdateCampaignRequestData + + +class UpdateCampaignRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.update_campaign_request_data import UpdateCampaignRequestData + + return { + "data": (UpdateCampaignRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: UpdateCampaignRequestData, **kwargs): + """ + Request to update a campaign. + + :param data: Data for updating a campaign. + :type data: UpdateCampaignRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/update_campaign_request_attributes.py b/src/datadog_api_client/v2/model/update_campaign_request_attributes.py new file mode 100644 index 0000000000..e60f938ab2 --- /dev/null +++ b/src/datadog_api_client/v2/model/update_campaign_request_attributes.py @@ -0,0 +1,109 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + unset, + UnsetType, +) + + +class UpdateCampaignRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "description": (str,), + "due_date": (datetime,), + "entity_scope": (str,), + "guidance": (str,), + "key": (str,), + "name": (str,), + "owner_id": (str,), + "rule_ids": ([str],), + "start_date": (datetime,), + "status": (str,), + } + + attribute_map = { + "description": "description", + "due_date": "due_date", + "entity_scope": "entity_scope", + "guidance": "guidance", + "key": "key", + "name": "name", + "owner_id": "owner_id", + "rule_ids": "rule_ids", + "start_date": "start_date", + "status": "status", + } + + def __init__( + self_, + name: str, + owner_id: str, + rule_ids: List[str], + start_date: datetime, + status: str, + description: Union[str, UnsetType] = unset, + due_date: Union[datetime, UnsetType] = unset, + entity_scope: Union[str, UnsetType] = unset, + guidance: Union[str, UnsetType] = unset, + key: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Attributes for updating a campaign. + + :param description: The description of the campaign. + :type description: str, optional + + :param due_date: The due date of the campaign. + :type due_date: datetime, optional + + :param entity_scope: Entity scope query to filter entities for this campaign. + :type entity_scope: str, optional + + :param guidance: Guidance for the campaign. + :type guidance: str, optional + + :param key: The unique key for the campaign. + :type key: str, optional + + :param name: The name of the campaign. + :type name: str + + :param owner_id: The UUID of the campaign owner. + :type owner_id: str + + :param rule_ids: Array of rule IDs associated with this campaign. + :type rule_ids: [str] + + :param start_date: The start date of the campaign. + :type start_date: datetime + + :param status: The status of the campaign. + :type status: str + """ + if description is not unset: + kwargs["description"] = description + if due_date is not unset: + kwargs["due_date"] = due_date + if entity_scope is not unset: + kwargs["entity_scope"] = entity_scope + if guidance is not unset: + kwargs["guidance"] = guidance + if key is not unset: + kwargs["key"] = key + super().__init__(kwargs) + + self_.name = name + self_.owner_id = owner_id + self_.rule_ids = rule_ids + self_.start_date = start_date + self_.status = status diff --git a/src/datadog_api_client/v2/model/update_campaign_request_data.py b/src/datadog_api_client/v2/model/update_campaign_request_data.py new file mode 100644 index 0000000000..3e0178451d --- /dev/null +++ b/src/datadog_api_client/v2/model/update_campaign_request_data.py @@ -0,0 +1,48 @@ +# 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 TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.update_campaign_request_attributes import UpdateCampaignRequestAttributes + from datadog_api_client.v2.model.campaign_type import CampaignType + + +class UpdateCampaignRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.update_campaign_request_attributes import UpdateCampaignRequestAttributes + from datadog_api_client.v2.model.campaign_type import CampaignType + + return { + "attributes": (UpdateCampaignRequestAttributes,), + "type": (CampaignType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: UpdateCampaignRequestAttributes, type: CampaignType, **kwargs): + """ + Data for updating a campaign. + + :param attributes: Attributes for updating a campaign. + :type attributes: UpdateCampaignRequestAttributes + + :param type: The JSON:API type for campaigns. + :type type: CampaignType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/update_rule_request_data.py b/src/datadog_api_client/v2/model/update_rule_request_data.py index e9e86576b0..07bd1f8f93 100644 --- a/src/datadog_api_client/v2/model/update_rule_request_data.py +++ b/src/datadog_api_client/v2/model/update_rule_request_data.py @@ -14,18 +14,18 @@ if TYPE_CHECKING: - from datadog_api_client.v2.model.rule_attributes import RuleAttributes + from datadog_api_client.v2.model.rule_attributes_request import RuleAttributesRequest from datadog_api_client.v2.model.rule_type import RuleType class UpdateRuleRequestData(ModelNormal): @cached_property def openapi_types(_): - from datadog_api_client.v2.model.rule_attributes import RuleAttributes + from datadog_api_client.v2.model.rule_attributes_request import RuleAttributesRequest from datadog_api_client.v2.model.rule_type import RuleType return { - "attributes": (RuleAttributes,), + "attributes": (RuleAttributesRequest,), "type": (RuleType,), } @@ -35,13 +35,16 @@ def openapi_types(_): } def __init__( - self_, attributes: Union[RuleAttributes, UnsetType] = unset, type: Union[RuleType, UnsetType] = unset, **kwargs + self_, + attributes: Union[RuleAttributesRequest, UnsetType] = unset, + type: Union[RuleType, UnsetType] = unset, + **kwargs, ): """ Data for the request to update a scorecard rule. - :param attributes: Details of a rule. - :type attributes: RuleAttributes, optional + :param attributes: Attributes for creating or updating a rule. Server-managed fields (created_at, modified_at, custom) are excluded. + :type attributes: RuleAttributesRequest, optional :param type: The JSON:API type for scorecard rules. :type type: RuleType, optional diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 50b1f6b750..57957f4957 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -700,6 +700,11 @@ from datadog_api_client.v2.model.csm_agents_type import CSMAgentsType from datadog_api_client.v2.model.cvss import CVSS from datadog_api_client.v2.model.calculated_field import CalculatedField +from datadog_api_client.v2.model.campaign_response import CampaignResponse +from datadog_api_client.v2.model.campaign_response_attributes import CampaignResponseAttributes +from datadog_api_client.v2.model.campaign_response_data import CampaignResponseData +from datadog_api_client.v2.model.campaign_status import CampaignStatus +from datadog_api_client.v2.model.campaign_type import CampaignType from datadog_api_client.v2.model.cancel_data_deletion_response_body import CancelDataDeletionResponseBody from datadog_api_client.v2.model.case import Case from datadog_api_client.v2.model.case3rd_party_ticket_status import Case3rdPartyTicketStatus @@ -1133,6 +1138,9 @@ from datadog_api_client.v2.model.create_attachment_request_data_attributes_attachment import ( CreateAttachmentRequestDataAttributesAttachment, ) +from datadog_api_client.v2.model.create_campaign_request import CreateCampaignRequest +from datadog_api_client.v2.model.create_campaign_request_attributes import CreateCampaignRequestAttributes +from datadog_api_client.v2.model.create_campaign_request_data import CreateCampaignRequestData from datadog_api_client.v2.model.create_case_request_array import CreateCaseRequestArray from datadog_api_client.v2.model.create_case_request_data import CreateCaseRequestData from datadog_api_client.v2.model.create_case_request_data_attributes import CreateCaseRequestDataAttributes @@ -3068,6 +3076,7 @@ from datadog_api_client.v2.model.list_apps_response_meta import ListAppsResponseMeta from datadog_api_client.v2.model.list_apps_response_meta_page import ListAppsResponseMetaPage from datadog_api_client.v2.model.list_assets_sbo_ms_response import ListAssetsSBOMsResponse +from datadog_api_client.v2.model.list_campaigns_response import ListCampaignsResponse from datadog_api_client.v2.model.list_connections_response import ListConnectionsResponse from datadog_api_client.v2.model.list_connections_response_data import ListConnectionsResponseData from datadog_api_client.v2.model.list_connections_response_data_attributes import ListConnectionsResponseDataAttributes @@ -3109,6 +3118,7 @@ from datadog_api_client.v2.model.list_rules_response import ListRulesResponse from datadog_api_client.v2.model.list_rules_response_data_item import ListRulesResponseDataItem from datadog_api_client.v2.model.list_rules_response_links import ListRulesResponseLinks +from datadog_api_client.v2.model.list_scorecards_response import ListScorecardsResponse from datadog_api_client.v2.model.list_security_findings_response import ListSecurityFindingsResponse from datadog_api_client.v2.model.list_tags_response import ListTagsResponse from datadog_api_client.v2.model.list_tags_response_data import ListTagsResponseData @@ -4432,6 +4442,7 @@ from datadog_api_client.v2.model.output_schema_parameters import OutputSchemaParameters from datadog_api_client.v2.model.output_schema_parameters_type import OutputSchemaParametersType from datadog_api_client.v2.model.page_urgency import PageUrgency +from datadog_api_client.v2.model.paginated_response_meta import PaginatedResponseMeta from datadog_api_client.v2.model.pagination import Pagination from datadog_api_client.v2.model.pagination_meta import PaginationMeta from datadog_api_client.v2.model.pagination_meta_page import PaginationMetaPage @@ -4955,6 +4966,7 @@ ) from datadog_api_client.v2.model.routing_rule_type import RoutingRuleType from datadog_api_client.v2.model.rule_attributes import RuleAttributes +from datadog_api_client.v2.model.rule_attributes_request import RuleAttributesRequest from datadog_api_client.v2.model.rule_outcome_relationships import RuleOutcomeRelationships from datadog_api_client.v2.model.rule_severity import RuleSeverity from datadog_api_client.v2.model.rule_type import RuleType @@ -5170,6 +5182,9 @@ from datadog_api_client.v2.model.schedule_user import ScheduleUser from datadog_api_client.v2.model.schedule_user_attributes import ScheduleUserAttributes from datadog_api_client.v2.model.schedule_user_type import ScheduleUserType +from datadog_api_client.v2.model.scorecard_list_response_attributes import ScorecardListResponseAttributes +from datadog_api_client.v2.model.scorecard_list_response_data import ScorecardListResponseData +from datadog_api_client.v2.model.scorecard_list_type import ScorecardListType from datadog_api_client.v2.model.scorecard_type import ScorecardType from datadog_api_client.v2.model.search_issues_include_query_parameter_item import SearchIssuesIncludeQueryParameterItem from datadog_api_client.v2.model.seat_assignments_data_type import SeatAssignmentsDataType @@ -6503,6 +6518,9 @@ from datadog_api_client.v2.model.update_apps_datastore_request_data_attributes import ( UpdateAppsDatastoreRequestDataAttributes, ) +from datadog_api_client.v2.model.update_campaign_request import UpdateCampaignRequest +from datadog_api_client.v2.model.update_campaign_request_attributes import UpdateCampaignRequestAttributes +from datadog_api_client.v2.model.update_campaign_request_data import UpdateCampaignRequestData from datadog_api_client.v2.model.update_connection_request import UpdateConnectionRequest from datadog_api_client.v2.model.update_connection_request_data import UpdateConnectionRequestData from datadog_api_client.v2.model.update_connection_request_data_attributes import UpdateConnectionRequestDataAttributes @@ -7298,6 +7316,11 @@ "CSMAgentsType", "CVSS", "CalculatedField", + "CampaignResponse", + "CampaignResponseAttributes", + "CampaignResponseData", + "CampaignStatus", + "CampaignType", "CancelDataDeletionResponseBody", "Case", "Case3rdPartyTicketStatus", @@ -7633,6 +7656,9 @@ "CreateAttachmentRequestData", "CreateAttachmentRequestDataAttributes", "CreateAttachmentRequestDataAttributesAttachment", + "CreateCampaignRequest", + "CreateCampaignRequestAttributes", + "CreateCampaignRequestData", "CreateCaseRequestArray", "CreateCaseRequestData", "CreateCaseRequestDataAttributes", @@ -9090,6 +9116,7 @@ "ListAppsResponseMeta", "ListAppsResponseMetaPage", "ListAssetsSBOMsResponse", + "ListCampaignsResponse", "ListConnectionsResponse", "ListConnectionsResponseData", "ListConnectionsResponseDataAttributes", @@ -9125,6 +9152,7 @@ "ListRulesResponse", "ListRulesResponseDataItem", "ListRulesResponseLinks", + "ListScorecardsResponse", "ListSecurityFindingsResponse", "ListTagsResponse", "ListTagsResponseData", @@ -9850,6 +9878,7 @@ "OutputSchemaParameters", "OutputSchemaParametersType", "PageUrgency", + "PaginatedResponseMeta", "Pagination", "PaginationMeta", "PaginationMetaPage", @@ -10269,6 +10298,7 @@ "RoutingRuleRelationshipsPolicyDataType", "RoutingRuleType", "RuleAttributes", + "RuleAttributesRequest", "RuleOutcomeRelationships", "RuleSeverity", "RuleType", @@ -10438,6 +10468,9 @@ "ScheduleUser", "ScheduleUserAttributes", "ScheduleUserType", + "ScorecardListResponseAttributes", + "ScorecardListResponseData", + "ScorecardListType", "ScorecardType", "SearchIssuesIncludeQueryParameterItem", "SeatAssignmentsDataType", @@ -11331,6 +11364,9 @@ "UpdateAppsDatastoreRequest", "UpdateAppsDatastoreRequestData", "UpdateAppsDatastoreRequestDataAttributes", + "UpdateCampaignRequest", + "UpdateCampaignRequestAttributes", + "UpdateCampaignRequestData", "UpdateConnectionRequest", "UpdateConnectionRequestData", "UpdateConnectionRequestDataAttributes", diff --git a/tests/v2/cassettes/test_scenarios/test_update_an_existing_rule_returns_rule_updated_successfully_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_an_existing_rule_returns_rule_updated_successfully_response.yaml index 74b3e94549..6029a496b5 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_an_existing_rule_returns_rule_updated_successfully_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_update_an_existing_rule_returns_rule_updated_successfully_response.yaml @@ -22,7 +22,7 @@ interactions: message: Created - request: body: '{"data":{"attributes":{"description":"Updated description via test","enabled":true,"name":"Test-Update_an_existing_rule_returns_Rule_updated_successfully_response-1722307632","scorecard_name":"OpenAPI - Spec Test Best Practices"}}}' + Spec Test Best Practices"},"type":"rule"}}' headers: accept: - application/json diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 8413be265a..88d6e09631 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -1066,7 +1066,7 @@ ], "step": "there is a valid \"create_scorecard_rule\" in the system", "key": "create_scorecard_rule", - "tag": "Service Scorecards", + "tag": "Scorecards", "operationId": "CreateScorecardRule" }, { diff --git a/tests/v2/features/scorecards.feature b/tests/v2/features/scorecards.feature new file mode 100644 index 0000000000..750948d899 --- /dev/null +++ b/tests/v2/features/scorecards.feature @@ -0,0 +1,289 @@ +@endpoint(scorecards) @endpoint(scorecards-v2) +Feature: Scorecards + API to create and update scorecard rules and outcomes. See + [Scorecards](https://docs.datadoghq.com/service_catalog/scorecards) for + more information. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Scorecards" API + + @generated @skip @team:DataDog/service-catalog + Scenario: Create a new campaign returns "Bad Request" response + Given new "CreateScorecardCampaign" request + And body with value {"data": {"attributes": {"description": "Campaign to improve security posture for Q1 2024.", "due_date": "2024-03-31T23:59:59Z", "entity_scope": "kind:service AND team:platform", "guidance": "Please ensure all services pass the security requirements.", "key": "q1-security-2024", "name": "Q1 Security Campaign", "owner_id": "550e8400-e29b-41d4-a716-446655440000", "rule_ids": ["q8MQxk8TCqrHnWkx", "r9NRyl9UDrsIoXly"], "start_date": "2024-01-01T00:00:00Z", "status": "in_progress"}, "type": "campaign"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/service-catalog + Scenario: Create a new campaign returns "Created" response + Given new "CreateScorecardCampaign" request + And body with value {"data": {"attributes": {"description": "Campaign to improve security posture for Q1 2024.", "due_date": "2024-03-31T23:59:59Z", "entity_scope": "kind:service AND team:platform", "guidance": "Please ensure all services pass the security requirements.", "key": "q1-security-2024", "name": "Q1 Security Campaign", "owner_id": "550e8400-e29b-41d4-a716-446655440000", "rule_ids": ["q8MQxk8TCqrHnWkx", "r9NRyl9UDrsIoXly"], "start_date": "2024-01-01T00:00:00Z", "status": "in_progress"}, "type": "campaign"}} + When the request is sent + Then the response status is 201 Created + + @team:DataDog/service-catalog + Scenario: Create a new rule returns "Bad Request" response + Given new "CreateScorecardRule" request + And body with value {"data": {"attributes": {"enabled": true, "level": 2, "name": "Team Defined", "scorecard_id": "NOT.FOUND"}, "type": "rule"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/service-catalog + Scenario: Create a new rule returns "Created" response + Given new "CreateScorecardRule" request + And body with value {"data": {"attributes": {"enabled": true, "name": "{{unique}}", "scorecard_name": "Observability Best Practices"}, "type": "rule"}} + When the request is sent + Then the response status is 201 Created + And the response "data.attributes.scorecard_name" is equal to "Observability Best Practices" + And the response "data.relationships.scorecard.data" has field "id" + + @team:DataDog/service-catalog + Scenario: Create outcomes batch returns "Bad Request" response + Given there is a valid "create_scorecard_rule" in the system + And operation "CreateScorecardOutcomesBatch" enabled + And new "CreateScorecardOutcomesBatch" request + And body with value {"data": {"attributes": {"results": [{"remarks": "See: Services", "rule_id": "{{ create_scorecard_rule.data.id }}", "state": "pass", "service_name": ""}]}, "type": "batched-outcome"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/service-catalog + Scenario: Create outcomes batch returns "OK" response + Given there is a valid "create_scorecard_rule" in the system + And operation "CreateScorecardOutcomesBatch" enabled + And new "CreateScorecardOutcomesBatch" request + And body with value {"data": {"attributes": {"results": [{"remarks": "See: Services", "rule_id": "{{ create_scorecard_rule.data.id }}", "service_name": "my-service", "state": "pass"}]}, "type": "batched-outcome"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/service-catalog + Scenario: Delete a campaign returns "Bad Request" response + Given new "DeleteScorecardCampaign" request + And request contains "campaign_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/service-catalog + Scenario: Delete a campaign returns "No Content" response + Given new "DeleteScorecardCampaign" request + And request contains "campaign_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/service-catalog + Scenario: Delete a campaign returns "Not Found" response + Given new "DeleteScorecardCampaign" request + And request contains "campaign_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/service-catalog + Scenario: Delete a rule returns "Bad Request" response + Given new "DeleteScorecardRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/service-catalog + Scenario: Delete a rule returns "Not Found" response + Given new "DeleteScorecardRule" request + And request contains "rule_id" parameter with value "2a4f524e-168a-429d-bb75-7b1ffeab0cbb" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/service-catalog + Scenario: Delete a rule returns "OK" response + Given there is a valid "create_scorecard_rule" in the system + And new "DeleteScorecardRule" request + And request contains "rule_id" parameter from "create_scorecard_rule.data.id" + When the request is sent + Then the response status is 204 OK + + @generated @skip @team:DataDog/service-catalog + Scenario: Get a campaign returns "Bad Request" response + Given new "GetScorecardCampaign" request + And request contains "campaign_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/service-catalog + Scenario: Get a campaign returns "Not Found" response + Given new "GetScorecardCampaign" request + And request contains "campaign_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/service-catalog + Scenario: Get a campaign returns "OK" response + Given new "GetScorecardCampaign" request + And request contains "campaign_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/service-catalog + Scenario: List all campaigns returns "Bad Request" response + Given new "ListScorecardCampaigns" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/service-catalog + Scenario: List all campaigns returns "OK" response + Given new "ListScorecardCampaigns" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/service-catalog + Scenario: List all rule outcomes returns "Bad Request" response + Given new "ListScorecardOutcomes" request + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/service-catalog + Scenario: List all rule outcomes returns "OK" response + Given new "ListScorecardOutcomes" request + When the request is sent + Then the response status is 200 OK + + @replay-only @skip-validation @team:DataDog/service-catalog @with-pagination + Scenario: List all rule outcomes returns "OK" response with pagination + Given new "ListScorecardOutcomes" request + And request contains "page[size]" parameter with value 2 + And request contains "fields[outcome]" parameter with value "state" + And request contains "filter[outcome][service_name]" parameter with value "my-service" + When the request with pagination is sent + Then the response status is 200 OK + And the response has 2 items + + @generated @skip @team:DataDog/service-catalog + Scenario: List all rules returns "Bad Request" response + Given new "ListScorecardRules" request + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/service-catalog + Scenario: List all rules returns "OK" response + Given new "ListScorecardRules" request + When the request is sent + Then the response status is 200 OK + + @replay-only @skip-validation @team:DataDog/service-catalog @with-pagination + Scenario: List all rules returns "OK" response with pagination + Given new "ListScorecardRules" request + And request contains "page[size]" parameter with value 2 + And request contains "fields[rule]" parameter with value "name" + And request contains "filter[rule][custom]" parameter with value true + When the request with pagination is sent + Then the response status is 200 OK + And the response has 4 items + + @generated @skip @team:DataDog/service-catalog + Scenario: List all scorecards returns "OK" response + Given new "ListScorecards" request + When the request is sent + Then the response status is 200 OK + + @team:DataDog/service-catalog + Scenario: Update Scorecard outcomes asynchronously returns "Accepted" response + Given there is a valid "create_scorecard_rule" in the system + And new "UpdateScorecardOutcomes" request + And body with value {"data": {"attributes": {"results": [{"rule_id": "{{create_scorecard_rule.data.id}}", "entity_reference": "service:my-service", "remarks": "See: Services", "state": "pass"}]}, "type": "batched-outcome"}} + When the request is sent + Then the response status is 202 Accepted + + @team:DataDog/service-catalog + Scenario: Update Scorecard outcomes asynchronously returns "Bad Request" response + Given there is a valid "create_scorecard_rule" in the system + And new "UpdateScorecardOutcomes" request + And body with value {"data": {"attributes": {"results": [{"rule_id": "{{create_scorecard_rule.data.id}}", "entity_reference": "service:my-service", "state": "INVALID"}]}, "type": "batched-outcome"}} + When the request is sent + Then the response status is 400 Bad Request + And the response "errors" has length 1 + And the response "errors[0]" has field "detail" + + @team:DataDog/service-catalog + Scenario: Update Scorecard outcomes asynchronously returns "Conflict" response + Given new "UpdateScorecardOutcomes" request + And body with value {"data": {"attributes": {"results": [{"rule_id": "INVALID.RULE_ID", "entity_reference": "service:my-service", "remarks": "See: Services", "state": "pass"}]}, "type": "batched-outcome"}} + When the request is sent + Then the response status is 409 Conflict + And the response "errors" has length 1 + + @generated @skip @team:DataDog/service-catalog + Scenario: Update Scorecard outcomes returns "Accepted" response + Given new "UpdateScorecardOutcomes" request + And body with value {"data": {"attributes": {"results": [{"entity_reference": "service:my-service", "remarks": "See: Services", "rule_id": "q8MQxk8TCqrHnWkx", "state": "pass"}]}, "type": "batched-outcome"}} + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/service-catalog + Scenario: Update Scorecard outcomes returns "Bad Request" response + Given new "UpdateScorecardOutcomes" request + And body with value {"data": {"attributes": {"results": [{"entity_reference": "service:my-service", "remarks": "See: Services", "rule_id": "q8MQxk8TCqrHnWkx", "state": "pass"}]}, "type": "batched-outcome"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/service-catalog + Scenario: Update Scorecard outcomes returns "Conflict" response + Given new "UpdateScorecardOutcomes" request + And body with value {"data": {"attributes": {"results": [{"entity_reference": "service:my-service", "remarks": "See: Services", "rule_id": "q8MQxk8TCqrHnWkx", "state": "pass"}]}, "type": "batched-outcome"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/service-catalog + Scenario: Update a campaign returns "Bad Request" response + Given new "UpdateScorecardCampaign" request + And request contains "campaign_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Campaign to improve security posture for Q1 2024.", "due_date": "2024-03-31T23:59:59Z", "entity_scope": "kind:service AND team:platform", "guidance": "Please ensure all services pass the security requirements.", "key": "q1-security-2024", "name": "Q1 Security Campaign", "owner_id": "550e8400-e29b-41d4-a716-446655440000", "rule_ids": ["q8MQxk8TCqrHnWkx", "r9NRyl9UDrsIoXly"], "start_date": "2024-01-01T00:00:00Z", "status": "in_progress"}, "type": "campaign"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/service-catalog + Scenario: Update a campaign returns "Not Found" response + Given new "UpdateScorecardCampaign" request + And request contains "campaign_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Campaign to improve security posture for Q1 2024.", "due_date": "2024-03-31T23:59:59Z", "entity_scope": "kind:service AND team:platform", "guidance": "Please ensure all services pass the security requirements.", "key": "q1-security-2024", "name": "Q1 Security Campaign", "owner_id": "550e8400-e29b-41d4-a716-446655440000", "rule_ids": ["q8MQxk8TCqrHnWkx", "r9NRyl9UDrsIoXly"], "start_date": "2024-01-01T00:00:00Z", "status": "in_progress"}, "type": "campaign"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/service-catalog + Scenario: Update a campaign returns "OK" response + Given new "UpdateScorecardCampaign" request + And request contains "campaign_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Campaign to improve security posture for Q1 2024.", "due_date": "2024-03-31T23:59:59Z", "entity_scope": "kind:service AND team:platform", "guidance": "Please ensure all services pass the security requirements.", "key": "q1-security-2024", "name": "Q1 Security Campaign", "owner_id": "550e8400-e29b-41d4-a716-446655440000", "rule_ids": ["q8MQxk8TCqrHnWkx", "r9NRyl9UDrsIoXly"], "start_date": "2024-01-01T00:00:00Z", "status": "in_progress"}, "type": "campaign"}} + When the request is sent + Then the response status is 200 OK + + @team:DataDog/service-catalog + Scenario: Update an existing rule returns "Rule updated successfully" response + Given there is a valid "create_scorecard_rule" in the system + And new "UpdateScorecardRule" request + And request contains "rule_id" parameter from "create_scorecard_rule.data.id" + And body with value {"data": {"type": "rule", "attributes": {"enabled": true, "name": "{{create_scorecard_rule.data.attributes.name}}", "scorecard_name": "{{create_scorecard_rule.data.attributes.scorecard_name}}", "description": "Updated description via test"}}} + When the request is sent + Then the response status is 200 Rule updated successfully + + @team:DataDog/service-catalog + Scenario: Update an existing scorecard rule returns "Bad Request" response + Given there is a valid "create_scorecard_rule" in the system + And new "UpdateScorecardRule" request + And request contains "rule_id" parameter from "create_scorecard_rule.data.id" + And body with value {"data": {"attributes": {"enabled": true, "level": 2, "name": "Team Defined", "scorecard_id": "NOT.FOUND"}, "type": "rule"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/service-catalog + Scenario: Update an existing scorecard rule returns "Not Found" response + Given new "UpdateScorecardRule" request + And request contains "rule_id" parameter with value "REPLACE.ME" + And body with value {"data": {"attributes": {"enabled": true, "level": 2, "name": "Team Defined", "scorecard_name": "Deployments automated via Deployment Trains"}, "type": "rule"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/service-catalog + Scenario: Update an existing scorecard rule returns "Rule updated successfully" response + Given new "UpdateScorecardRule" request + And request contains "rule_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"enabled": true, "level": 2, "name": "Team Defined", "scope_query": "kind:service", "scorecard_name": "Deployments automated via Deployment Trains"}, "type": "rule"}} + When the request is sent + Then the response status is 200 Rule updated successfully diff --git a/tests/v2/features/service_scorecards.feature b/tests/v2/features/service_scorecards.feature deleted file mode 100644 index 387f04cf71..0000000000 --- a/tests/v2/features/service_scorecards.feature +++ /dev/null @@ -1,189 +0,0 @@ -@endpoint(service-scorecards) @endpoint(service-scorecards-v2) -Feature: Service Scorecards - API to create and update scorecard rules and outcomes. See [Service - Scorecards](https://docs.datadoghq.com/service_catalog/scorecards) for - more information. This feature is currently in BETA. If you have any - feedback, contact [Datadog support](https://docs.datadoghq.com/help/). - - Background: - Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And an instance of "ServiceScorecards" API - - @team:DataDog/service-catalog - Scenario: Create a new rule returns "Bad Request" response - Given operation "CreateScorecardRule" enabled - And new "CreateScorecardRule" request - And body with value {"data": {"attributes": {"enabled": true, "level": 2, "name": "Team Defined", "scorecard_id": "NOT.FOUND"}, "type": "rule"}} - When the request is sent - Then the response status is 400 Bad Request - - @team:DataDog/service-catalog - Scenario: Create a new rule returns "Created" response - Given operation "CreateScorecardRule" enabled - And new "CreateScorecardRule" request - And body with value {"data": {"attributes": {"enabled": true, "name": "{{unique}}", "scorecard_name": "Observability Best Practices"}, "type": "rule"}} - When the request is sent - Then the response status is 201 Created - And the response "data.attributes.scorecard_name" is equal to "Observability Best Practices" - And the response "data.relationships.scorecard.data" has field "id" - - @team:DataDog/service-catalog - Scenario: Create outcomes batch returns "Bad Request" response - Given there is a valid "create_scorecard_rule" in the system - And operation "CreateScorecardOutcomesBatch" enabled - And new "CreateScorecardOutcomesBatch" request - And body with value {"data": {"attributes": {"results": [{"remarks": "See: Services", "rule_id": "{{ create_scorecard_rule.data.id }}", "state": "pass", "service_name": ""}]}, "type": "batched-outcome"}} - When the request is sent - Then the response status is 400 Bad Request - - @team:DataDog/service-catalog - Scenario: Create outcomes batch returns "OK" response - Given there is a valid "create_scorecard_rule" in the system - And operation "CreateScorecardOutcomesBatch" enabled - And new "CreateScorecardOutcomesBatch" request - And body with value {"data": {"attributes": {"results": [{"remarks": "See: Services", "rule_id": "{{ create_scorecard_rule.data.id }}", "service_name": "my-service", "state": "pass"}]}, "type": "batched-outcome"}} - When the request is sent - Then the response status is 200 OK - - @generated @skip @team:DataDog/service-catalog - Scenario: Delete a rule returns "Bad Request" response - Given operation "DeleteScorecardRule" enabled - And new "DeleteScorecardRule" request - And request contains "rule_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @team:DataDog/service-catalog - Scenario: Delete a rule returns "Not Found" response - Given operation "DeleteScorecardRule" enabled - And new "DeleteScorecardRule" request - And request contains "rule_id" parameter with value "2a4f524e-168a-429d-bb75-7b1ffeab0cbb" - When the request is sent - Then the response status is 404 Not Found - - @team:DataDog/service-catalog - Scenario: Delete a rule returns "OK" response - Given operation "DeleteScorecardRule" enabled - And there is a valid "create_scorecard_rule" in the system - And new "DeleteScorecardRule" request - And request contains "rule_id" parameter from "create_scorecard_rule.data.id" - When the request is sent - Then the response status is 204 OK - - @generated @skip @team:DataDog/service-catalog - Scenario: List all rule outcomes returns "Bad Request" response - Given operation "ListScorecardOutcomes" enabled - And new "ListScorecardOutcomes" request - When the request is sent - Then the response status is 400 Bad Request - - @team:DataDog/service-catalog - Scenario: List all rule outcomes returns "OK" response - Given operation "ListScorecardOutcomes" enabled - And new "ListScorecardOutcomes" request - When the request is sent - Then the response status is 200 OK - - @replay-only @skip-validation @team:DataDog/service-catalog @with-pagination - Scenario: List all rule outcomes returns "OK" response with pagination - Given operation "ListScorecardOutcomes" enabled - And new "ListScorecardOutcomes" request - And request contains "page[size]" parameter with value 2 - And request contains "fields[outcome]" parameter with value "state" - And request contains "filter[outcome][service_name]" parameter with value "my-service" - When the request with pagination is sent - Then the response status is 200 OK - And the response has 2 items - - @generated @skip @team:DataDog/service-catalog - Scenario: List all rules returns "Bad Request" response - Given operation "ListScorecardRules" enabled - And new "ListScorecardRules" request - When the request is sent - Then the response status is 400 Bad Request - - @team:DataDog/service-catalog - Scenario: List all rules returns "OK" response - Given operation "ListScorecardRules" enabled - And new "ListScorecardRules" request - When the request is sent - Then the response status is 200 OK - - @replay-only @skip-validation @team:DataDog/service-catalog @with-pagination - Scenario: List all rules returns "OK" response with pagination - Given operation "ListScorecardRules" enabled - And new "ListScorecardRules" request - And request contains "page[size]" parameter with value 2 - And request contains "fields[rule]" parameter with value "name" - And request contains "filter[rule][custom]" parameter with value true - When the request with pagination is sent - Then the response status is 200 OK - And the response has 4 items - - @team:DataDog/service-catalog - Scenario: Update Scorecard outcomes asynchronously returns "Accepted" response - Given operation "UpdateScorecardOutcomesAsync" enabled - And there is a valid "create_scorecard_rule" in the system - And new "UpdateScorecardOutcomesAsync" request - And body with value {"data": {"attributes": {"results": [{"rule_id": "{{create_scorecard_rule.data.id}}", "entity_reference": "service:my-service", "remarks": "See: Services", "state": "pass"}]}, "type": "batched-outcome"}} - When the request is sent - Then the response status is 202 Accepted - - @team:DataDog/service-catalog - Scenario: Update Scorecard outcomes asynchronously returns "Bad Request" response - Given operation "UpdateScorecardOutcomesAsync" enabled - And there is a valid "create_scorecard_rule" in the system - And new "UpdateScorecardOutcomesAsync" request - And body with value {"data": {"attributes": {"results": [{"rule_id": "{{create_scorecard_rule.data.id}}", "entity_reference": "service:my-service", "state": "INVALID"}]}, "type": "batched-outcome"}} - When the request is sent - Then the response status is 400 Bad Request - And the response "errors" has length 1 - And the response "errors[0]" has field "detail" - - @team:DataDog/service-catalog - Scenario: Update Scorecard outcomes asynchronously returns "Conflict" response - Given operation "UpdateScorecardOutcomesAsync" enabled - And new "UpdateScorecardOutcomesAsync" request - And body with value {"data": {"attributes": {"results": [{"rule_id": "INVALID.RULE_ID", "entity_reference": "service:my-service", "remarks": "See: Services", "state": "pass"}]}, "type": "batched-outcome"}} - When the request is sent - Then the response status is 409 Conflict - And the response "errors" has length 1 - - @generated @skip @team:DataDog/service-catalog - Scenario: Update an existing rule returns "Bad Request" response - Given operation "UpdateScorecardRule" enabled - And new "UpdateScorecardRule" request - And request contains "rule_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"enabled": true, "level": 2, "name": "Team Defined", "scorecard_name": "Deployments automated via Deployment Trains"}, "type": "rule"}} - When the request is sent - Then the response status is 400 Bad Request - - @team:DataDog/service-catalog - Scenario: Update an existing rule returns "Rule updated successfully" response - Given operation "UpdateScorecardRule" enabled - And there is a valid "create_scorecard_rule" in the system - And new "UpdateScorecardRule" request - And request contains "rule_id" parameter from "create_scorecard_rule.data.id" - And body with value {"data": { "attributes" : {"enabled": true, "name": "{{create_scorecard_rule.data.attributes.name}}", "scorecard_name": "{{create_scorecard_rule.data.attributes.scorecard_name}}", "description": "Updated description via test"}}} - When the request is sent - Then the response status is 200 Rule updated successfully - - @team:DataDog/service-catalog - Scenario: Update an existing scorecard rule returns "Bad Request" response - Given operation "UpdateScorecardRule" enabled - And there is a valid "create_scorecard_rule" in the system - And new "UpdateScorecardRule" request - And request contains "rule_id" parameter from "create_scorecard_rule.data.id" - And body with value {"data": {"attributes": {"enabled": true, "level": 2, "name": "Team Defined", "scorecard_id": "NOT.FOUND"}, "type": "rule"}} - When the request is sent - Then the response status is 400 Bad Request - - @team:DataDog/service-catalog - Scenario: Update an existing scorecard rule returns "Not Found" response - Given operation "UpdateScorecardRule" enabled - And new "UpdateScorecardRule" request - And request contains "rule_id" parameter with value "REPLACE.ME" - And body with value {"data": {"attributes": {"enabled": true, "level": 2, "name": "Team Defined", "scorecard_name": "Deployments automated via Deployment Trains"}, "type": "rule"}} - When the request is sent - Then the response status is 404 Not Found diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 8b9940b568..7aa33aaa8e 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -4739,32 +4739,62 @@ "type": "idempotent" } }, + "ListScorecardCampaigns": { + "tag": "Scorecards", + "undo": { + "type": "safe" + } + }, + "CreateScorecardCampaign": { + "tag": "Scorecards", + "undo": { + "type": "unsafe" + } + }, + "DeleteScorecardCampaign": { + "tag": "Scorecards", + "undo": { + "type": "idempotent" + } + }, + "GetScorecardCampaign": { + "tag": "Scorecards", + "undo": { + "type": "safe" + } + }, + "UpdateScorecardCampaign": { + "tag": "Scorecards", + "undo": { + "type": "idempotent" + } + }, "ListScorecardOutcomes": { - "tag": "Service Scorecards", + "tag": "Scorecards", "undo": { "type": "safe" } }, - "UpdateScorecardOutcomesAsync": { - "tag": "Service Scorecards", + "UpdateScorecardOutcomes": { + "tag": "Scorecards", "undo": { "type": "idempotent" } }, "CreateScorecardOutcomesBatch": { - "tag": "Service Scorecards", + "tag": "Scorecards", "undo": { "type": "idempotent" } }, "ListScorecardRules": { - "tag": "Service Scorecards", + "tag": "Scorecards", "undo": { "type": "safe" } }, "CreateScorecardRule": { - "tag": "Service Scorecards", + "tag": "Scorecards", "undo": { "operationId": "DeleteScorecardRule", "parameters": [ @@ -4777,17 +4807,23 @@ } }, "DeleteScorecardRule": { - "tag": "Service Scorecards", + "tag": "Scorecards", "undo": { "type": "idempotent" } }, "UpdateScorecardRule": { - "tag": "Service Scorecards", + "tag": "Scorecards", "undo": { "type": "idempotent" } }, + "ListScorecards": { + "tag": "Scorecards", + "undo": { + "type": "safe" + } + }, "UnassignSeatsUser": { "tag": "Seats", "undo": {