diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e83df8269e5f..45c7a5c59097 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -9757,6 +9757,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: @@ -14833,6 +14937,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: @@ -15940,7 +16116,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 @@ -37365,6 +37541,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: @@ -37828,6 +38020,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: @@ -48473,6 +48678,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: @@ -54391,6 +54625,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 @@ -56896,6 +57162,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. @@ -70874,6 +71190,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: @@ -71456,7 +71846,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 @@ -102091,6 +102481,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. @@ -102119,21 +102892,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 @@ -102158,6 +102931,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 @@ -102174,17 +102966,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: @@ -102208,15 +102997,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: @@ -102230,6 +103017,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 @@ -102246,10 +103052,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: @@ -102318,6 +103125,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 @@ -102334,20 +103169,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. @@ -102356,6 +103198,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 @@ -102372,11 +103234,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. @@ -102401,10 +103260,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 @@ -102413,6 +103269,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. @@ -102421,6 +103289,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 @@ -102435,13 +103330,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: |- @@ -114676,6 +115646,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 @@ -114700,11 +115673,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/cassettes/v2/Service-Scorecards_320411317/Create-a-new-rule-returns-Bad-Request-response_4112202994/frozen.json b/cassettes/v2/Scorecards_1099427156/Create-a-new-rule-returns-Bad-Request-response_4112202994/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/Create-a-new-rule-returns-Bad-Request-response_4112202994/frozen.json rename to cassettes/v2/Scorecards_1099427156/Create-a-new-rule-returns-Bad-Request-response_4112202994/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/Create-a-new-rule-returns-Bad-Request-response_4112202994/recording.har b/cassettes/v2/Scorecards_1099427156/Create-a-new-rule-returns-Bad-Request-response_4112202994/recording.har similarity index 95% rename from cassettes/v2/Service-Scorecards_320411317/Create-a-new-rule-returns-Bad-Request-response_4112202994/recording.har rename to cassettes/v2/Scorecards_1099427156/Create-a-new-rule-returns-Bad-Request-response_4112202994/recording.har index abb864f62ce5..d9b891c7731b 100644 --- a/cassettes/v2/Service-Scorecards_320411317/Create-a-new-rule-returns-Bad-Request-response_4112202994/recording.har +++ b/cassettes/v2/Scorecards_1099427156/Create-a-new-rule-returns-Bad-Request-response_4112202994/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/Create a new rule returns \"Bad Request\" response", + "_recordingName": "Scorecards/Create a new rule returns \"Bad Request\" response", "creator": { "comment": "persister:fs", "name": "Polly.JS", diff --git a/cassettes/v2/Service-Scorecards_320411317/Create-a-new-rule-returns-Created-response_522570232/frozen.json b/cassettes/v2/Scorecards_1099427156/Create-a-new-rule-returns-Created-response_522570232/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/Create-a-new-rule-returns-Created-response_522570232/frozen.json rename to cassettes/v2/Scorecards_1099427156/Create-a-new-rule-returns-Created-response_522570232/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/Create-a-new-rule-returns-Created-response_522570232/recording.har b/cassettes/v2/Scorecards_1099427156/Create-a-new-rule-returns-Created-response_522570232/recording.har similarity index 97% rename from cassettes/v2/Service-Scorecards_320411317/Create-a-new-rule-returns-Created-response_522570232/recording.har rename to cassettes/v2/Scorecards_1099427156/Create-a-new-rule-returns-Created-response_522570232/recording.har index b1ba9596bbdb..ba186e1eab8f 100644 --- a/cassettes/v2/Service-Scorecards_320411317/Create-a-new-rule-returns-Created-response_522570232/recording.har +++ b/cassettes/v2/Scorecards_1099427156/Create-a-new-rule-returns-Created-response_522570232/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/Create a new rule returns \"Created\" response", + "_recordingName": "Scorecards/Create a new rule returns \"Created\" response", "creator": { "comment": "persister:fs", "name": "Polly.JS", diff --git a/cassettes/v2/Service-Scorecards_320411317/Create-outcomes-batch-returns-Bad-Request-response_4200540942/frozen.json b/cassettes/v2/Scorecards_1099427156/Create-outcomes-batch-returns-Bad-Request-response_4200540942/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/Create-outcomes-batch-returns-Bad-Request-response_4200540942/frozen.json rename to cassettes/v2/Scorecards_1099427156/Create-outcomes-batch-returns-Bad-Request-response_4200540942/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/Create-outcomes-batch-returns-Bad-Request-response_4200540942/recording.har b/cassettes/v2/Scorecards_1099427156/Create-outcomes-batch-returns-Bad-Request-response_4200540942/recording.har similarity index 98% rename from cassettes/v2/Service-Scorecards_320411317/Create-outcomes-batch-returns-Bad-Request-response_4200540942/recording.har rename to cassettes/v2/Scorecards_1099427156/Create-outcomes-batch-returns-Bad-Request-response_4200540942/recording.har index 6ddb8c34ba35..a46adbec889e 100644 --- a/cassettes/v2/Service-Scorecards_320411317/Create-outcomes-batch-returns-Bad-Request-response_4200540942/recording.har +++ b/cassettes/v2/Scorecards_1099427156/Create-outcomes-batch-returns-Bad-Request-response_4200540942/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/Create outcomes batch returns \"Bad Request\" response", + "_recordingName": "Scorecards/Create outcomes batch returns \"Bad Request\" response", "creator": { "comment": "persister:fs", "name": "Polly.JS", diff --git a/cassettes/v2/Service-Scorecards_320411317/Create-outcomes-batch-returns-OK-response_3991487588/frozen.json b/cassettes/v2/Scorecards_1099427156/Create-outcomes-batch-returns-OK-response_3991487588/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/Create-outcomes-batch-returns-OK-response_3991487588/frozen.json rename to cassettes/v2/Scorecards_1099427156/Create-outcomes-batch-returns-OK-response_3991487588/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/Create-outcomes-batch-returns-OK-response_3991487588/recording.har b/cassettes/v2/Scorecards_1099427156/Create-outcomes-batch-returns-OK-response_3991487588/recording.har similarity index 98% rename from cassettes/v2/Service-Scorecards_320411317/Create-outcomes-batch-returns-OK-response_3991487588/recording.har rename to cassettes/v2/Scorecards_1099427156/Create-outcomes-batch-returns-OK-response_3991487588/recording.har index 2ed5f8edd197..90625c4a44a5 100644 --- a/cassettes/v2/Service-Scorecards_320411317/Create-outcomes-batch-returns-OK-response_3991487588/recording.har +++ b/cassettes/v2/Scorecards_1099427156/Create-outcomes-batch-returns-OK-response_3991487588/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/Create outcomes batch returns \"OK\" response", + "_recordingName": "Scorecards/Create outcomes batch returns \"OK\" response", "creator": { "comment": "persister:fs", "name": "Polly.JS", diff --git a/cassettes/v2/Service-Scorecards_320411317/Delete-a-rule-returns-Not-Found-response_164235844/frozen.json b/cassettes/v2/Scorecards_1099427156/Delete-a-rule-returns-Not-Found-response_164235844/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/Delete-a-rule-returns-Not-Found-response_164235844/frozen.json rename to cassettes/v2/Scorecards_1099427156/Delete-a-rule-returns-Not-Found-response_164235844/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/Delete-a-rule-returns-Not-Found-response_164235844/recording.har b/cassettes/v2/Scorecards_1099427156/Delete-a-rule-returns-Not-Found-response_164235844/recording.har similarity index 94% rename from cassettes/v2/Service-Scorecards_320411317/Delete-a-rule-returns-Not-Found-response_164235844/recording.har rename to cassettes/v2/Scorecards_1099427156/Delete-a-rule-returns-Not-Found-response_164235844/recording.har index fe7ab8a8203d..443952125d1d 100644 --- a/cassettes/v2/Service-Scorecards_320411317/Delete-a-rule-returns-Not-Found-response_164235844/recording.har +++ b/cassettes/v2/Scorecards_1099427156/Delete-a-rule-returns-Not-Found-response_164235844/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/Delete a rule returns \"Not Found\" response", + "_recordingName": "Scorecards/Delete a rule returns \"Not Found\" response", "creator": { "comment": "persister:fs", "name": "Polly.JS", diff --git a/cassettes/v2/Service-Scorecards_320411317/Delete-a-rule-returns-OK-response_1881171271/frozen.json b/cassettes/v2/Scorecards_1099427156/Delete-a-rule-returns-OK-response_1881171271/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/Delete-a-rule-returns-OK-response_1881171271/frozen.json rename to cassettes/v2/Scorecards_1099427156/Delete-a-rule-returns-OK-response_1881171271/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/Delete-a-rule-returns-OK-response_1881171271/recording.har b/cassettes/v2/Scorecards_1099427156/Delete-a-rule-returns-OK-response_1881171271/recording.har similarity index 98% rename from cassettes/v2/Service-Scorecards_320411317/Delete-a-rule-returns-OK-response_1881171271/recording.har rename to cassettes/v2/Scorecards_1099427156/Delete-a-rule-returns-OK-response_1881171271/recording.har index 4c7ca0d12f22..4a74d3f49910 100644 --- a/cassettes/v2/Service-Scorecards_320411317/Delete-a-rule-returns-OK-response_1881171271/recording.har +++ b/cassettes/v2/Scorecards_1099427156/Delete-a-rule-returns-OK-response_1881171271/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/Delete a rule returns \"OK\" response", + "_recordingName": "Scorecards/Delete a rule returns \"OK\" response", "creator": { "comment": "persister:fs", "name": "Polly.JS", diff --git a/cassettes/v2/Service-Scorecards_320411317/Get-all-rules-returns-OK-response_1077715861/frozen.json b/cassettes/v2/Scorecards_1099427156/Get-all-rules-returns-OK-response_1077715861/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/Get-all-rules-returns-OK-response_1077715861/frozen.json rename to cassettes/v2/Scorecards_1099427156/Get-all-rules-returns-OK-response_1077715861/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/Get-all-rules-returns-OK-response_1077715861/recording.har b/cassettes/v2/Scorecards_1099427156/Get-all-rules-returns-OK-response_1077715861/recording.har similarity index 98% rename from cassettes/v2/Service-Scorecards_320411317/Get-all-rules-returns-OK-response_1077715861/recording.har rename to cassettes/v2/Scorecards_1099427156/Get-all-rules-returns-OK-response_1077715861/recording.har index a0199f5acd57..0b98c1012800 100644 --- a/cassettes/v2/Service-Scorecards_320411317/Get-all-rules-returns-OK-response_1077715861/recording.har +++ b/cassettes/v2/Scorecards_1099427156/Get-all-rules-returns-OK-response_1077715861/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/Get all rules returns \"OK\" response", + "_recordingName": "Scorecards/Get all rules returns \"OK\" response", "creator": { "comment": "persister:fs", "name": "Polly.JS", diff --git a/cassettes/v2/Service-Scorecards_320411317/List-all-rule-outcomes-returns-OK-response-with-pagination_1119793127/frozen.json b/cassettes/v2/Scorecards_1099427156/List-all-rule-outcomes-returns-OK-response-with-pagination_1119793127/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/List-all-rule-outcomes-returns-OK-response-with-pagination_1119793127/frozen.json rename to cassettes/v2/Scorecards_1099427156/List-all-rule-outcomes-returns-OK-response-with-pagination_1119793127/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/List-all-rule-outcomes-returns-OK-response-with-pagination_1119793127/recording.har b/cassettes/v2/Scorecards_1099427156/List-all-rule-outcomes-returns-OK-response-with-pagination_1119793127/recording.har similarity index 97% rename from cassettes/v2/Service-Scorecards_320411317/List-all-rule-outcomes-returns-OK-response-with-pagination_1119793127/recording.har rename to cassettes/v2/Scorecards_1099427156/List-all-rule-outcomes-returns-OK-response-with-pagination_1119793127/recording.har index 3f2bbee8f774..b8be67b4c7ab 100644 --- a/cassettes/v2/Service-Scorecards_320411317/List-all-rule-outcomes-returns-OK-response-with-pagination_1119793127/recording.har +++ b/cassettes/v2/Scorecards_1099427156/List-all-rule-outcomes-returns-OK-response-with-pagination_1119793127/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/List all rule outcomes returns \"OK\" response with pagination", + "_recordingName": "Scorecards/List all rule outcomes returns \"OK\" response with pagination", "creator": { "comment": "persister:fs", "name": "Polly.JS", diff --git a/cassettes/v2/Service-Scorecards_320411317/List-all-rule-outcomes-returns-OK-response_427126415/frozen.json b/cassettes/v2/Scorecards_1099427156/List-all-rule-outcomes-returns-OK-response_427126415/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/List-all-rule-outcomes-returns-OK-response_427126415/frozen.json rename to cassettes/v2/Scorecards_1099427156/List-all-rule-outcomes-returns-OK-response_427126415/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/List-all-rule-outcomes-returns-OK-response_427126415/recording.har b/cassettes/v2/Scorecards_1099427156/List-all-rule-outcomes-returns-OK-response_427126415/recording.har similarity index 96% rename from cassettes/v2/Service-Scorecards_320411317/List-all-rule-outcomes-returns-OK-response_427126415/recording.har rename to cassettes/v2/Scorecards_1099427156/List-all-rule-outcomes-returns-OK-response_427126415/recording.har index 17b697626491..0d51f09bfa2e 100644 --- a/cassettes/v2/Service-Scorecards_320411317/List-all-rule-outcomes-returns-OK-response_427126415/recording.har +++ b/cassettes/v2/Scorecards_1099427156/List-all-rule-outcomes-returns-OK-response_427126415/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/List all rule outcomes returns \"OK\" response", + "_recordingName": "Scorecards/List all rule outcomes returns \"OK\" response", "creator": { "comment": "persister:fs", "name": "Polly.JS", diff --git a/cassettes/v2/Service-Scorecards_320411317/List-all-rules-returns-OK-response-with-pagination_1123075563/frozen.json b/cassettes/v2/Scorecards_1099427156/List-all-rules-returns-OK-response-with-pagination_1123075563/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/List-all-rules-returns-OK-response-with-pagination_1123075563/frozen.json rename to cassettes/v2/Scorecards_1099427156/List-all-rules-returns-OK-response-with-pagination_1123075563/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/List-all-rules-returns-OK-response-with-pagination_1123075563/recording.har b/cassettes/v2/Scorecards_1099427156/List-all-rules-returns-OK-response-with-pagination_1123075563/recording.har similarity index 98% rename from cassettes/v2/Service-Scorecards_320411317/List-all-rules-returns-OK-response-with-pagination_1123075563/recording.har rename to cassettes/v2/Scorecards_1099427156/List-all-rules-returns-OK-response-with-pagination_1123075563/recording.har index 828d55576a5c..37b86b04feba 100644 --- a/cassettes/v2/Service-Scorecards_320411317/List-all-rules-returns-OK-response-with-pagination_1123075563/recording.har +++ b/cassettes/v2/Scorecards_1099427156/List-all-rules-returns-OK-response-with-pagination_1123075563/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/List all rules returns \"OK\" response with pagination", + "_recordingName": "Scorecards/List all rules returns \"OK\" response with pagination", "creator": { "comment": "persister:fs", "name": "Polly.JS", diff --git a/cassettes/v2/Service-Scorecards_320411317/List-all-rules-returns-OK-response_4242635547/frozen.json b/cassettes/v2/Scorecards_1099427156/List-all-rules-returns-OK-response_4242635547/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/List-all-rules-returns-OK-response_4242635547/frozen.json rename to cassettes/v2/Scorecards_1099427156/List-all-rules-returns-OK-response_4242635547/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/List-all-rules-returns-OK-response_4242635547/recording.har b/cassettes/v2/Scorecards_1099427156/List-all-rules-returns-OK-response_4242635547/recording.har similarity index 97% rename from cassettes/v2/Service-Scorecards_320411317/List-all-rules-returns-OK-response_4242635547/recording.har rename to cassettes/v2/Scorecards_1099427156/List-all-rules-returns-OK-response_4242635547/recording.har index 3a79316890b6..dfebcbc0b3da 100644 --- a/cassettes/v2/Service-Scorecards_320411317/List-all-rules-returns-OK-response_4242635547/recording.har +++ b/cassettes/v2/Scorecards_1099427156/List-all-rules-returns-OK-response_4242635547/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/List all rules returns \"OK\" response", + "_recordingName": "Scorecards/List all rules returns \"OK\" response", "creator": { "comment": "persister:fs", "name": "Polly.JS", diff --git a/cassettes/v2/Service-Scorecards_320411317/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response_3550004421/frozen.json b/cassettes/v2/Scorecards_1099427156/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response_3550004421/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response_3550004421/frozen.json rename to cassettes/v2/Scorecards_1099427156/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response_3550004421/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response_3550004421/recording.har b/cassettes/v2/Scorecards_1099427156/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response_3550004421/recording.har similarity index 97% rename from cassettes/v2/Service-Scorecards_320411317/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response_3550004421/recording.har rename to cassettes/v2/Scorecards_1099427156/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response_3550004421/recording.har index 6cd2d3fd2f9a..3668c7619665 100644 --- a/cassettes/v2/Service-Scorecards_320411317/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response_3550004421/recording.har +++ b/cassettes/v2/Scorecards_1099427156/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response_3550004421/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/Update Scorecard outcomes asynchronously returns \"Accepted\" response", + "_recordingName": "Scorecards/Update Scorecard outcomes asynchronously returns \"Accepted\" response", "creator": { "comment": "persister:fs", "name": "Polly.JS", diff --git a/cassettes/v2/Service-Scorecards_320411317/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response_3858316768/frozen.json b/cassettes/v2/Scorecards_1099427156/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response_3858316768/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response_3858316768/frozen.json rename to cassettes/v2/Scorecards_1099427156/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response_3858316768/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response_3858316768/recording.har b/cassettes/v2/Scorecards_1099427156/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response_3858316768/recording.har similarity index 97% rename from cassettes/v2/Service-Scorecards_320411317/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response_3858316768/recording.har rename to cassettes/v2/Scorecards_1099427156/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response_3858316768/recording.har index c3c9470d945f..5c218290bc86 100644 --- a/cassettes/v2/Service-Scorecards_320411317/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response_3858316768/recording.har +++ b/cassettes/v2/Scorecards_1099427156/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response_3858316768/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/Update Scorecard outcomes asynchronously returns \"Bad Request\" response", + "_recordingName": "Scorecards/Update Scorecard outcomes asynchronously returns \"Bad Request\" response", "creator": { "comment": "persister:fs", "name": "Polly.JS", diff --git a/cassettes/v2/Service-Scorecards_320411317/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response_2488160814/frozen.json b/cassettes/v2/Scorecards_1099427156/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response_2488160814/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response_2488160814/frozen.json rename to cassettes/v2/Scorecards_1099427156/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response_2488160814/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response_2488160814/recording.har b/cassettes/v2/Scorecards_1099427156/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response_2488160814/recording.har similarity index 94% rename from cassettes/v2/Service-Scorecards_320411317/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response_2488160814/recording.har rename to cassettes/v2/Scorecards_1099427156/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response_2488160814/recording.har index cdd06ff9b139..af1c45ec7f54 100644 --- a/cassettes/v2/Service-Scorecards_320411317/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response_2488160814/recording.har +++ b/cassettes/v2/Scorecards_1099427156/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response_2488160814/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/Update Scorecard outcomes asynchronously returns \"Conflict\" response", + "_recordingName": "Scorecards/Update Scorecard outcomes asynchronously returns \"Conflict\" response", "creator": { "comment": "persister:fs", "name": "Polly.JS", diff --git a/cassettes/v2/Service-Scorecards_320411317/Update-an-existing-rule-returns-Rule-updated-successfully-response_2113887026/frozen.json b/cassettes/v2/Scorecards_1099427156/Update-an-existing-rule-returns-Rule-updated-successfully-response_2113887026/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/Update-an-existing-rule-returns-Rule-updated-successfully-response_2113887026/frozen.json rename to cassettes/v2/Scorecards_1099427156/Update-an-existing-rule-returns-Rule-updated-successfully-response_2113887026/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/Update-an-existing-rule-returns-Rule-updated-successfully-response_2113887026/recording.har b/cassettes/v2/Scorecards_1099427156/Update-an-existing-rule-returns-Rule-updated-successfully-response_2113887026/recording.har similarity index 96% rename from cassettes/v2/Service-Scorecards_320411317/Update-an-existing-rule-returns-Rule-updated-successfully-response_2113887026/recording.har rename to cassettes/v2/Scorecards_1099427156/Update-an-existing-rule-returns-Rule-updated-successfully-response_2113887026/recording.har index 2ab38f28782b..25279da42fb6 100644 --- a/cassettes/v2/Service-Scorecards_320411317/Update-an-existing-rule-returns-Rule-updated-successfully-response_2113887026/recording.har +++ b/cassettes/v2/Scorecards_1099427156/Update-an-existing-rule-returns-Rule-updated-successfully-response_2113887026/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/Update an existing rule returns \"Rule updated successfully\" response", + "_recordingName": "Scorecards/Update an existing rule returns \"Rule updated successfully\" response", "creator": { "comment": "persister:fs", "name": "Polly.JS", @@ -61,11 +61,11 @@ "time": 118 }, { - "_id": "c173c2c3af4ee37c6f4319a3182dd04d", + "_id": "14405d8c52a73cea87ac1473d69830e0", "_order": 0, "cache": {}, "request": { - "bodySize": 229, + "bodySize": 243, "cookies": [], "headers": [ { @@ -85,7 +85,7 @@ "postData": { "mimeType": "application/json", "params": [], - "text": "{\"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\"}}}" + "text": "{\"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\"},\"type\":\"rule\"}}" }, "queryString": [], "url": "https://api.datadoghq.com/api/v2/scorecard/rules/L2uJseIxQCRLg_2z" diff --git a/cassettes/v2/Service-Scorecards_320411317/Update-an-existing-scorecard-rule-returns-Bad-Request-response_3943964706/frozen.json b/cassettes/v2/Scorecards_1099427156/Update-an-existing-scorecard-rule-returns-Bad-Request-response_3943964706/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/Update-an-existing-scorecard-rule-returns-Bad-Request-response_3943964706/frozen.json rename to cassettes/v2/Scorecards_1099427156/Update-an-existing-scorecard-rule-returns-Bad-Request-response_3943964706/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/Update-an-existing-scorecard-rule-returns-Bad-Request-response_3943964706/recording.har b/cassettes/v2/Scorecards_1099427156/Update-an-existing-scorecard-rule-returns-Bad-Request-response_3943964706/recording.har similarity index 97% rename from cassettes/v2/Service-Scorecards_320411317/Update-an-existing-scorecard-rule-returns-Bad-Request-response_3943964706/recording.har rename to cassettes/v2/Scorecards_1099427156/Update-an-existing-scorecard-rule-returns-Bad-Request-response_3943964706/recording.har index ea3f2dadc903..c3513a8bbaad 100644 --- a/cassettes/v2/Service-Scorecards_320411317/Update-an-existing-scorecard-rule-returns-Bad-Request-response_3943964706/recording.har +++ b/cassettes/v2/Scorecards_1099427156/Update-an-existing-scorecard-rule-returns-Bad-Request-response_3943964706/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/Update an existing scorecard rule returns \"Bad Request\" response", + "_recordingName": "Scorecards/Update an existing scorecard rule returns \"Bad Request\" response", "creator": { "comment": "persister:fs", "name": "Polly.JS", diff --git a/cassettes/v2/Service-Scorecards_320411317/Update-an-existing-scorecard-rule-returns-Not-Found-response_955343473/frozen.json b/cassettes/v2/Scorecards_1099427156/Update-an-existing-scorecard-rule-returns-Not-Found-response_955343473/frozen.json similarity index 100% rename from cassettes/v2/Service-Scorecards_320411317/Update-an-existing-scorecard-rule-returns-Not-Found-response_955343473/frozen.json rename to cassettes/v2/Scorecards_1099427156/Update-an-existing-scorecard-rule-returns-Not-Found-response_955343473/frozen.json diff --git a/cassettes/v2/Service-Scorecards_320411317/Update-an-existing-scorecard-rule-returns-Not-Found-response_955343473/recording.har b/cassettes/v2/Scorecards_1099427156/Update-an-existing-scorecard-rule-returns-Not-Found-response_955343473/recording.har similarity index 94% rename from cassettes/v2/Service-Scorecards_320411317/Update-an-existing-scorecard-rule-returns-Not-Found-response_955343473/recording.har rename to cassettes/v2/Scorecards_1099427156/Update-an-existing-scorecard-rule-returns-Not-Found-response_955343473/recording.har index 6e6d4ae4ae37..ff478cfc3666 100644 --- a/cassettes/v2/Service-Scorecards_320411317/Update-an-existing-scorecard-rule-returns-Not-Found-response_955343473/recording.har +++ b/cassettes/v2/Scorecards_1099427156/Update-an-existing-scorecard-rule-returns-Not-Found-response_955343473/recording.har @@ -1,6 +1,6 @@ { "log": { - "_recordingName": "Service Scorecards/Update an existing scorecard rule returns \"Not Found\" response", + "_recordingName": "Scorecards/Update an existing scorecard rule returns \"Not Found\" response", "creator": { "comment": "persister:fs", "name": "Polly.JS", diff --git a/features/v2/given.json b/features/v2/given.json index 12e386bd8f73..e4a5d8817164 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -1087,7 +1087,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/features/v2/scorecards.feature b/features/v2/scorecards.feature new file mode 100644 index 000000000000..750948d89919 --- /dev/null +++ b/features/v2/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/features/v2/service_scorecards.feature b/features/v2/service_scorecards.feature deleted file mode 100644 index 387f04cf7113..000000000000 --- a/features/v2/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/features/v2/undo.json b/features/v2/undo.json index 1f11ffb7e771..124d2e60cb49 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -4775,32 +4775,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": [ @@ -4813,17 +4843,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": { diff --git a/packages/datadog-api-client/README.md b/packages/datadog-api-client/README.md index b66c358ba359..21007088b80c 100644 --- a/packages/datadog-api-client/README.md +++ b/packages/datadog-api-client/README.md @@ -439,6 +439,7 @@ apiInstance | Rum Replay Sessions | @datadog/datadog-api-client-rum-replay-sessions | [README.md](../../services/rum-replay-sessions/README.md) | | Rum Replay Viewership | @datadog/datadog-api-client-rum-replay-viewership | [README.md](../../services/rum-replay-viewership/README.md) | | Rum Retention Filters | @datadog/datadog-api-client-rum-retention-filters | [README.md](../../services/rum-retention-filters/README.md) | +| Scorecards | @datadog/datadog-api-client-scorecards | [README.md](../../services/scorecards/README.md) | | Seats | @datadog/datadog-api-client-seats | [README.md](../../services/seats/README.md) | | Security Monitoring | @datadog/datadog-api-client-security-monitoring | [README.md](../../services/security-monitoring/README.md) | | Sensitive Data Scanner | @datadog/datadog-api-client-sensitive-data-scanner | [README.md](../../services/sensitive-data-scanner/README.md) | @@ -447,7 +448,6 @@ apiInstance | Service Definition | @datadog/datadog-api-client-service-definition | [README.md](../../services/service-definition/README.md) | | Service Level Objective Corrections | @datadog/datadog-api-client-service-level-objective-corrections | [README.md](../../services/service-level-objective-corrections/README.md) | | Service Level Objectives | @datadog/datadog-api-client-service-level-objectives | [README.md](../../services/service-level-objectives/README.md) | -| Service Scorecards | @datadog/datadog-api-client-service-scorecards | [README.md](../../services/service-scorecards/README.md) | | ServiceNow Integration | @datadog/datadog-api-client-service-now-integration | [README.md](../../services/service-now-integration/README.md) | | Slack Integration | @datadog/datadog-api-client-slack-integration | [README.md](../../services/slack-integration/README.md) | | Snapshots | @datadog/datadog-api-client-snapshots | [README.md](../../services/snapshots/README.md) | diff --git a/private/bdd_runner/src/support/scenarios_model_mapping.ts b/private/bdd_runner/src/support/scenarios_model_mapping.ts index 30e54e371363..8c157cb1d8c5 100644 --- a/private/bdd_runner/src/support/scenarios_model_mapping.ts +++ b/private/bdd_runner/src/support/scenarios_model_mapping.ts @@ -10248,7 +10248,70 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "ViewershipHistorySessionArray", }, - "ServiceScorecardsApi.V2.ListScorecardOutcomes": { + "ScorecardsApi.V2.ListScorecardCampaigns": { + pageLimit: { + type: "number", + format: "int64", + }, + pageOffset: { + type: "number", + format: "int64", + }, + filterCampaignName: { + type: "string", + format: "", + }, + filterCampaignStatus: { + type: "string", + format: "", + }, + filterCampaignOwner: { + type: "string", + format: "", + }, + operationResponseType: "ListCampaignsResponse", + }, + "ScorecardsApi.V2.CreateScorecardCampaign": { + body: { + type: "CreateCampaignRequest", + format: "", + }, + operationResponseType: "CampaignResponse", + }, + "ScorecardsApi.V2.GetScorecardCampaign": { + campaignId: { + type: "string", + format: "", + }, + include: { + type: "string", + format: "", + }, + includeMeta: { + type: "boolean", + format: "", + }, + operationResponseType: "CampaignResponse", + }, + "ScorecardsApi.V2.UpdateScorecardCampaign": { + campaignId: { + type: "string", + format: "", + }, + body: { + type: "UpdateCampaignRequest", + format: "", + }, + operationResponseType: "CampaignResponse", + }, + "ScorecardsApi.V2.DeleteScorecardCampaign": { + campaignId: { + type: "string", + format: "", + }, + operationResponseType: "{}", + }, + "ScorecardsApi.V2.ListScorecardOutcomes": { pageSize: { type: "number", format: "int64", @@ -10291,21 +10354,21 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "OutcomesResponse", }, - "ServiceScorecardsApi.V2.UpdateScorecardOutcomesAsync": { + "ScorecardsApi.V2.UpdateScorecardOutcomes": { body: { type: "UpdateOutcomesAsyncRequest", format: "", }, operationResponseType: "{}", }, - "ServiceScorecardsApi.V2.CreateScorecardOutcomesBatch": { + "ScorecardsApi.V2.CreateScorecardOutcomesBatch": { body: { type: "OutcomesBatchRequest", format: "", }, operationResponseType: "OutcomesBatchResponse", }, - "ServiceScorecardsApi.V2.ListScorecardRules": { + "ScorecardsApi.V2.ListScorecardRules": { pageSize: { type: "number", format: "int64", @@ -10348,14 +10411,14 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "ListRulesResponse", }, - "ServiceScorecardsApi.V2.CreateScorecardRule": { + "ScorecardsApi.V2.CreateScorecardRule": { body: { type: "CreateRuleRequest", format: "", }, operationResponseType: "CreateRuleResponse", }, - "ServiceScorecardsApi.V2.UpdateScorecardRule": { + "ScorecardsApi.V2.UpdateScorecardRule": { ruleId: { type: "string", format: "", @@ -10366,13 +10429,36 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "UpdateRuleResponse", }, - "ServiceScorecardsApi.V2.DeleteScorecardRule": { + "ScorecardsApi.V2.DeleteScorecardRule": { ruleId: { type: "string", format: "", }, operationResponseType: "{}", }, + "ScorecardsApi.V2.ListScorecards": { + pageOffset: { + type: "number", + format: "int64", + }, + pageSize: { + type: "number", + format: "int64", + }, + filterScorecardId: { + type: "string", + format: "", + }, + filterScorecardName: { + type: "string", + format: "", + }, + filterScorecardDescription: { + type: "string", + format: "", + }, + operationResponseType: "ListScorecardsResponse", + }, "SeatsApi.V2.GetSeatsUsers": { productCode: { type: "string", diff --git a/services/scorecards/.yarnrc.yml b/services/scorecards/.yarnrc.yml new file mode 100644 index 000000000000..3186f3f0795a --- /dev/null +++ b/services/scorecards/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/services/scorecards/README.md b/services/scorecards/README.md new file mode 100644 index 000000000000..54285236117a --- /dev/null +++ b/services/scorecards/README.md @@ -0,0 +1,36 @@ +# @datadog/datadog-api-client-scorecards + +## Description + +API to create and update scorecard rules and outcomes. See [Scorecards](https://docs.datadoghq.com/service_catalog/scorecards) for more information. + +## Navigation + +- [Installation](#installation) +- [Getting Started](#getting-started) + +## Installation + +```sh +# NPM +npm install @datadog/datadog-api-client-scorecards +# Yarn +yarn add @datadog/datadog-api-client-scorecards +``` + +## Getting Started +```ts +import { createConfiguration } from "@datadog/datadog-api-client"; +import { ScorecardsApiV2 } from "@datadog/datadog-api-client-scorecards"; +import { v2 } from "@datadog/datadog-api-client-scorecards"; + +const configuration = createConfiguration(); +const apiInstance = new ScorecardsApiV2(configuration); +const params = {/* parameters */}; + +apiInstance.listScorecardCampaigns(params).then((data) => { + console.log("API called successfully. Returned data: " + JSON.stringify(data)); +}).catch((error) => { + console.error("Error calling API: " + error); +}); +``` \ No newline at end of file diff --git a/services/scorecards/package.json b/services/scorecards/package.json new file mode 100644 index 000000000000..66368fdbf820 --- /dev/null +++ b/services/scorecards/package.json @@ -0,0 +1,43 @@ +{ + "name": "@datadog/datadog-api-client-scorecards", + "description": "", + "author": "", + "keywords": [ + "api", + "fetch", + "typescript" + ], + "license": "Apache-2.0", + "licenses": [ + { + "type": "Apache-2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + } + ], + "repository": { + "type": "git", + "url": "https://github.com/DataDog/datadog-api-client-typescript.git", + "directory": "services/scorecards" + }, + "files": [ + "dist/**/*" + ], + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "scripts": { + "prepack": "yarn workspace @datadog/datadog-api-client build && yarn build", + "build": "yarn generate-version-files && tsc", + "generate-version-files": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts" + }, + "dependencies": { + "@datadog/datadog-api-client": "^2.0.0-beta.2" + }, + "devDependencies": { + "typescript": "5.8.3" + }, + "engines": { + "node": ">=18.0.0" + }, + "version": "0.0.1", + "packageManager": "yarn@4.9.1" +} diff --git a/services/scorecards/src/index.ts b/services/scorecards/src/index.ts new file mode 100644 index 000000000000..7e5fc2824ad3 --- /dev/null +++ b/services/scorecards/src/index.ts @@ -0,0 +1,3 @@ +export * as v2 from "./v2"; + +export { ScorecardsApi as ScorecardsApiV2 } from "./v2/ScorecardsApi"; diff --git a/services/scorecards/src/v2/ScorecardsApi.ts b/services/scorecards/src/v2/ScorecardsApi.ts new file mode 100644 index 000000000000..dfff2627cbc1 --- /dev/null +++ b/services/scorecards/src/v2/ScorecardsApi.ts @@ -0,0 +1,2480 @@ +import { + ApiException, + BaseAPIRequestFactory, + BaseServerConfiguration, + buildUserAgent, + Configuration, + createConfiguration, + deserialize, + getPreferredMediaType, + HttpMethod, + isBrowser, + logger, + normalizeMediaType, + parse, + RequiredError, + RequestContext, + ResponseContext, + serialize, + ServerConfiguration, + stringify, + applySecurityAuthentication, +} from "@datadog/datadog-api-client"; + +import { TypingInfo } from "./models/TypingInfo"; +import { APIErrorResponse } from "./models/APIErrorResponse"; +import { CampaignResponse } from "./models/CampaignResponse"; +import { CreateCampaignRequest } from "./models/CreateCampaignRequest"; +import { CreateRuleRequest } from "./models/CreateRuleRequest"; +import { CreateRuleResponse } from "./models/CreateRuleResponse"; +import { JSONAPIErrorResponse } from "./models/JSONAPIErrorResponse"; +import { ListCampaignsResponse } from "./models/ListCampaignsResponse"; +import { ListRulesResponse } from "./models/ListRulesResponse"; +import { ListRulesResponseDataItem } from "./models/ListRulesResponseDataItem"; +import { ListScorecardsResponse } from "./models/ListScorecardsResponse"; +import { OutcomesBatchRequest } from "./models/OutcomesBatchRequest"; +import { OutcomesBatchResponse } from "./models/OutcomesBatchResponse"; +import { OutcomesResponse } from "./models/OutcomesResponse"; +import { OutcomesResponseDataItem } from "./models/OutcomesResponseDataItem"; +import { UpdateCampaignRequest } from "./models/UpdateCampaignRequest"; +import { UpdateOutcomesAsyncRequest } from "./models/UpdateOutcomesAsyncRequest"; +import { UpdateRuleRequest } from "./models/UpdateRuleRequest"; +import { UpdateRuleResponse } from "./models/UpdateRuleResponse"; +import { version } from "../version"; + +export class ScorecardsApiRequestFactory extends BaseAPIRequestFactory { + public userAgent: string | undefined; + + public constructor(configuration: Configuration) { + super(configuration); + if (!isBrowser) { + this.userAgent = buildUserAgent("scorecards", version); + } + } + public async createScorecardCampaign( + body: CreateCampaignRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "createScorecardCampaign"); + } + + // Path Params + const localVarPath = "/api/v2/scorecard/campaigns"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ScorecardsApi.v2.createScorecardCampaign", + ScorecardsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.POST, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "CreateCampaignRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + + public async createScorecardOutcomesBatch( + body: OutcomesBatchRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + if ( + !_config.unstableOperations[ + "ScorecardsApi.v2.createScorecardOutcomesBatch" + ] + ) { + throw new Error( + "Unstable operation 'createScorecardOutcomesBatch' is disabled. Enable it by setting `configuration.unstableOperations['ScorecardsApi.v2.createScorecardOutcomesBatch'] = true`", + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "createScorecardOutcomesBatch"); + } + + // Path Params + const localVarPath = "/api/v2/scorecard/outcomes/batch"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ScorecardsApi.v2.createScorecardOutcomesBatch", + ScorecardsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.POST, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "OutcomesBatchRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + + public async createScorecardRule( + body: CreateRuleRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "createScorecardRule"); + } + + // Path Params + const localVarPath = "/api/v2/scorecard/rules"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ScorecardsApi.v2.createScorecardRule", + ScorecardsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.POST, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "CreateRuleRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + + public async deleteScorecardCampaign( + campaignId: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'campaignId' is not null or undefined + if (campaignId === null || campaignId === undefined) { + throw new RequiredError("campaignId", "deleteScorecardCampaign"); + } + + // Path Params + const localVarPath = "/api/v2/scorecard/campaigns/{campaign_id}".replace( + "{campaign_id}", + encodeURIComponent(String(campaignId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ScorecardsApi.v2.deleteScorecardCampaign", + ScorecardsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.DELETE, + overrides, + ); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + + public async deleteScorecardRule( + ruleId: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'ruleId' is not null or undefined + if (ruleId === null || ruleId === undefined) { + throw new RequiredError("ruleId", "deleteScorecardRule"); + } + + // Path Params + const localVarPath = "/api/v2/scorecard/rules/{rule_id}".replace( + "{rule_id}", + encodeURIComponent(String(ruleId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ScorecardsApi.v2.deleteScorecardRule", + ScorecardsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.DELETE, + overrides, + ); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + + public async getScorecardCampaign( + campaignId: string, + include?: string, + includeMeta?: boolean, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'campaignId' is not null or undefined + if (campaignId === null || campaignId === undefined) { + throw new RequiredError("campaignId", "getScorecardCampaign"); + } + + // Path Params + const localVarPath = "/api/v2/scorecard/campaigns/{campaign_id}".replace( + "{campaign_id}", + encodeURIComponent(String(campaignId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ScorecardsApi.v2.getScorecardCampaign", + ScorecardsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Query Params + if (include !== undefined) { + requestContext.setQueryParam( + "include", + serialize(include, TypingInfo, "string", ""), + "", + ); + } + if (includeMeta !== undefined) { + requestContext.setQueryParam( + "include_meta", + serialize(includeMeta, TypingInfo, "boolean", ""), + "", + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + + public async listScorecardCampaigns( + pageLimit?: number, + pageOffset?: number, + filterCampaignName?: string, + filterCampaignStatus?: string, + filterCampaignOwner?: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // Path Params + const localVarPath = "/api/v2/scorecard/campaigns"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ScorecardsApi.v2.listScorecardCampaigns", + ScorecardsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Query Params + if (pageLimit !== undefined) { + requestContext.setQueryParam( + "page[limit]", + serialize(pageLimit, TypingInfo, "number", "int64"), + "", + ); + } + if (pageOffset !== undefined) { + requestContext.setQueryParam( + "page[offset]", + serialize(pageOffset, TypingInfo, "number", "int64"), + "", + ); + } + if (filterCampaignName !== undefined) { + requestContext.setQueryParam( + "filter[campaign][name]", + serialize(filterCampaignName, TypingInfo, "string", ""), + "", + ); + } + if (filterCampaignStatus !== undefined) { + requestContext.setQueryParam( + "filter[campaign][status]", + serialize(filterCampaignStatus, TypingInfo, "string", ""), + "", + ); + } + if (filterCampaignOwner !== undefined) { + requestContext.setQueryParam( + "filter[campaign][owner]", + serialize(filterCampaignOwner, TypingInfo, "string", ""), + "", + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + + public async listScorecardOutcomes( + pageSize?: number, + pageOffset?: number, + include?: string, + fieldsOutcome?: string, + fieldsRule?: string, + filterOutcomeServiceName?: string, + filterOutcomeState?: string, + filterRuleEnabled?: boolean, + filterRuleId?: string, + filterRuleName?: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // Path Params + const localVarPath = "/api/v2/scorecard/outcomes"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ScorecardsApi.v2.listScorecardOutcomes", + ScorecardsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Query Params + if (pageSize !== undefined) { + requestContext.setQueryParam( + "page[size]", + serialize(pageSize, TypingInfo, "number", "int64"), + "", + ); + } + if (pageOffset !== undefined) { + requestContext.setQueryParam( + "page[offset]", + serialize(pageOffset, TypingInfo, "number", "int64"), + "", + ); + } + if (include !== undefined) { + requestContext.setQueryParam( + "include", + serialize(include, TypingInfo, "string", ""), + "", + ); + } + if (fieldsOutcome !== undefined) { + requestContext.setQueryParam( + "fields[outcome]", + serialize(fieldsOutcome, TypingInfo, "string", ""), + "", + ); + } + if (fieldsRule !== undefined) { + requestContext.setQueryParam( + "fields[rule]", + serialize(fieldsRule, TypingInfo, "string", ""), + "", + ); + } + if (filterOutcomeServiceName !== undefined) { + requestContext.setQueryParam( + "filter[outcome][service_name]", + serialize(filterOutcomeServiceName, TypingInfo, "string", ""), + "", + ); + } + if (filterOutcomeState !== undefined) { + requestContext.setQueryParam( + "filter[outcome][state]", + serialize(filterOutcomeState, TypingInfo, "string", ""), + "", + ); + } + if (filterRuleEnabled !== undefined) { + requestContext.setQueryParam( + "filter[rule][enabled]", + serialize(filterRuleEnabled, TypingInfo, "boolean", ""), + "", + ); + } + if (filterRuleId !== undefined) { + requestContext.setQueryParam( + "filter[rule][id]", + serialize(filterRuleId, TypingInfo, "string", ""), + "", + ); + } + if (filterRuleName !== undefined) { + requestContext.setQueryParam( + "filter[rule][name]", + serialize(filterRuleName, TypingInfo, "string", ""), + "", + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + + public async listScorecardRules( + pageSize?: number, + pageOffset?: number, + include?: string, + filterRuleId?: string, + filterRuleEnabled?: boolean, + filterRuleCustom?: boolean, + filterRuleName?: string, + filterRuleDescription?: string, + fieldsRule?: string, + fieldsScorecard?: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // Path Params + const localVarPath = "/api/v2/scorecard/rules"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ScorecardsApi.v2.listScorecardRules", + ScorecardsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Query Params + if (pageSize !== undefined) { + requestContext.setQueryParam( + "page[size]", + serialize(pageSize, TypingInfo, "number", "int64"), + "", + ); + } + if (pageOffset !== undefined) { + requestContext.setQueryParam( + "page[offset]", + serialize(pageOffset, TypingInfo, "number", "int64"), + "", + ); + } + if (include !== undefined) { + requestContext.setQueryParam( + "include", + serialize(include, TypingInfo, "string", ""), + "", + ); + } + if (filterRuleId !== undefined) { + requestContext.setQueryParam( + "filter[rule][id]", + serialize(filterRuleId, TypingInfo, "string", ""), + "", + ); + } + if (filterRuleEnabled !== undefined) { + requestContext.setQueryParam( + "filter[rule][enabled]", + serialize(filterRuleEnabled, TypingInfo, "boolean", ""), + "", + ); + } + if (filterRuleCustom !== undefined) { + requestContext.setQueryParam( + "filter[rule][custom]", + serialize(filterRuleCustom, TypingInfo, "boolean", ""), + "", + ); + } + if (filterRuleName !== undefined) { + requestContext.setQueryParam( + "filter[rule][name]", + serialize(filterRuleName, TypingInfo, "string", ""), + "", + ); + } + if (filterRuleDescription !== undefined) { + requestContext.setQueryParam( + "filter[rule][description]", + serialize(filterRuleDescription, TypingInfo, "string", ""), + "", + ); + } + if (fieldsRule !== undefined) { + requestContext.setQueryParam( + "fields[rule]", + serialize(fieldsRule, TypingInfo, "string", ""), + "", + ); + } + if (fieldsScorecard !== undefined) { + requestContext.setQueryParam( + "fields[scorecard]", + serialize(fieldsScorecard, TypingInfo, "string", ""), + "", + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + + public async listScorecards( + pageOffset?: number, + pageSize?: number, + filterScorecardId?: string, + filterScorecardName?: string, + filterScorecardDescription?: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // Path Params + const localVarPath = "/api/v2/scorecard/scorecards"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ScorecardsApi.v2.listScorecards", + ScorecardsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Query Params + if (pageOffset !== undefined) { + requestContext.setQueryParam( + "page[offset]", + serialize(pageOffset, TypingInfo, "number", "int64"), + "", + ); + } + if (pageSize !== undefined) { + requestContext.setQueryParam( + "page[size]", + serialize(pageSize, TypingInfo, "number", "int64"), + "", + ); + } + if (filterScorecardId !== undefined) { + requestContext.setQueryParam( + "filter[scorecard][id]", + serialize(filterScorecardId, TypingInfo, "string", ""), + "", + ); + } + if (filterScorecardName !== undefined) { + requestContext.setQueryParam( + "filter[scorecard][name]", + serialize(filterScorecardName, TypingInfo, "string", ""), + "", + ); + } + if (filterScorecardDescription !== undefined) { + requestContext.setQueryParam( + "filter[scorecard][description]", + serialize(filterScorecardDescription, TypingInfo, "string", ""), + "", + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + + public async updateScorecardCampaign( + campaignId: string, + body: UpdateCampaignRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'campaignId' is not null or undefined + if (campaignId === null || campaignId === undefined) { + throw new RequiredError("campaignId", "updateScorecardCampaign"); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "updateScorecardCampaign"); + } + + // Path Params + const localVarPath = "/api/v2/scorecard/campaigns/{campaign_id}".replace( + "{campaign_id}", + encodeURIComponent(String(campaignId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ScorecardsApi.v2.updateScorecardCampaign", + ScorecardsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.PUT, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "UpdateCampaignRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + + public async updateScorecardOutcomes( + body: UpdateOutcomesAsyncRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "updateScorecardOutcomes"); + } + + // Path Params + const localVarPath = "/api/v2/scorecard/outcomes"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ScorecardsApi.v2.updateScorecardOutcomes", + ScorecardsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.POST, + overrides, + ); + requestContext.setHeaderParam("Accept", "*/*"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "UpdateOutcomesAsyncRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } + + public async updateScorecardRule( + ruleId: string, + body: UpdateRuleRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'ruleId' is not null or undefined + if (ruleId === null || ruleId === undefined) { + throw new RequiredError("ruleId", "updateScorecardRule"); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "updateScorecardRule"); + } + + // Path Params + const localVarPath = "/api/v2/scorecard/rules/{rule_id}".replace( + "{rule_id}", + encodeURIComponent(String(ruleId)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ScorecardsApi.v2.updateScorecardRule", + ScorecardsApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.PUT, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "UpdateRuleRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + "AuthZ", + ]); + + return requestContext; + } +} + +export class ScorecardsApiResponseProcessor { + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createScorecardCampaign + * @throws ApiException if the response code was not in [200, 299] + */ + public async createScorecardCampaign( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 201) { + const body: CampaignResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "CampaignResponse", + ) as CampaignResponse; + return body; + } + if (response.httpStatusCode === 400 || response.httpStatusCode === 403) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: CampaignResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "CampaignResponse", + "", + ) as CampaignResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createScorecardOutcomesBatch + * @throws ApiException if the response code was not in [200, 299] + */ + public async createScorecardOutcomesBatch( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: OutcomesBatchResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "OutcomesBatchResponse", + ) as OutcomesBatchResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: OutcomesBatchResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "OutcomesBatchResponse", + "", + ) as OutcomesBatchResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createScorecardRule + * @throws ApiException if the response code was not in [200, 299] + */ + public async createScorecardRule( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 201) { + const body: CreateRuleResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "CreateRuleResponse", + ) as CreateRuleResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: CreateRuleResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "CreateRuleResponse", + "", + ) as CreateRuleResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteScorecardCampaign + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteScorecardCampaign( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 204) { + return; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteScorecardRule + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteScorecardRule(response: ResponseContext): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 204) { + return; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getScorecardCampaign + * @throws ApiException if the response code was not in [200, 299] + */ + public async getScorecardCampaign( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: CampaignResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "CampaignResponse", + ) as CampaignResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: CampaignResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "CampaignResponse", + "", + ) as CampaignResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listScorecardCampaigns + * @throws ApiException if the response code was not in [200, 299] + */ + public async listScorecardCampaigns( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: ListCampaignsResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ListCampaignsResponse", + ) as ListCampaignsResponse; + return body; + } + if (response.httpStatusCode === 400 || response.httpStatusCode === 403) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ListCampaignsResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ListCampaignsResponse", + "", + ) as ListCampaignsResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listScorecardOutcomes + * @throws ApiException if the response code was not in [200, 299] + */ + public async listScorecardOutcomes( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: OutcomesResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "OutcomesResponse", + ) as OutcomesResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: OutcomesResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "OutcomesResponse", + "", + ) as OutcomesResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listScorecardRules + * @throws ApiException if the response code was not in [200, 299] + */ + public async listScorecardRules( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: ListRulesResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ListRulesResponse", + ) as ListRulesResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ListRulesResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ListRulesResponse", + "", + ) as ListRulesResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listScorecards + * @throws ApiException if the response code was not in [200, 299] + */ + public async listScorecards( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: ListScorecardsResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ListScorecardsResponse", + ) as ListScorecardsResponse; + return body; + } + if (response.httpStatusCode === 403) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ListScorecardsResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ListScorecardsResponse", + "", + ) as ListScorecardsResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to updateScorecardCampaign + * @throws ApiException if the response code was not in [200, 299] + */ + public async updateScorecardCampaign( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: CampaignResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "CampaignResponse", + ) as CampaignResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: CampaignResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "CampaignResponse", + "", + ) as CampaignResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to updateScorecardOutcomes + * @throws ApiException if the response code was not in [200, 299] + */ + public async updateScorecardOutcomes( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 202) { + return; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 409 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + return; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to updateScorecardRule + * @throws ApiException if the response code was not in [200, 299] + */ + public async updateScorecardRule( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: UpdateRuleResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "UpdateRuleResponse", + ) as UpdateRuleResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 429 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: UpdateRuleResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "UpdateRuleResponse", + "", + ) as UpdateRuleResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } +} + +export interface ScorecardsApiCreateScorecardCampaignRequest { + /** + * Campaign data. + * @type CreateCampaignRequest + */ + body: CreateCampaignRequest; +} + +export interface ScorecardsApiCreateScorecardOutcomesBatchRequest { + /** + * Set of scorecard outcomes. + * @type OutcomesBatchRequest + */ + body: OutcomesBatchRequest; +} + +export interface ScorecardsApiCreateScorecardRuleRequest { + /** + * Rule attributes. + * @type CreateRuleRequest + */ + body: CreateRuleRequest; +} + +export interface ScorecardsApiDeleteScorecardCampaignRequest { + /** + * Campaign ID or key. + * @type string + */ + campaignId: string; +} + +export interface ScorecardsApiDeleteScorecardRuleRequest { + /** + * The ID of the rule. + * @type string + */ + ruleId: string; +} + +export interface ScorecardsApiGetScorecardCampaignRequest { + /** + * Campaign ID or key. + * @type string + */ + campaignId: string; + /** + * Include related data (for example, scores). + * @type string + */ + include?: string; + /** + * Include metadata (entity and rule counts). + * @type boolean + */ + includeMeta?: boolean; +} + +export interface ScorecardsApiListScorecardCampaignsRequest { + /** + * Maximum number of campaigns to return. + * @type number + */ + pageLimit?: number; + /** + * Offset for pagination. + * @type number + */ + pageOffset?: number; + /** + * Filter campaigns by name (full-text search). + * @type string + */ + filterCampaignName?: string; + /** + * Filter campaigns by status. + * @type string + */ + filterCampaignStatus?: string; + /** + * Filter campaigns by owner UUID. + * @type string + */ + filterCampaignOwner?: string; +} + +export interface ScorecardsApiListScorecardOutcomesRequest { + /** + * Size for a given page. The maximum allowed value is 100. + * @type number + */ + pageSize?: number; + /** + * Specific offset to use as the beginning of the returned page. + * @type number + */ + pageOffset?: number; + /** + * Include related rule details in the response. + * @type string + */ + include?: string; + /** + * Return only specified values in the outcome attributes. + * @type string + */ + fieldsOutcome?: string; + /** + * Return only specified values in the included rule details. + * @type string + */ + fieldsRule?: string; + /** + * Filter outcomes on a specific service name. + * @type string + */ + filterOutcomeServiceName?: string; + /** + * Filter outcomes by a specific state. + * @type string + */ + filterOutcomeState?: string; + /** + * Filter outcomes based on whether a rule is enabled or disabled. + * @type boolean + */ + filterRuleEnabled?: boolean; + /** + * Filter outcomes based on rule ID. + * @type string + */ + filterRuleId?: string; + /** + * Filter outcomes based on rule name. + * @type string + */ + filterRuleName?: string; +} + +export interface ScorecardsApiListScorecardRulesRequest { + /** + * Size for a given page. The maximum allowed value is 100. + * @type number + */ + pageSize?: number; + /** + * Specific offset to use as the beginning of the returned page. + * @type number + */ + pageOffset?: number; + /** + * Include related scorecard details in the response. + * @type string + */ + include?: string; + /** + * Filter the rules on a rule ID. + * @type string + */ + filterRuleId?: string; + /** + * Filter for enabled rules only. + * @type boolean + */ + filterRuleEnabled?: boolean; + /** + * Filter for custom rules only. + * @type boolean + */ + filterRuleCustom?: boolean; + /** + * Filter rules on the rule name. + * @type string + */ + filterRuleName?: string; + /** + * Filter rules on the rule description. + * @type string + */ + filterRuleDescription?: string; + /** + * Return only specific fields in the response for rule attributes. + * @type string + */ + fieldsRule?: string; + /** + * Return only specific fields in the included response for scorecard attributes. + * @type string + */ + fieldsScorecard?: string; +} + +export interface ScorecardsApiListScorecardsRequest { + /** + * Offset for pagination. + * @type number + */ + pageOffset?: number; + /** + * Maximum number of scorecards to return. + * @type number + */ + pageSize?: number; + /** + * Filter by scorecard ID. + * @type string + */ + filterScorecardId?: string; + /** + * Filter by scorecard name (partial match). + * @type string + */ + filterScorecardName?: string; + /** + * Filter by scorecard description (partial match). + * @type string + */ + filterScorecardDescription?: string; +} + +export interface ScorecardsApiUpdateScorecardCampaignRequest { + /** + * Campaign ID or key. + * @type string + */ + campaignId: string; + /** + * Campaign data. + * @type UpdateCampaignRequest + */ + body: UpdateCampaignRequest; +} + +export interface ScorecardsApiUpdateScorecardOutcomesRequest { + /** + * Set of scorecard outcomes. + * @type UpdateOutcomesAsyncRequest + */ + body: UpdateOutcomesAsyncRequest; +} + +export interface ScorecardsApiUpdateScorecardRuleRequest { + /** + * The ID of the rule. + * @type string + */ + ruleId: string; + /** + * Rule attributes. + * @type UpdateRuleRequest + */ + body: UpdateRuleRequest; +} + +export class ScorecardsApi { + private requestFactory: ScorecardsApiRequestFactory; + private responseProcessor: ScorecardsApiResponseProcessor; + private configuration: Configuration; + + static operationServers: { [key: string]: BaseServerConfiguration[] } = {}; + + public constructor( + configuration?: Configuration, + requestFactory?: ScorecardsApiRequestFactory, + responseProcessor?: ScorecardsApiResponseProcessor, + ) { + this.configuration = configuration || createConfiguration(); + this.requestFactory = + requestFactory || new ScorecardsApiRequestFactory(this.configuration); + this.responseProcessor = + responseProcessor || new ScorecardsApiResponseProcessor(); + } + + /** + * Creates a new scorecard campaign. + * @param param The request object + */ + public createScorecardCampaign( + param: ScorecardsApiCreateScorecardCampaignRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.createScorecardCampaign( + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createScorecardCampaign( + responseContext, + ); + }); + }); + } + + /** + * Sets multiple service-rule outcomes in a single batched request. + * @param param The request object + */ + public createScorecardOutcomesBatch( + param: ScorecardsApiCreateScorecardOutcomesBatchRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = + this.requestFactory.createScorecardOutcomesBatch(param.body, options); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createScorecardOutcomesBatch( + responseContext, + ); + }); + }); + } + + /** + * Creates a new rule. + * @param param The request object + */ + public createScorecardRule( + param: ScorecardsApiCreateScorecardRuleRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.createScorecardRule( + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createScorecardRule(responseContext); + }); + }); + } + + /** + * Deletes a single campaign by ID or key. + * @param param The request object + */ + public deleteScorecardCampaign( + param: ScorecardsApiDeleteScorecardCampaignRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.deleteScorecardCampaign( + param.campaignId, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteScorecardCampaign( + responseContext, + ); + }); + }); + } + + /** + * Deletes a single rule. + * @param param The request object + */ + public deleteScorecardRule( + param: ScorecardsApiDeleteScorecardRuleRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.deleteScorecardRule( + param.ruleId, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteScorecardRule(responseContext); + }); + }); + } + + /** + * Fetches a single campaign by ID or key. + * @param param The request object + */ + public getScorecardCampaign( + param: ScorecardsApiGetScorecardCampaignRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.getScorecardCampaign( + param.campaignId, + param.include, + param.includeMeta, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getScorecardCampaign(responseContext); + }); + }); + } + + /** + * Fetches all scorecard campaigns. + * @param param The request object + */ + public listScorecardCampaigns( + param: ScorecardsApiListScorecardCampaignsRequest = {}, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.listScorecardCampaigns( + param.pageLimit, + param.pageOffset, + param.filterCampaignName, + param.filterCampaignStatus, + param.filterCampaignOwner, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listScorecardCampaigns(responseContext); + }); + }); + } + + /** + * Fetches all rule outcomes. + * @param param The request object + */ + public listScorecardOutcomes( + param: ScorecardsApiListScorecardOutcomesRequest = {}, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.listScorecardOutcomes( + param.pageSize, + param.pageOffset, + param.include, + param.fieldsOutcome, + param.fieldsRule, + param.filterOutcomeServiceName, + param.filterOutcomeState, + param.filterRuleEnabled, + param.filterRuleId, + param.filterRuleName, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listScorecardOutcomes(responseContext); + }); + }); + } + + /** + * Provide a paginated version of listScorecardOutcomes returning a generator with all the items. + */ + public async *listScorecardOutcomesWithPagination( + param: ScorecardsApiListScorecardOutcomesRequest = {}, + options?: Configuration, + ): AsyncGenerator { + let pageSize = 10; + if (param.pageSize !== undefined) { + pageSize = param.pageSize; + } + param.pageSize = pageSize; + while (true) { + const requestContext = await this.requestFactory.listScorecardOutcomes( + param.pageSize, + param.pageOffset, + param.include, + param.fieldsOutcome, + param.fieldsRule, + param.filterOutcomeServiceName, + param.filterOutcomeState, + param.filterRuleEnabled, + param.filterRuleId, + param.filterRuleName, + options, + ); + const responseContext = + await this.configuration.httpApi.send(requestContext); + + const response = + await this.responseProcessor.listScorecardOutcomes(responseContext); + const responseData = response.data; + if (responseData === undefined) { + break; + } + const results = responseData; + for (const item of results) { + yield item; + } + if (results.length < pageSize) { + break; + } + if (param.pageOffset === undefined) { + param.pageOffset = pageSize; + } else { + param.pageOffset = param.pageOffset + pageSize; + } + } + } + + /** + * Fetch all rules. + * @param param The request object + */ + public listScorecardRules( + param: ScorecardsApiListScorecardRulesRequest = {}, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.listScorecardRules( + param.pageSize, + param.pageOffset, + param.include, + param.filterRuleId, + param.filterRuleEnabled, + param.filterRuleCustom, + param.filterRuleName, + param.filterRuleDescription, + param.fieldsRule, + param.fieldsScorecard, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listScorecardRules(responseContext); + }); + }); + } + + /** + * Provide a paginated version of listScorecardRules returning a generator with all the items. + */ + public async *listScorecardRulesWithPagination( + param: ScorecardsApiListScorecardRulesRequest = {}, + options?: Configuration, + ): AsyncGenerator { + let pageSize = 10; + if (param.pageSize !== undefined) { + pageSize = param.pageSize; + } + param.pageSize = pageSize; + while (true) { + const requestContext = await this.requestFactory.listScorecardRules( + param.pageSize, + param.pageOffset, + param.include, + param.filterRuleId, + param.filterRuleEnabled, + param.filterRuleCustom, + param.filterRuleName, + param.filterRuleDescription, + param.fieldsRule, + param.fieldsScorecard, + options, + ); + const responseContext = + await this.configuration.httpApi.send(requestContext); + + const response = + await this.responseProcessor.listScorecardRules(responseContext); + const responseData = response.data; + if (responseData === undefined) { + break; + } + const results = responseData; + for (const item of results) { + yield item; + } + if (results.length < pageSize) { + break; + } + if (param.pageOffset === undefined) { + param.pageOffset = pageSize; + } else { + param.pageOffset = param.pageOffset + pageSize; + } + } + } + + /** + * Fetches all scorecards. + * @param param The request object + */ + public listScorecards( + param: ScorecardsApiListScorecardsRequest = {}, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.listScorecards( + param.pageOffset, + param.pageSize, + param.filterScorecardId, + param.filterScorecardName, + param.filterScorecardDescription, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listScorecards(responseContext); + }); + }); + } + + /** + * Updates an existing campaign. + * @param param The request object + */ + public updateScorecardCampaign( + param: ScorecardsApiUpdateScorecardCampaignRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.updateScorecardCampaign( + param.campaignId, + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.updateScorecardCampaign( + responseContext, + ); + }); + }); + } + + /** + * Updates multiple scorecard rule outcomes in a single batched request. + * @param param The request object + */ + public updateScorecardOutcomes( + param: ScorecardsApiUpdateScorecardOutcomesRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.updateScorecardOutcomes( + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.updateScorecardOutcomes( + responseContext, + ); + }); + }); + } + + /** + * Updates an existing rule. + * @param param The request object + */ + public updateScorecardRule( + param: ScorecardsApiUpdateScorecardRuleRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.updateScorecardRule( + param.ruleId, + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.updateScorecardRule(responseContext); + }); + }); + } +} diff --git a/services/scorecards/src/v2/index.ts b/services/scorecards/src/v2/index.ts new file mode 100644 index 000000000000..a51298e493d8 --- /dev/null +++ b/services/scorecards/src/v2/index.ts @@ -0,0 +1,79 @@ +export { + ScorecardsApiCreateScorecardCampaignRequest, + ScorecardsApiCreateScorecardOutcomesBatchRequest, + ScorecardsApiCreateScorecardRuleRequest, + ScorecardsApiDeleteScorecardCampaignRequest, + ScorecardsApiDeleteScorecardRuleRequest, + ScorecardsApiGetScorecardCampaignRequest, + ScorecardsApiListScorecardCampaignsRequest, + ScorecardsApiListScorecardOutcomesRequest, + ScorecardsApiListScorecardRulesRequest, + ScorecardsApiListScorecardsRequest, + ScorecardsApiUpdateScorecardCampaignRequest, + ScorecardsApiUpdateScorecardOutcomesRequest, + ScorecardsApiUpdateScorecardRuleRequest, + ScorecardsApi, +} from "./ScorecardsApi"; + +export { APIErrorResponse } from "./models/APIErrorResponse"; +export { CampaignResponse } from "./models/CampaignResponse"; +export { CampaignResponseAttributes } from "./models/CampaignResponseAttributes"; +export { CampaignResponseData } from "./models/CampaignResponseData"; +export { CampaignStatus } from "./models/CampaignStatus"; +export { CampaignType } from "./models/CampaignType"; +export { CreateCampaignRequest } from "./models/CreateCampaignRequest"; +export { CreateCampaignRequestAttributes } from "./models/CreateCampaignRequestAttributes"; +export { CreateCampaignRequestData } from "./models/CreateCampaignRequestData"; +export { CreateRuleRequest } from "./models/CreateRuleRequest"; +export { CreateRuleRequestData } from "./models/CreateRuleRequestData"; +export { CreateRuleResponse } from "./models/CreateRuleResponse"; +export { CreateRuleResponseData } from "./models/CreateRuleResponseData"; +export { JSONAPIErrorItem } from "./models/JSONAPIErrorItem"; +export { JSONAPIErrorItemSource } from "./models/JSONAPIErrorItemSource"; +export { JSONAPIErrorResponse } from "./models/JSONAPIErrorResponse"; +export { ListCampaignsResponse } from "./models/ListCampaignsResponse"; +export { ListRulesResponse } from "./models/ListRulesResponse"; +export { ListRulesResponseDataItem } from "./models/ListRulesResponseDataItem"; +export { ListRulesResponseLinks } from "./models/ListRulesResponseLinks"; +export { ListScorecardsResponse } from "./models/ListScorecardsResponse"; +export { OutcomesBatchAttributes } from "./models/OutcomesBatchAttributes"; +export { OutcomesBatchRequest } from "./models/OutcomesBatchRequest"; +export { OutcomesBatchRequestData } from "./models/OutcomesBatchRequestData"; +export { OutcomesBatchRequestItem } from "./models/OutcomesBatchRequestItem"; +export { OutcomesBatchResponse } from "./models/OutcomesBatchResponse"; +export { OutcomesBatchResponseAttributes } from "./models/OutcomesBatchResponseAttributes"; +export { OutcomesBatchResponseMeta } from "./models/OutcomesBatchResponseMeta"; +export { OutcomesBatchType } from "./models/OutcomesBatchType"; +export { OutcomesResponse } from "./models/OutcomesResponse"; +export { OutcomesResponseDataItem } from "./models/OutcomesResponseDataItem"; +export { OutcomesResponseIncludedItem } from "./models/OutcomesResponseIncludedItem"; +export { OutcomesResponseIncludedRuleAttributes } from "./models/OutcomesResponseIncludedRuleAttributes"; +export { OutcomesResponseLinks } from "./models/OutcomesResponseLinks"; +export { OutcomeType } from "./models/OutcomeType"; +export { PaginatedResponseMeta } from "./models/PaginatedResponseMeta"; +export { RelationshipToOutcome } from "./models/RelationshipToOutcome"; +export { RelationshipToOutcomeData } from "./models/RelationshipToOutcomeData"; +export { RelationshipToRule } from "./models/RelationshipToRule"; +export { RelationshipToRuleData } from "./models/RelationshipToRuleData"; +export { RelationshipToRuleDataObject } from "./models/RelationshipToRuleDataObject"; +export { RuleAttributes } from "./models/RuleAttributes"; +export { RuleAttributesRequest } from "./models/RuleAttributesRequest"; +export { RuleOutcomeRelationships } from "./models/RuleOutcomeRelationships"; +export { RuleType } from "./models/RuleType"; +export { ScorecardListResponseAttributes } from "./models/ScorecardListResponseAttributes"; +export { ScorecardListResponseData } from "./models/ScorecardListResponseData"; +export { ScorecardListType } from "./models/ScorecardListType"; +export { ScorecardType } from "./models/ScorecardType"; +export { State } from "./models/State"; +export { UpdateCampaignRequest } from "./models/UpdateCampaignRequest"; +export { UpdateCampaignRequestAttributes } from "./models/UpdateCampaignRequestAttributes"; +export { UpdateCampaignRequestData } from "./models/UpdateCampaignRequestData"; +export { UpdateOutcomesAsyncAttributes } from "./models/UpdateOutcomesAsyncAttributes"; +export { UpdateOutcomesAsyncRequest } from "./models/UpdateOutcomesAsyncRequest"; +export { UpdateOutcomesAsyncRequestData } from "./models/UpdateOutcomesAsyncRequestData"; +export { UpdateOutcomesAsyncRequestItem } from "./models/UpdateOutcomesAsyncRequestItem"; +export { UpdateOutcomesAsyncType } from "./models/UpdateOutcomesAsyncType"; +export { UpdateRuleRequest } from "./models/UpdateRuleRequest"; +export { UpdateRuleRequestData } from "./models/UpdateRuleRequestData"; +export { UpdateRuleResponse } from "./models/UpdateRuleResponse"; +export { UpdateRuleResponseData } from "./models/UpdateRuleResponseData"; diff --git a/services/scorecards/src/v2/models/APIErrorResponse.ts b/services/scorecards/src/v2/models/APIErrorResponse.ts new file mode 100644 index 000000000000..58d6c35b80f0 --- /dev/null +++ b/services/scorecards/src/v2/models/APIErrorResponse.ts @@ -0,0 +1,45 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * API error response. + */ +export class APIErrorResponse { + /** + * A list of errors. + */ + "errors": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + errors: { + baseName: "errors", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return APIErrorResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/CampaignResponse.ts b/services/scorecards/src/v2/models/CampaignResponse.ts new file mode 100644 index 000000000000..c6f660b526df --- /dev/null +++ b/services/scorecards/src/v2/models/CampaignResponse.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { CampaignResponseData } from "./CampaignResponseData"; + +/** + * Response containing campaign data. + */ +export class CampaignResponse { + /** + * Campaign data. + */ + "data": CampaignResponseData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "CampaignResponseData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CampaignResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/CampaignResponseAttributes.ts b/services/scorecards/src/v2/models/CampaignResponseAttributes.ts new file mode 100644 index 000000000000..dc9bbf51e546 --- /dev/null +++ b/services/scorecards/src/v2/models/CampaignResponseAttributes.ts @@ -0,0 +1,135 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Campaign attributes. + */ +export class CampaignResponseAttributes { + /** + * Creation time of the campaign. + */ + "createdAt": Date; + /** + * The description of the campaign. + */ + "description"?: string; + /** + * The due date of the campaign. + */ + "dueDate"?: Date; + /** + * Entity scope query to filter entities for this campaign. + */ + "entityScope"?: string; + /** + * Guidance for the campaign. + */ + "guidance"?: string; + /** + * The unique key for the campaign. + */ + "key": string; + /** + * Time of last campaign modification. + */ + "modifiedAt": Date; + /** + * The name of the campaign. + */ + "name": string; + /** + * The UUID of the campaign owner. + */ + "owner": string; + /** + * The start date of the campaign. + */ + "startDate": Date; + /** + * The status of the campaign. + */ + "status": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + createdAt: { + baseName: "created_at", + type: "Date", + required: true, + format: "date-time", + }, + description: { + baseName: "description", + type: "string", + }, + dueDate: { + baseName: "due_date", + type: "Date", + format: "date-time", + }, + entityScope: { + baseName: "entity_scope", + type: "string", + }, + guidance: { + baseName: "guidance", + type: "string", + }, + key: { + baseName: "key", + type: "string", + required: true, + }, + modifiedAt: { + baseName: "modified_at", + type: "Date", + required: true, + format: "date-time", + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + owner: { + baseName: "owner", + type: "string", + required: true, + }, + startDate: { + baseName: "start_date", + type: "Date", + required: true, + format: "date-time", + }, + status: { + baseName: "status", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CampaignResponseAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/CampaignResponseData.ts b/services/scorecards/src/v2/models/CampaignResponseData.ts new file mode 100644 index 000000000000..78c654bb215e --- /dev/null +++ b/services/scorecards/src/v2/models/CampaignResponseData.ts @@ -0,0 +1,66 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { CampaignResponseAttributes } from "./CampaignResponseAttributes"; +import { CampaignType } from "./CampaignType"; + +/** + * Campaign data. + */ +export class CampaignResponseData { + /** + * Campaign attributes. + */ + "attributes": CampaignResponseAttributes; + /** + * The unique ID of the campaign. + */ + "id": string; + /** + * The JSON:API type for campaigns. + */ + "type": CampaignType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "CampaignResponseAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "CampaignType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CampaignResponseData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/CampaignStatus.ts b/services/scorecards/src/v2/models/CampaignStatus.ts new file mode 100644 index 000000000000..71afea2fd53e --- /dev/null +++ b/services/scorecards/src/v2/models/CampaignStatus.ts @@ -0,0 +1,13 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The status of the campaign. + */ +export type CampaignStatus = + | typeof IN_PROGRESS + | typeof NOT_STARTED + | typeof COMPLETED + | UnparsedObject; +export const IN_PROGRESS = "in_progress"; +export const NOT_STARTED = "not_started"; +export const COMPLETED = "completed"; diff --git a/services/scorecards/src/v2/models/CampaignType.ts b/services/scorecards/src/v2/models/CampaignType.ts new file mode 100644 index 000000000000..fc963f83ca20 --- /dev/null +++ b/services/scorecards/src/v2/models/CampaignType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The JSON:API type for campaigns. + */ +export type CampaignType = typeof CAMPAIGN | UnparsedObject; +export const CAMPAIGN = "campaign"; diff --git a/services/scorecards/src/v2/models/CreateCampaignRequest.ts b/services/scorecards/src/v2/models/CreateCampaignRequest.ts new file mode 100644 index 000000000000..ead4bab7973c --- /dev/null +++ b/services/scorecards/src/v2/models/CreateCampaignRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { CreateCampaignRequestData } from "./CreateCampaignRequestData"; + +/** + * Request to create a new campaign. + */ +export class CreateCampaignRequest { + /** + * Data for creating a new campaign. + */ + "data": CreateCampaignRequestData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "CreateCampaignRequestData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateCampaignRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/CreateCampaignRequestAttributes.ts b/services/scorecards/src/v2/models/CreateCampaignRequestAttributes.ts new file mode 100644 index 000000000000..fb6a4a08ee23 --- /dev/null +++ b/services/scorecards/src/v2/models/CreateCampaignRequestAttributes.ts @@ -0,0 +1,125 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { CampaignStatus } from "./CampaignStatus"; + +/** + * Attributes for creating a new campaign. + */ +export class CreateCampaignRequestAttributes { + /** + * The description of the campaign. + */ + "description"?: string; + /** + * The due date of the campaign. + */ + "dueDate"?: Date; + /** + * Entity scope query to filter entities for this campaign. + */ + "entityScope"?: string; + /** + * Guidance for the campaign. + */ + "guidance"?: string; + /** + * The unique key for the campaign. + */ + "key": string; + /** + * The name of the campaign. + */ + "name": string; + /** + * The UUID of the campaign owner. + */ + "ownerId": string; + /** + * Array of rule IDs associated with this campaign. + */ + "ruleIds": Array; + /** + * The start date of the campaign. + */ + "startDate": Date; + /** + * The status of the campaign. + */ + "status"?: CampaignStatus; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + description: { + baseName: "description", + type: "string", + }, + dueDate: { + baseName: "due_date", + type: "Date", + format: "date-time", + }, + entityScope: { + baseName: "entity_scope", + type: "string", + }, + guidance: { + baseName: "guidance", + type: "string", + }, + key: { + baseName: "key", + type: "string", + required: true, + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + ownerId: { + baseName: "owner_id", + type: "string", + required: true, + }, + ruleIds: { + baseName: "rule_ids", + type: "Array", + required: true, + }, + startDate: { + baseName: "start_date", + type: "Date", + required: true, + format: "date-time", + }, + status: { + baseName: "status", + type: "CampaignStatus", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateCampaignRequestAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/CreateCampaignRequestData.ts b/services/scorecards/src/v2/models/CreateCampaignRequestData.ts new file mode 100644 index 000000000000..6ea105b9d551 --- /dev/null +++ b/services/scorecards/src/v2/models/CreateCampaignRequestData.ts @@ -0,0 +1,57 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { CampaignType } from "./CampaignType"; +import { CreateCampaignRequestAttributes } from "./CreateCampaignRequestAttributes"; + +/** + * Data for creating a new campaign. + */ +export class CreateCampaignRequestData { + /** + * Attributes for creating a new campaign. + */ + "attributes": CreateCampaignRequestAttributes; + /** + * The JSON:API type for campaigns. + */ + "type": CampaignType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "CreateCampaignRequestAttributes", + required: true, + }, + type: { + baseName: "type", + type: "CampaignType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateCampaignRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/CreateRuleRequest.ts b/services/scorecards/src/v2/models/CreateRuleRequest.ts new file mode 100644 index 000000000000..6656e1c6cb24 --- /dev/null +++ b/services/scorecards/src/v2/models/CreateRuleRequest.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { CreateRuleRequestData } from "./CreateRuleRequestData"; + +/** + * Scorecard create rule request. + */ +export class CreateRuleRequest { + /** + * Scorecard create rule request data. + */ + "data"?: CreateRuleRequestData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "CreateRuleRequestData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateRuleRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/CreateRuleRequestData.ts b/services/scorecards/src/v2/models/CreateRuleRequestData.ts new file mode 100644 index 000000000000..7b90ce25c9de --- /dev/null +++ b/services/scorecards/src/v2/models/CreateRuleRequestData.ts @@ -0,0 +1,55 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RuleAttributesRequest } from "./RuleAttributesRequest"; +import { RuleType } from "./RuleType"; + +/** + * Scorecard create rule request data. + */ +export class CreateRuleRequestData { + /** + * Attributes for creating or updating a rule. Server-managed fields (created_at, modified_at, custom) are excluded. + */ + "attributes"?: RuleAttributesRequest; + /** + * The JSON:API type for scorecard rules. + */ + "type"?: RuleType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "RuleAttributesRequest", + }, + type: { + baseName: "type", + type: "RuleType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateRuleRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/CreateRuleResponse.ts b/services/scorecards/src/v2/models/CreateRuleResponse.ts new file mode 100644 index 000000000000..afce4fbccb37 --- /dev/null +++ b/services/scorecards/src/v2/models/CreateRuleResponse.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { CreateRuleResponseData } from "./CreateRuleResponseData"; + +/** + * Created rule in response. + */ +export class CreateRuleResponse { + /** + * Create rule response data. + */ + "data"?: CreateRuleResponseData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "CreateRuleResponseData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateRuleResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/CreateRuleResponseData.ts b/services/scorecards/src/v2/models/CreateRuleResponseData.ts new file mode 100644 index 000000000000..568ba918956c --- /dev/null +++ b/services/scorecards/src/v2/models/CreateRuleResponseData.ts @@ -0,0 +1,72 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RelationshipToRule } from "./RelationshipToRule"; +import { RuleAttributes } from "./RuleAttributes"; +import { RuleType } from "./RuleType"; + +/** + * Create rule response data. + */ +export class CreateRuleResponseData { + /** + * Details of a rule. + */ + "attributes"?: RuleAttributes; + /** + * The unique ID for a scorecard rule. + */ + "id"?: string; + /** + * Scorecard create rule response relationship. + */ + "relationships"?: RelationshipToRule; + /** + * The JSON:API type for scorecard rules. + */ + "type"?: RuleType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "RuleAttributes", + }, + id: { + baseName: "id", + type: "string", + }, + relationships: { + baseName: "relationships", + type: "RelationshipToRule", + }, + type: { + baseName: "type", + type: "RuleType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateRuleResponseData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/JSONAPIErrorItem.ts b/services/scorecards/src/v2/models/JSONAPIErrorItem.ts new file mode 100644 index 000000000000..a1ca45cd463c --- /dev/null +++ b/services/scorecards/src/v2/models/JSONAPIErrorItem.ts @@ -0,0 +1,78 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { JSONAPIErrorItemSource } from "./JSONAPIErrorItemSource"; + +/** + * API error response body + */ +export class JSONAPIErrorItem { + /** + * A human-readable explanation specific to this occurrence of the error. + */ + "detail"?: string; + /** + * Non-standard meta-information about the error + */ + "meta"?: { [key: string]: any }; + /** + * References to the source of the error. + */ + "source"?: JSONAPIErrorItemSource; + /** + * Status code of the response. + */ + "status"?: string; + /** + * Short human-readable summary of the error. + */ + "title"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + detail: { + baseName: "detail", + type: "string", + }, + meta: { + baseName: "meta", + type: "{ [key: string]: any; }", + }, + source: { + baseName: "source", + type: "JSONAPIErrorItemSource", + }, + status: { + baseName: "status", + type: "string", + }, + title: { + baseName: "title", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return JSONAPIErrorItem.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/JSONAPIErrorItemSource.ts b/services/scorecards/src/v2/models/JSONAPIErrorItemSource.ts new file mode 100644 index 000000000000..5889114315fa --- /dev/null +++ b/services/scorecards/src/v2/models/JSONAPIErrorItemSource.ts @@ -0,0 +1,60 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * References to the source of the error. + */ +export class JSONAPIErrorItemSource { + /** + * A string indicating the name of a single request header which caused the error. + */ + "header"?: string; + /** + * A string indicating which URI query parameter caused the error. + */ + "parameter"?: string; + /** + * A JSON pointer to the value in the request document that caused the error. + */ + "pointer"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + header: { + baseName: "header", + type: "string", + }, + parameter: { + baseName: "parameter", + type: "string", + }, + pointer: { + baseName: "pointer", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return JSONAPIErrorItemSource.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/JSONAPIErrorResponse.ts b/services/scorecards/src/v2/models/JSONAPIErrorResponse.ts new file mode 100644 index 000000000000..68aa04ffc27b --- /dev/null +++ b/services/scorecards/src/v2/models/JSONAPIErrorResponse.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { JSONAPIErrorItem } from "./JSONAPIErrorItem"; + +/** + * API error response. + */ +export class JSONAPIErrorResponse { + /** + * A list of errors. + */ + "errors": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + errors: { + baseName: "errors", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return JSONAPIErrorResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/ListCampaignsResponse.ts b/services/scorecards/src/v2/models/ListCampaignsResponse.ts new file mode 100644 index 000000000000..4db691feee9a --- /dev/null +++ b/services/scorecards/src/v2/models/ListCampaignsResponse.ts @@ -0,0 +1,57 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { CampaignResponseData } from "./CampaignResponseData"; +import { PaginatedResponseMeta } from "./PaginatedResponseMeta"; + +/** + * Response containing a list of campaigns. + */ +export class ListCampaignsResponse { + /** + * Array of campaigns. + */ + "data": Array; + /** + * Metadata for scores response. + */ + "meta": PaginatedResponseMeta; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + required: true, + }, + meta: { + baseName: "meta", + type: "PaginatedResponseMeta", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ListCampaignsResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/ListRulesResponse.ts b/services/scorecards/src/v2/models/ListRulesResponse.ts new file mode 100644 index 000000000000..59073ce29cd5 --- /dev/null +++ b/services/scorecards/src/v2/models/ListRulesResponse.ts @@ -0,0 +1,55 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ListRulesResponseDataItem } from "./ListRulesResponseDataItem"; +import { ListRulesResponseLinks } from "./ListRulesResponseLinks"; + +/** + * Scorecard rules response. + */ +export class ListRulesResponse { + /** + * Array of rule details. + */ + "data"?: Array; + /** + * Links attributes. + */ + "links"?: ListRulesResponseLinks; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + }, + links: { + baseName: "links", + type: "ListRulesResponseLinks", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ListRulesResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/ListRulesResponseDataItem.ts b/services/scorecards/src/v2/models/ListRulesResponseDataItem.ts new file mode 100644 index 000000000000..4dbab1006164 --- /dev/null +++ b/services/scorecards/src/v2/models/ListRulesResponseDataItem.ts @@ -0,0 +1,72 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RelationshipToRule } from "./RelationshipToRule"; +import { RuleAttributes } from "./RuleAttributes"; +import { RuleType } from "./RuleType"; + +/** + * Rule details. + */ +export class ListRulesResponseDataItem { + /** + * Details of a rule. + */ + "attributes"?: RuleAttributes; + /** + * The unique ID for a scorecard rule. + */ + "id"?: string; + /** + * Scorecard create rule response relationship. + */ + "relationships"?: RelationshipToRule; + /** + * The JSON:API type for scorecard rules. + */ + "type"?: RuleType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "RuleAttributes", + }, + id: { + baseName: "id", + type: "string", + }, + relationships: { + baseName: "relationships", + type: "RelationshipToRule", + }, + type: { + baseName: "type", + type: "RuleType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ListRulesResponseDataItem.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/ListRulesResponseLinks.ts b/services/scorecards/src/v2/models/ListRulesResponseLinks.ts new file mode 100644 index 000000000000..292d28e8a4b6 --- /dev/null +++ b/services/scorecards/src/v2/models/ListRulesResponseLinks.ts @@ -0,0 +1,44 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Links attributes. + */ +export class ListRulesResponseLinks { + /** + * Link for the next set of rules. + */ + "next"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + next: { + baseName: "next", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ListRulesResponseLinks.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/ListScorecardsResponse.ts b/services/scorecards/src/v2/models/ListScorecardsResponse.ts new file mode 100644 index 000000000000..3e119ee82cc8 --- /dev/null +++ b/services/scorecards/src/v2/models/ListScorecardsResponse.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ScorecardListResponseData } from "./ScorecardListResponseData"; + +/** + * Response containing a list of scorecards. + */ +export class ListScorecardsResponse { + /** + * Array of scorecards. + */ + "data": Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ListScorecardsResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/OutcomeType.ts b/services/scorecards/src/v2/models/OutcomeType.ts new file mode 100644 index 000000000000..45e78aac8a99 --- /dev/null +++ b/services/scorecards/src/v2/models/OutcomeType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The JSON:API type for an outcome. + */ +export type OutcomeType = typeof OUTCOME | UnparsedObject; +export const OUTCOME = "outcome"; diff --git a/services/scorecards/src/v2/models/OutcomesBatchAttributes.ts b/services/scorecards/src/v2/models/OutcomesBatchAttributes.ts new file mode 100644 index 000000000000..6da068f31267 --- /dev/null +++ b/services/scorecards/src/v2/models/OutcomesBatchAttributes.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OutcomesBatchRequestItem } from "./OutcomesBatchRequestItem"; + +/** + * The JSON:API attributes for a batched set of scorecard outcomes. + */ +export class OutcomesBatchAttributes { + /** + * Set of scorecard outcomes to update. + */ + "results"?: Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + results: { + baseName: "results", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OutcomesBatchAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/OutcomesBatchRequest.ts b/services/scorecards/src/v2/models/OutcomesBatchRequest.ts new file mode 100644 index 000000000000..500fb1da73b3 --- /dev/null +++ b/services/scorecards/src/v2/models/OutcomesBatchRequest.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OutcomesBatchRequestData } from "./OutcomesBatchRequestData"; + +/** + * Scorecard outcomes batch request. + */ +export class OutcomesBatchRequest { + /** + * Scorecard outcomes batch request data. + */ + "data"?: OutcomesBatchRequestData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "OutcomesBatchRequestData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OutcomesBatchRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/OutcomesBatchRequestData.ts b/services/scorecards/src/v2/models/OutcomesBatchRequestData.ts new file mode 100644 index 000000000000..9ebe9f9c566e --- /dev/null +++ b/services/scorecards/src/v2/models/OutcomesBatchRequestData.ts @@ -0,0 +1,55 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OutcomesBatchAttributes } from "./OutcomesBatchAttributes"; +import { OutcomesBatchType } from "./OutcomesBatchType"; + +/** + * Scorecard outcomes batch request data. + */ +export class OutcomesBatchRequestData { + /** + * The JSON:API attributes for a batched set of scorecard outcomes. + */ + "attributes"?: OutcomesBatchAttributes; + /** + * The JSON:API type for scorecard outcomes. + */ + "type"?: OutcomesBatchType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "OutcomesBatchAttributes", + }, + type: { + baseName: "type", + type: "OutcomesBatchType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OutcomesBatchRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/OutcomesBatchRequestItem.ts b/services/scorecards/src/v2/models/OutcomesBatchRequestItem.ts new file mode 100644 index 000000000000..4481ae01660e --- /dev/null +++ b/services/scorecards/src/v2/models/OutcomesBatchRequestItem.ts @@ -0,0 +1,73 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { State } from "./State"; + +/** + * Scorecard outcome for a specific rule, for a given service within a batched update. + */ +export class OutcomesBatchRequestItem { + /** + * Any remarks regarding the scorecard rule's evaluation, and supports HTML hyperlinks. + */ + "remarks"?: string; + /** + * The unique ID for a scorecard rule. + */ + "ruleId": string; + /** + * The unique name for a service in the catalog. + */ + "serviceName": string; + /** + * The state of the rule evaluation. + */ + "state": State; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + remarks: { + baseName: "remarks", + type: "string", + }, + ruleId: { + baseName: "rule_id", + type: "string", + required: true, + }, + serviceName: { + baseName: "service_name", + type: "string", + required: true, + }, + state: { + baseName: "state", + type: "State", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OutcomesBatchRequestItem.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/OutcomesBatchResponse.ts b/services/scorecards/src/v2/models/OutcomesBatchResponse.ts new file mode 100644 index 000000000000..9ef56357e878 --- /dev/null +++ b/services/scorecards/src/v2/models/OutcomesBatchResponse.ts @@ -0,0 +1,57 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OutcomesBatchResponseMeta } from "./OutcomesBatchResponseMeta"; +import { OutcomesResponseDataItem } from "./OutcomesResponseDataItem"; + +/** + * Scorecard outcomes batch response. + */ +export class OutcomesBatchResponse { + /** + * List of rule outcomes which were affected during the bulk operation. + */ + "data": Array; + /** + * Metadata pertaining to the bulk operation. + */ + "meta": OutcomesBatchResponseMeta; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + required: true, + }, + meta: { + baseName: "meta", + type: "OutcomesBatchResponseMeta", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OutcomesBatchResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/OutcomesBatchResponseAttributes.ts b/services/scorecards/src/v2/models/OutcomesBatchResponseAttributes.ts new file mode 100644 index 000000000000..4df940eb7a79 --- /dev/null +++ b/services/scorecards/src/v2/models/OutcomesBatchResponseAttributes.ts @@ -0,0 +1,80 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { State } from "./State"; + +/** + * The JSON:API attributes for an outcome. + */ +export class OutcomesBatchResponseAttributes { + /** + * Creation time of the rule outcome. + */ + "createdAt"?: Date; + /** + * Time of last rule outcome modification. + */ + "modifiedAt"?: Date; + /** + * Any remarks regarding the scorecard rule's evaluation, and supports HTML hyperlinks. + */ + "remarks"?: string; + /** + * The unique name for a service in the catalog. + */ + "serviceName"?: string; + /** + * The state of the rule evaluation. + */ + "state"?: State; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + createdAt: { + baseName: "created_at", + type: "Date", + format: "date-time", + }, + modifiedAt: { + baseName: "modified_at", + type: "Date", + format: "date-time", + }, + remarks: { + baseName: "remarks", + type: "string", + }, + serviceName: { + baseName: "service_name", + type: "string", + }, + state: { + baseName: "state", + type: "State", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OutcomesBatchResponseAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/OutcomesBatchResponseMeta.ts b/services/scorecards/src/v2/models/OutcomesBatchResponseMeta.ts new file mode 100644 index 000000000000..c7cd60c15e8e --- /dev/null +++ b/services/scorecards/src/v2/models/OutcomesBatchResponseMeta.ts @@ -0,0 +1,54 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Metadata pertaining to the bulk operation. + */ +export class OutcomesBatchResponseMeta { + /** + * Total number of scorecard results received during the bulk operation. + */ + "totalReceived"?: number; + /** + * Total number of scorecard results modified during the bulk operation. + */ + "totalUpdated"?: number; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + totalReceived: { + baseName: "total_received", + type: "number", + format: "int64", + }, + totalUpdated: { + baseName: "total_updated", + type: "number", + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OutcomesBatchResponseMeta.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/OutcomesBatchType.ts b/services/scorecards/src/v2/models/OutcomesBatchType.ts new file mode 100644 index 000000000000..a86a8935c1e2 --- /dev/null +++ b/services/scorecards/src/v2/models/OutcomesBatchType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The JSON:API type for scorecard outcomes. + */ +export type OutcomesBatchType = typeof BATCHED_OUTCOME | UnparsedObject; +export const BATCHED_OUTCOME = "batched-outcome"; diff --git a/services/scorecards/src/v2/models/OutcomesResponse.ts b/services/scorecards/src/v2/models/OutcomesResponse.ts new file mode 100644 index 000000000000..b3ca23d17e52 --- /dev/null +++ b/services/scorecards/src/v2/models/OutcomesResponse.ts @@ -0,0 +1,64 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OutcomesResponseDataItem } from "./OutcomesResponseDataItem"; +import { OutcomesResponseIncludedItem } from "./OutcomesResponseIncludedItem"; +import { OutcomesResponseLinks } from "./OutcomesResponseLinks"; + +/** + * Scorecard outcomes - the result of a rule for a service. + */ +export class OutcomesResponse { + /** + * List of rule outcomes. + */ + "data"?: Array; + /** + * Array of rule details. + */ + "included"?: Array; + /** + * Links attributes. + */ + "links"?: OutcomesResponseLinks; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + }, + included: { + baseName: "included", + type: "Array", + }, + links: { + baseName: "links", + type: "OutcomesResponseLinks", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OutcomesResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/OutcomesResponseDataItem.ts b/services/scorecards/src/v2/models/OutcomesResponseDataItem.ts new file mode 100644 index 000000000000..8f86309b5f60 --- /dev/null +++ b/services/scorecards/src/v2/models/OutcomesResponseDataItem.ts @@ -0,0 +1,72 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OutcomesBatchResponseAttributes } from "./OutcomesBatchResponseAttributes"; +import { OutcomeType } from "./OutcomeType"; +import { RuleOutcomeRelationships } from "./RuleOutcomeRelationships"; + +/** + * A single rule outcome. + */ +export class OutcomesResponseDataItem { + /** + * The JSON:API attributes for an outcome. + */ + "attributes"?: OutcomesBatchResponseAttributes; + /** + * The unique ID for a rule outcome. + */ + "id"?: string; + /** + * The JSON:API relationship to a scorecard rule. + */ + "relationships"?: RuleOutcomeRelationships; + /** + * The JSON:API type for an outcome. + */ + "type"?: OutcomeType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "OutcomesBatchResponseAttributes", + }, + id: { + baseName: "id", + type: "string", + }, + relationships: { + baseName: "relationships", + type: "RuleOutcomeRelationships", + }, + type: { + baseName: "type", + type: "OutcomeType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OutcomesResponseDataItem.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/OutcomesResponseIncludedItem.ts b/services/scorecards/src/v2/models/OutcomesResponseIncludedItem.ts new file mode 100644 index 000000000000..6e628e008c51 --- /dev/null +++ b/services/scorecards/src/v2/models/OutcomesResponseIncludedItem.ts @@ -0,0 +1,63 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { OutcomesResponseIncludedRuleAttributes } from "./OutcomesResponseIncludedRuleAttributes"; +import { RuleType } from "./RuleType"; + +/** + * Attributes of the included rule. + */ +export class OutcomesResponseIncludedItem { + /** + * Details of a rule. + */ + "attributes"?: OutcomesResponseIncludedRuleAttributes; + /** + * The unique ID for a scorecard rule. + */ + "id"?: string; + /** + * The JSON:API type for scorecard rules. + */ + "type"?: RuleType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "OutcomesResponseIncludedRuleAttributes", + }, + id: { + baseName: "id", + type: "string", + }, + type: { + baseName: "type", + type: "RuleType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OutcomesResponseIncludedItem.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/OutcomesResponseIncludedRuleAttributes.ts b/services/scorecards/src/v2/models/OutcomesResponseIncludedRuleAttributes.ts new file mode 100644 index 000000000000..ad110becadf3 --- /dev/null +++ b/services/scorecards/src/v2/models/OutcomesResponseIncludedRuleAttributes.ts @@ -0,0 +1,52 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Details of a rule. + */ +export class OutcomesResponseIncludedRuleAttributes { + /** + * Name of the rule. + */ + "name"?: string; + /** + * The scorecard name to which this rule must belong. + */ + "scorecardName"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + name: { + baseName: "name", + type: "string", + }, + scorecardName: { + baseName: "scorecard_name", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OutcomesResponseIncludedRuleAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/OutcomesResponseLinks.ts b/services/scorecards/src/v2/models/OutcomesResponseLinks.ts new file mode 100644 index 000000000000..3bceb7e88bb7 --- /dev/null +++ b/services/scorecards/src/v2/models/OutcomesResponseLinks.ts @@ -0,0 +1,44 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Links attributes. + */ +export class OutcomesResponseLinks { + /** + * Link for the next set of results. + */ + "next"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + next: { + baseName: "next", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OutcomesResponseLinks.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/PaginatedResponseMeta.ts b/services/scorecards/src/v2/models/PaginatedResponseMeta.ts new file mode 100644 index 000000000000..06e730d9c207 --- /dev/null +++ b/services/scorecards/src/v2/models/PaginatedResponseMeta.ts @@ -0,0 +1,76 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Metadata for scores response. + */ +export class PaginatedResponseMeta { + /** + * Number of entities in this response. + */ + "count": number; + /** + * Pagination limit. + */ + "limit": number; + /** + * Pagination offset. + */ + "offset": number; + /** + * Total number of entities available. + */ + "total": number; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + count: { + baseName: "count", + type: "number", + required: true, + format: "int64", + }, + limit: { + baseName: "limit", + type: "number", + required: true, + format: "int64", + }, + offset: { + baseName: "offset", + type: "number", + required: true, + format: "int64", + }, + total: { + baseName: "total", + type: "number", + required: true, + format: "int64", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return PaginatedResponseMeta.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/RelationshipToOutcome.ts b/services/scorecards/src/v2/models/RelationshipToOutcome.ts new file mode 100644 index 000000000000..328a62beafff --- /dev/null +++ b/services/scorecards/src/v2/models/RelationshipToOutcome.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RelationshipToOutcomeData } from "./RelationshipToOutcomeData"; + +/** + * The JSON:API relationship to a scorecard outcome. + */ +export class RelationshipToOutcome { + /** + * The JSON:API relationship to an outcome, which returns the related rule id. + */ + "data"?: RelationshipToOutcomeData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "RelationshipToOutcomeData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RelationshipToOutcome.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/RelationshipToOutcomeData.ts b/services/scorecards/src/v2/models/RelationshipToOutcomeData.ts new file mode 100644 index 000000000000..5b57a70958be --- /dev/null +++ b/services/scorecards/src/v2/models/RelationshipToOutcomeData.ts @@ -0,0 +1,54 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RuleType } from "./RuleType"; + +/** + * The JSON:API relationship to an outcome, which returns the related rule id. + */ +export class RelationshipToOutcomeData { + /** + * The unique ID for a scorecard rule. + */ + "id"?: string; + /** + * The JSON:API type for scorecard rules. + */ + "type"?: RuleType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + id: { + baseName: "id", + type: "string", + }, + type: { + baseName: "type", + type: "RuleType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RelationshipToOutcomeData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/RelationshipToRule.ts b/services/scorecards/src/v2/models/RelationshipToRule.ts new file mode 100644 index 000000000000..97ce7f35dd20 --- /dev/null +++ b/services/scorecards/src/v2/models/RelationshipToRule.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RelationshipToRuleData } from "./RelationshipToRuleData"; + +/** + * Scorecard create rule response relationship. + */ +export class RelationshipToRule { + /** + * Relationship data for a rule. + */ + "scorecard"?: RelationshipToRuleData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + scorecard: { + baseName: "scorecard", + type: "RelationshipToRuleData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RelationshipToRule.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/RelationshipToRuleData.ts b/services/scorecards/src/v2/models/RelationshipToRuleData.ts new file mode 100644 index 000000000000..7e1cb9fe8114 --- /dev/null +++ b/services/scorecards/src/v2/models/RelationshipToRuleData.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RelationshipToRuleDataObject } from "./RelationshipToRuleDataObject"; + +/** + * Relationship data for a rule. + */ +export class RelationshipToRuleData { + /** + * Rule relationship data. + */ + "data"?: RelationshipToRuleDataObject; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "RelationshipToRuleDataObject", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RelationshipToRuleData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/RelationshipToRuleDataObject.ts b/services/scorecards/src/v2/models/RelationshipToRuleDataObject.ts new file mode 100644 index 000000000000..14c5c527014b --- /dev/null +++ b/services/scorecards/src/v2/models/RelationshipToRuleDataObject.ts @@ -0,0 +1,54 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ScorecardType } from "./ScorecardType"; + +/** + * Rule relationship data. + */ +export class RelationshipToRuleDataObject { + /** + * The unique ID for a scorecard. + */ + "id"?: string; + /** + * The JSON:API type for scorecard. + */ + "type"?: ScorecardType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + id: { + baseName: "id", + type: "string", + }, + type: { + baseName: "type", + type: "ScorecardType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RelationshipToRuleDataObject.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/RuleAttributes.ts b/services/scorecards/src/v2/models/RuleAttributes.ts new file mode 100644 index 000000000000..4620f36672d3 --- /dev/null +++ b/services/scorecards/src/v2/models/RuleAttributes.ts @@ -0,0 +1,127 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Details of a rule. + */ +export class RuleAttributes { + /** + * The scorecard name to which this rule must belong. + */ + "category"?: string; + /** + * Creation time of the rule outcome. + */ + "createdAt"?: Date; + /** + * Defines if the rule is a custom rule. + */ + "custom"?: boolean; + /** + * Explanation of the rule. + */ + "description"?: string; + /** + * If enabled, the rule is calculated as part of the score. + */ + "enabled"?: boolean; + /** + * The maturity level of the rule (1, 2, or 3). + */ + "level"?: number; + /** + * Time of the last rule outcome modification. + */ + "modifiedAt"?: Date; + /** + * Name of the rule. + */ + "name"?: string; + /** + * Owner of the rule. + */ + "owner"?: string; + /** + * A query to filter which entities this rule applies to. + */ + "scopeQuery"?: string; + /** + * The scorecard name to which this rule must belong. + */ + "scorecardName"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + category: { + baseName: "category", + type: "string", + }, + createdAt: { + baseName: "created_at", + type: "Date", + format: "date-time", + }, + custom: { + baseName: "custom", + type: "boolean", + }, + description: { + baseName: "description", + type: "string", + }, + enabled: { + baseName: "enabled", + type: "boolean", + }, + level: { + baseName: "level", + type: "number", + format: "int32", + }, + modifiedAt: { + baseName: "modified_at", + type: "Date", + format: "date-time", + }, + name: { + baseName: "name", + type: "string", + }, + owner: { + baseName: "owner", + type: "string", + }, + scopeQuery: { + baseName: "scope_query", + type: "string", + }, + scorecardName: { + baseName: "scorecard_name", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RuleAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/RuleAttributesRequest.ts b/services/scorecards/src/v2/models/RuleAttributesRequest.ts new file mode 100644 index 000000000000..5aaaa4296fc6 --- /dev/null +++ b/services/scorecards/src/v2/models/RuleAttributesRequest.ts @@ -0,0 +1,93 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Attributes for creating or updating a rule. Server-managed fields (created_at, modified_at, custom) are excluded. + */ +export class RuleAttributesRequest { + /** + * Explanation of the rule. + */ + "description"?: string; + /** + * If enabled, the rule is calculated as part of the score. + */ + "enabled"?: boolean; + /** + * The maturity level of the rule (1, 2, or 3). + */ + "level"?: number; + /** + * Name of the rule. + */ + "name"?: string; + /** + * Owner of the rule. + */ + "owner"?: string; + /** + * A query to filter which entities this rule applies to. + */ + "scopeQuery"?: string; + /** + * The scorecard name to which this rule must belong. + */ + "scorecardName"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + description: { + baseName: "description", + type: "string", + }, + enabled: { + baseName: "enabled", + type: "boolean", + }, + level: { + baseName: "level", + type: "number", + format: "int32", + }, + name: { + baseName: "name", + type: "string", + }, + owner: { + baseName: "owner", + type: "string", + }, + scopeQuery: { + baseName: "scope_query", + type: "string", + }, + scorecardName: { + baseName: "scorecard_name", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RuleAttributesRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/RuleOutcomeRelationships.ts b/services/scorecards/src/v2/models/RuleOutcomeRelationships.ts new file mode 100644 index 000000000000..952aced708c3 --- /dev/null +++ b/services/scorecards/src/v2/models/RuleOutcomeRelationships.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RelationshipToOutcome } from "./RelationshipToOutcome"; + +/** + * The JSON:API relationship to a scorecard rule. + */ +export class RuleOutcomeRelationships { + /** + * The JSON:API relationship to a scorecard outcome. + */ + "rule"?: RelationshipToOutcome; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + rule: { + baseName: "rule", + type: "RelationshipToOutcome", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RuleOutcomeRelationships.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/RuleType.ts b/services/scorecards/src/v2/models/RuleType.ts new file mode 100644 index 000000000000..9284fd055746 --- /dev/null +++ b/services/scorecards/src/v2/models/RuleType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The JSON:API type for scorecard rules. + */ +export type RuleType = typeof RULE | UnparsedObject; +export const RULE = "rule"; diff --git a/services/scorecards/src/v2/models/ScorecardListResponseAttributes.ts b/services/scorecards/src/v2/models/ScorecardListResponseAttributes.ts new file mode 100644 index 000000000000..fd2bf179175e --- /dev/null +++ b/services/scorecards/src/v2/models/ScorecardListResponseAttributes.ts @@ -0,0 +1,73 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Scorecard attributes. + */ +export class ScorecardListResponseAttributes { + /** + * Creation time of the scorecard. + */ + "createdAt": Date; + /** + * The description of the scorecard. + */ + "description"?: string; + /** + * Time of last scorecard modification. + */ + "modifiedAt": Date; + /** + * The name of the scorecard. + */ + "name": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + createdAt: { + baseName: "created_at", + type: "Date", + required: true, + format: "date-time", + }, + description: { + baseName: "description", + type: "string", + }, + modifiedAt: { + baseName: "modified_at", + type: "Date", + required: true, + format: "date-time", + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ScorecardListResponseAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/ScorecardListResponseData.ts b/services/scorecards/src/v2/models/ScorecardListResponseData.ts new file mode 100644 index 000000000000..e09e1e87db30 --- /dev/null +++ b/services/scorecards/src/v2/models/ScorecardListResponseData.ts @@ -0,0 +1,66 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ScorecardListResponseAttributes } from "./ScorecardListResponseAttributes"; +import { ScorecardListType } from "./ScorecardListType"; + +/** + * Scorecard data. + */ +export class ScorecardListResponseData { + /** + * Scorecard attributes. + */ + "attributes": ScorecardListResponseAttributes; + /** + * The unique ID of the scorecard. + */ + "id": string; + /** + * The JSON:API type for scorecard list. + */ + "type": ScorecardListType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "ScorecardListResponseAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "ScorecardListType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ScorecardListResponseData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/ScorecardListType.ts b/services/scorecards/src/v2/models/ScorecardListType.ts new file mode 100644 index 000000000000..54a9d937000e --- /dev/null +++ b/services/scorecards/src/v2/models/ScorecardListType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The JSON:API type for scorecard list. + */ +export type ScorecardListType = typeof SCORECARD | UnparsedObject; +export const SCORECARD = "scorecard"; diff --git a/services/scorecards/src/v2/models/ScorecardType.ts b/services/scorecards/src/v2/models/ScorecardType.ts new file mode 100644 index 000000000000..d8e96e985738 --- /dev/null +++ b/services/scorecards/src/v2/models/ScorecardType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The JSON:API type for scorecard. + */ +export type ScorecardType = typeof SCORECARD | UnparsedObject; +export const SCORECARD = "scorecard"; diff --git a/services/scorecards/src/v2/models/State.ts b/services/scorecards/src/v2/models/State.ts new file mode 100644 index 000000000000..9ff0cf172856 --- /dev/null +++ b/services/scorecards/src/v2/models/State.ts @@ -0,0 +1,9 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The state of the rule evaluation. + */ +export type State = typeof PASS | typeof FAIL | typeof SKIP | UnparsedObject; +export const PASS = "pass"; +export const FAIL = "fail"; +export const SKIP = "skip"; diff --git a/services/scorecards/src/v2/models/TypingInfo.ts b/services/scorecards/src/v2/models/TypingInfo.ts new file mode 100644 index 000000000000..94d7659f7bd5 --- /dev/null +++ b/services/scorecards/src/v2/models/TypingInfo.ts @@ -0,0 +1,126 @@ +import { ModelTypingInfo } from "@datadog/datadog-api-client"; + +import { APIErrorResponse } from "./APIErrorResponse"; +import { CampaignResponse } from "./CampaignResponse"; +import { CampaignResponseAttributes } from "./CampaignResponseAttributes"; +import { CampaignResponseData } from "./CampaignResponseData"; +import { CreateCampaignRequest } from "./CreateCampaignRequest"; +import { CreateCampaignRequestAttributes } from "./CreateCampaignRequestAttributes"; +import { CreateCampaignRequestData } from "./CreateCampaignRequestData"; +import { CreateRuleRequest } from "./CreateRuleRequest"; +import { CreateRuleRequestData } from "./CreateRuleRequestData"; +import { CreateRuleResponse } from "./CreateRuleResponse"; +import { CreateRuleResponseData } from "./CreateRuleResponseData"; +import { JSONAPIErrorItem } from "./JSONAPIErrorItem"; +import { JSONAPIErrorItemSource } from "./JSONAPIErrorItemSource"; +import { JSONAPIErrorResponse } from "./JSONAPIErrorResponse"; +import { ListCampaignsResponse } from "./ListCampaignsResponse"; +import { ListRulesResponse } from "./ListRulesResponse"; +import { ListRulesResponseDataItem } from "./ListRulesResponseDataItem"; +import { ListRulesResponseLinks } from "./ListRulesResponseLinks"; +import { ListScorecardsResponse } from "./ListScorecardsResponse"; +import { OutcomesBatchAttributes } from "./OutcomesBatchAttributes"; +import { OutcomesBatchRequest } from "./OutcomesBatchRequest"; +import { OutcomesBatchRequestData } from "./OutcomesBatchRequestData"; +import { OutcomesBatchRequestItem } from "./OutcomesBatchRequestItem"; +import { OutcomesBatchResponse } from "./OutcomesBatchResponse"; +import { OutcomesBatchResponseAttributes } from "./OutcomesBatchResponseAttributes"; +import { OutcomesBatchResponseMeta } from "./OutcomesBatchResponseMeta"; +import { OutcomesResponse } from "./OutcomesResponse"; +import { OutcomesResponseDataItem } from "./OutcomesResponseDataItem"; +import { OutcomesResponseIncludedItem } from "./OutcomesResponseIncludedItem"; +import { OutcomesResponseIncludedRuleAttributes } from "./OutcomesResponseIncludedRuleAttributes"; +import { OutcomesResponseLinks } from "./OutcomesResponseLinks"; +import { PaginatedResponseMeta } from "./PaginatedResponseMeta"; +import { RelationshipToOutcome } from "./RelationshipToOutcome"; +import { RelationshipToOutcomeData } from "./RelationshipToOutcomeData"; +import { RelationshipToRule } from "./RelationshipToRule"; +import { RelationshipToRuleData } from "./RelationshipToRuleData"; +import { RelationshipToRuleDataObject } from "./RelationshipToRuleDataObject"; +import { RuleAttributes } from "./RuleAttributes"; +import { RuleAttributesRequest } from "./RuleAttributesRequest"; +import { RuleOutcomeRelationships } from "./RuleOutcomeRelationships"; +import { ScorecardListResponseAttributes } from "./ScorecardListResponseAttributes"; +import { ScorecardListResponseData } from "./ScorecardListResponseData"; +import { UpdateCampaignRequest } from "./UpdateCampaignRequest"; +import { UpdateCampaignRequestAttributes } from "./UpdateCampaignRequestAttributes"; +import { UpdateCampaignRequestData } from "./UpdateCampaignRequestData"; +import { UpdateOutcomesAsyncAttributes } from "./UpdateOutcomesAsyncAttributes"; +import { UpdateOutcomesAsyncRequest } from "./UpdateOutcomesAsyncRequest"; +import { UpdateOutcomesAsyncRequestData } from "./UpdateOutcomesAsyncRequestData"; +import { UpdateOutcomesAsyncRequestItem } from "./UpdateOutcomesAsyncRequestItem"; +import { UpdateRuleRequest } from "./UpdateRuleRequest"; +import { UpdateRuleRequestData } from "./UpdateRuleRequestData"; +import { UpdateRuleResponse } from "./UpdateRuleResponse"; +import { UpdateRuleResponseData } from "./UpdateRuleResponseData"; + +export const TypingInfo: ModelTypingInfo = { + enumsMap: { + CampaignStatus: ["in_progress", "not_started", "completed"], + CampaignType: ["campaign"], + OutcomeType: ["outcome"], + OutcomesBatchType: ["batched-outcome"], + RuleType: ["rule"], + ScorecardListType: ["scorecard"], + ScorecardType: ["scorecard"], + State: ["pass", "fail", "skip"], + UpdateOutcomesAsyncType: ["batched-outcome"], + }, + oneOfMap: {}, + typeMap: { + APIErrorResponse: APIErrorResponse, + CampaignResponse: CampaignResponse, + CampaignResponseAttributes: CampaignResponseAttributes, + CampaignResponseData: CampaignResponseData, + CreateCampaignRequest: CreateCampaignRequest, + CreateCampaignRequestAttributes: CreateCampaignRequestAttributes, + CreateCampaignRequestData: CreateCampaignRequestData, + CreateRuleRequest: CreateRuleRequest, + CreateRuleRequestData: CreateRuleRequestData, + CreateRuleResponse: CreateRuleResponse, + CreateRuleResponseData: CreateRuleResponseData, + JSONAPIErrorItem: JSONAPIErrorItem, + JSONAPIErrorItemSource: JSONAPIErrorItemSource, + JSONAPIErrorResponse: JSONAPIErrorResponse, + ListCampaignsResponse: ListCampaignsResponse, + ListRulesResponse: ListRulesResponse, + ListRulesResponseDataItem: ListRulesResponseDataItem, + ListRulesResponseLinks: ListRulesResponseLinks, + ListScorecardsResponse: ListScorecardsResponse, + OutcomesBatchAttributes: OutcomesBatchAttributes, + OutcomesBatchRequest: OutcomesBatchRequest, + OutcomesBatchRequestData: OutcomesBatchRequestData, + OutcomesBatchRequestItem: OutcomesBatchRequestItem, + OutcomesBatchResponse: OutcomesBatchResponse, + OutcomesBatchResponseAttributes: OutcomesBatchResponseAttributes, + OutcomesBatchResponseMeta: OutcomesBatchResponseMeta, + OutcomesResponse: OutcomesResponse, + OutcomesResponseDataItem: OutcomesResponseDataItem, + OutcomesResponseIncludedItem: OutcomesResponseIncludedItem, + OutcomesResponseIncludedRuleAttributes: + OutcomesResponseIncludedRuleAttributes, + OutcomesResponseLinks: OutcomesResponseLinks, + PaginatedResponseMeta: PaginatedResponseMeta, + RelationshipToOutcome: RelationshipToOutcome, + RelationshipToOutcomeData: RelationshipToOutcomeData, + RelationshipToRule: RelationshipToRule, + RelationshipToRuleData: RelationshipToRuleData, + RelationshipToRuleDataObject: RelationshipToRuleDataObject, + RuleAttributes: RuleAttributes, + RuleAttributesRequest: RuleAttributesRequest, + RuleOutcomeRelationships: RuleOutcomeRelationships, + ScorecardListResponseAttributes: ScorecardListResponseAttributes, + ScorecardListResponseData: ScorecardListResponseData, + UpdateCampaignRequest: UpdateCampaignRequest, + UpdateCampaignRequestAttributes: UpdateCampaignRequestAttributes, + UpdateCampaignRequestData: UpdateCampaignRequestData, + UpdateOutcomesAsyncAttributes: UpdateOutcomesAsyncAttributes, + UpdateOutcomesAsyncRequest: UpdateOutcomesAsyncRequest, + UpdateOutcomesAsyncRequestData: UpdateOutcomesAsyncRequestData, + UpdateOutcomesAsyncRequestItem: UpdateOutcomesAsyncRequestItem, + UpdateRuleRequest: UpdateRuleRequest, + UpdateRuleRequestData: UpdateRuleRequestData, + UpdateRuleResponse: UpdateRuleResponse, + UpdateRuleResponseData: UpdateRuleResponseData, + }, +}; diff --git a/services/scorecards/src/v2/models/UpdateCampaignRequest.ts b/services/scorecards/src/v2/models/UpdateCampaignRequest.ts new file mode 100644 index 000000000000..0a598209f5a1 --- /dev/null +++ b/services/scorecards/src/v2/models/UpdateCampaignRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UpdateCampaignRequestData } from "./UpdateCampaignRequestData"; + +/** + * Request to update a campaign. + */ +export class UpdateCampaignRequest { + /** + * Data for updating a campaign. + */ + "data": UpdateCampaignRequestData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "UpdateCampaignRequestData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpdateCampaignRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/UpdateCampaignRequestAttributes.ts b/services/scorecards/src/v2/models/UpdateCampaignRequestAttributes.ts new file mode 100644 index 000000000000..2fdc618daeb0 --- /dev/null +++ b/services/scorecards/src/v2/models/UpdateCampaignRequestAttributes.ts @@ -0,0 +1,123 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Attributes for updating a campaign. + */ +export class UpdateCampaignRequestAttributes { + /** + * The description of the campaign. + */ + "description"?: string; + /** + * The due date of the campaign. + */ + "dueDate"?: Date; + /** + * Entity scope query to filter entities for this campaign. + */ + "entityScope"?: string; + /** + * Guidance for the campaign. + */ + "guidance"?: string; + /** + * The unique key for the campaign. + */ + "key"?: string; + /** + * The name of the campaign. + */ + "name": string; + /** + * The UUID of the campaign owner. + */ + "ownerId": string; + /** + * Array of rule IDs associated with this campaign. + */ + "ruleIds": Array; + /** + * The start date of the campaign. + */ + "startDate": Date; + /** + * The status of the campaign. + */ + "status": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + description: { + baseName: "description", + type: "string", + }, + dueDate: { + baseName: "due_date", + type: "Date", + format: "date-time", + }, + entityScope: { + baseName: "entity_scope", + type: "string", + }, + guidance: { + baseName: "guidance", + type: "string", + }, + key: { + baseName: "key", + type: "string", + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + ownerId: { + baseName: "owner_id", + type: "string", + required: true, + }, + ruleIds: { + baseName: "rule_ids", + type: "Array", + required: true, + }, + startDate: { + baseName: "start_date", + type: "Date", + required: true, + format: "date-time", + }, + status: { + baseName: "status", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpdateCampaignRequestAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/UpdateCampaignRequestData.ts b/services/scorecards/src/v2/models/UpdateCampaignRequestData.ts new file mode 100644 index 000000000000..4efa6e580adc --- /dev/null +++ b/services/scorecards/src/v2/models/UpdateCampaignRequestData.ts @@ -0,0 +1,57 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { CampaignType } from "./CampaignType"; +import { UpdateCampaignRequestAttributes } from "./UpdateCampaignRequestAttributes"; + +/** + * Data for updating a campaign. + */ +export class UpdateCampaignRequestData { + /** + * Attributes for updating a campaign. + */ + "attributes": UpdateCampaignRequestAttributes; + /** + * The JSON:API type for campaigns. + */ + "type": CampaignType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "UpdateCampaignRequestAttributes", + required: true, + }, + type: { + baseName: "type", + type: "CampaignType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpdateCampaignRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/UpdateOutcomesAsyncAttributes.ts b/services/scorecards/src/v2/models/UpdateOutcomesAsyncAttributes.ts new file mode 100644 index 000000000000..b69b39828635 --- /dev/null +++ b/services/scorecards/src/v2/models/UpdateOutcomesAsyncAttributes.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UpdateOutcomesAsyncRequestItem } from "./UpdateOutcomesAsyncRequestItem"; + +/** + * The JSON:API attributes for a batched set of scorecard outcomes. + */ +export class UpdateOutcomesAsyncAttributes { + /** + * Set of scorecard outcomes to update asynchronously. + */ + "results"?: Array; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + results: { + baseName: "results", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpdateOutcomesAsyncAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/UpdateOutcomesAsyncRequest.ts b/services/scorecards/src/v2/models/UpdateOutcomesAsyncRequest.ts new file mode 100644 index 000000000000..da9801766827 --- /dev/null +++ b/services/scorecards/src/v2/models/UpdateOutcomesAsyncRequest.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UpdateOutcomesAsyncRequestData } from "./UpdateOutcomesAsyncRequestData"; + +/** + * Scorecard outcomes batch request. + */ +export class UpdateOutcomesAsyncRequest { + /** + * Scorecard outcomes batch request data. + */ + "data"?: UpdateOutcomesAsyncRequestData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "UpdateOutcomesAsyncRequestData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpdateOutcomesAsyncRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/UpdateOutcomesAsyncRequestData.ts b/services/scorecards/src/v2/models/UpdateOutcomesAsyncRequestData.ts new file mode 100644 index 000000000000..c05605b2d06e --- /dev/null +++ b/services/scorecards/src/v2/models/UpdateOutcomesAsyncRequestData.ts @@ -0,0 +1,55 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UpdateOutcomesAsyncAttributes } from "./UpdateOutcomesAsyncAttributes"; +import { UpdateOutcomesAsyncType } from "./UpdateOutcomesAsyncType"; + +/** + * Scorecard outcomes batch request data. + */ +export class UpdateOutcomesAsyncRequestData { + /** + * The JSON:API attributes for a batched set of scorecard outcomes. + */ + "attributes"?: UpdateOutcomesAsyncAttributes; + /** + * The JSON:API type for scorecard outcomes. + */ + "type"?: UpdateOutcomesAsyncType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "UpdateOutcomesAsyncAttributes", + }, + type: { + baseName: "type", + type: "UpdateOutcomesAsyncType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpdateOutcomesAsyncRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/UpdateOutcomesAsyncRequestItem.ts b/services/scorecards/src/v2/models/UpdateOutcomesAsyncRequestItem.ts new file mode 100644 index 000000000000..aac46fcc90f3 --- /dev/null +++ b/services/scorecards/src/v2/models/UpdateOutcomesAsyncRequestItem.ts @@ -0,0 +1,73 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { State } from "./State"; + +/** + * Scorecard outcome for a single entity and rule. + */ +export class UpdateOutcomesAsyncRequestItem { + /** + * The unique reference for an IDP entity. + */ + "entityReference": string; + /** + * Any remarks regarding the scorecard rule's evaluation. Supports HTML hyperlinks. + */ + "remarks"?: string; + /** + * The unique ID for a scorecard rule. + */ + "ruleId": string; + /** + * The state of the rule evaluation. + */ + "state": State; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + entityReference: { + baseName: "entity_reference", + type: "string", + required: true, + }, + remarks: { + baseName: "remarks", + type: "string", + }, + ruleId: { + baseName: "rule_id", + type: "string", + required: true, + }, + state: { + baseName: "state", + type: "State", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpdateOutcomesAsyncRequestItem.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/UpdateOutcomesAsyncType.ts b/services/scorecards/src/v2/models/UpdateOutcomesAsyncType.ts new file mode 100644 index 000000000000..45b55a91f0fe --- /dev/null +++ b/services/scorecards/src/v2/models/UpdateOutcomesAsyncType.ts @@ -0,0 +1,7 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The JSON:API type for scorecard outcomes. + */ +export type UpdateOutcomesAsyncType = typeof BATCHED_OUTCOME | UnparsedObject; +export const BATCHED_OUTCOME = "batched-outcome"; diff --git a/services/scorecards/src/v2/models/UpdateRuleRequest.ts b/services/scorecards/src/v2/models/UpdateRuleRequest.ts new file mode 100644 index 000000000000..a375f7c49841 --- /dev/null +++ b/services/scorecards/src/v2/models/UpdateRuleRequest.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UpdateRuleRequestData } from "./UpdateRuleRequestData"; + +/** + * Request to update a scorecard rule. + */ +export class UpdateRuleRequest { + /** + * Data for the request to update a scorecard rule. + */ + "data"?: UpdateRuleRequestData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "UpdateRuleRequestData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpdateRuleRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/UpdateRuleRequestData.ts b/services/scorecards/src/v2/models/UpdateRuleRequestData.ts new file mode 100644 index 000000000000..c69d3780bc55 --- /dev/null +++ b/services/scorecards/src/v2/models/UpdateRuleRequestData.ts @@ -0,0 +1,55 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RuleAttributesRequest } from "./RuleAttributesRequest"; +import { RuleType } from "./RuleType"; + +/** + * Data for the request to update a scorecard rule. + */ +export class UpdateRuleRequestData { + /** + * Attributes for creating or updating a rule. Server-managed fields (created_at, modified_at, custom) are excluded. + */ + "attributes"?: RuleAttributesRequest; + /** + * The JSON:API type for scorecard rules. + */ + "type"?: RuleType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "RuleAttributesRequest", + }, + type: { + baseName: "type", + type: "RuleType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpdateRuleRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/UpdateRuleResponse.ts b/services/scorecards/src/v2/models/UpdateRuleResponse.ts new file mode 100644 index 000000000000..b00646637b74 --- /dev/null +++ b/services/scorecards/src/v2/models/UpdateRuleResponse.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { UpdateRuleResponseData } from "./UpdateRuleResponseData"; + +/** + * The response from a rule update request. + */ +export class UpdateRuleResponse { + /** + * The data for a rule update response. + */ + "data"?: UpdateRuleResponseData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "UpdateRuleResponseData", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpdateRuleResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/src/v2/models/UpdateRuleResponseData.ts b/services/scorecards/src/v2/models/UpdateRuleResponseData.ts new file mode 100644 index 000000000000..4b5068c3e832 --- /dev/null +++ b/services/scorecards/src/v2/models/UpdateRuleResponseData.ts @@ -0,0 +1,72 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { RelationshipToRule } from "./RelationshipToRule"; +import { RuleAttributes } from "./RuleAttributes"; +import { RuleType } from "./RuleType"; + +/** + * The data for a rule update response. + */ +export class UpdateRuleResponseData { + /** + * Details of a rule. + */ + "attributes"?: RuleAttributes; + /** + * The unique ID for a scorecard rule. + */ + "id"?: string; + /** + * Scorecard create rule response relationship. + */ + "relationships"?: RelationshipToRule; + /** + * The JSON:API type for scorecard rules. + */ + "type"?: RuleType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "RuleAttributes", + }, + id: { + baseName: "id", + type: "string", + }, + relationships: { + baseName: "relationships", + type: "RelationshipToRule", + }, + type: { + baseName: "type", + type: "RuleType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpdateRuleResponseData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/scorecards/tsconfig.json b/services/scorecards/tsconfig.json new file mode 100644 index 000000000000..d6c32bfb893c --- /dev/null +++ b/services/scorecards/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "strict": true, + /* Basic Options */ + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "declaration": true, + + "esModuleInterop": true, + "resolveJsonModule": true, + + "noImplicitAny": true, + "noImplicitThis": true, + + /* Additional Checks */ + "noUnusedLocals": false /* Report errors on unused locals. */, // TODO: reenable (unused imports!) + "noUnusedParameters": false /* Report errors on unused parameters. */, // TODO: set to true again + "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, + "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, + + "sourceMap": true, + "outDir": "./dist", + "lib": ["es6", "es7"] + }, + "exclude": ["dist", "node_modules", "tests"], + "include": ["src"] +} diff --git a/yarn.lock b/yarn.lock index 6baa68579bd7..03cc475a332c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1090,6 +1090,15 @@ __metadata: languageName: unknown linkType: soft +"@datadog/datadog-api-client-scorecards@workspace:services/scorecards": + version: 0.0.0-use.local + resolution: "@datadog/datadog-api-client-scorecards@workspace:services/scorecards" + dependencies: + "@datadog/datadog-api-client": "npm:^2.0.0-beta.2" + typescript: "npm:5.8.3" + languageName: unknown + linkType: soft + "@datadog/datadog-api-client-seats@workspace:services/seats": version: 0.0.0-use.local resolution: "@datadog/datadog-api-client-seats@workspace:services/seats"