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/features/v2/service_scorecards/Create-a-new-rule-returns-Bad-Request-response.frozen b/cassettes/features/v2/scorecards/Create-a-new-rule-returns-Bad-Request-response.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/Create-a-new-rule-returns-Bad-Request-response.frozen rename to cassettes/features/v2/scorecards/Create-a-new-rule-returns-Bad-Request-response.frozen diff --git a/cassettes/features/v2/service_scorecards/Create-a-new-rule-returns-Bad-Request-response.yml b/cassettes/features/v2/scorecards/Create-a-new-rule-returns-Bad-Request-response.yml similarity index 100% rename from cassettes/features/v2/service_scorecards/Create-a-new-rule-returns-Bad-Request-response.yml rename to cassettes/features/v2/scorecards/Create-a-new-rule-returns-Bad-Request-response.yml diff --git a/cassettes/features/v2/service_scorecards/Create-a-new-rule-returns-Created-response.frozen b/cassettes/features/v2/scorecards/Create-a-new-rule-returns-Created-response.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/Create-a-new-rule-returns-Created-response.frozen rename to cassettes/features/v2/scorecards/Create-a-new-rule-returns-Created-response.frozen diff --git a/cassettes/features/v2/service_scorecards/Create-a-new-rule-returns-Created-response.yml b/cassettes/features/v2/scorecards/Create-a-new-rule-returns-Created-response.yml similarity index 100% rename from cassettes/features/v2/service_scorecards/Create-a-new-rule-returns-Created-response.yml rename to cassettes/features/v2/scorecards/Create-a-new-rule-returns-Created-response.yml diff --git a/cassettes/features/v2/service_scorecards/Create-outcomes-batch-returns-Bad-Request-response.frozen b/cassettes/features/v2/scorecards/Create-outcomes-batch-returns-Bad-Request-response.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/Create-outcomes-batch-returns-Bad-Request-response.frozen rename to cassettes/features/v2/scorecards/Create-outcomes-batch-returns-Bad-Request-response.frozen diff --git a/cassettes/features/v2/service_scorecards/Create-outcomes-batch-returns-Bad-Request-response.yml b/cassettes/features/v2/scorecards/Create-outcomes-batch-returns-Bad-Request-response.yml similarity index 100% rename from cassettes/features/v2/service_scorecards/Create-outcomes-batch-returns-Bad-Request-response.yml rename to cassettes/features/v2/scorecards/Create-outcomes-batch-returns-Bad-Request-response.yml diff --git a/cassettes/features/v2/service_scorecards/Create-outcomes-batch-returns-OK-response.frozen b/cassettes/features/v2/scorecards/Create-outcomes-batch-returns-OK-response.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/Create-outcomes-batch-returns-OK-response.frozen rename to cassettes/features/v2/scorecards/Create-outcomes-batch-returns-OK-response.frozen diff --git a/cassettes/features/v2/service_scorecards/Create-outcomes-batch-returns-OK-response.yml b/cassettes/features/v2/scorecards/Create-outcomes-batch-returns-OK-response.yml similarity index 100% rename from cassettes/features/v2/service_scorecards/Create-outcomes-batch-returns-OK-response.yml rename to cassettes/features/v2/scorecards/Create-outcomes-batch-returns-OK-response.yml diff --git a/cassettes/features/v2/service_scorecards/Delete-a-rule-returns-Not-Found-response.frozen b/cassettes/features/v2/scorecards/Delete-a-rule-returns-Not-Found-response.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/Delete-a-rule-returns-Not-Found-response.frozen rename to cassettes/features/v2/scorecards/Delete-a-rule-returns-Not-Found-response.frozen diff --git a/cassettes/features/v2/service_scorecards/Delete-a-rule-returns-Not-Found-response.yml b/cassettes/features/v2/scorecards/Delete-a-rule-returns-Not-Found-response.yml similarity index 100% rename from cassettes/features/v2/service_scorecards/Delete-a-rule-returns-Not-Found-response.yml rename to cassettes/features/v2/scorecards/Delete-a-rule-returns-Not-Found-response.yml diff --git a/cassettes/features/v2/service_scorecards/Delete-a-rule-returns-OK-response.frozen b/cassettes/features/v2/scorecards/Delete-a-rule-returns-OK-response.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/Delete-a-rule-returns-OK-response.frozen rename to cassettes/features/v2/scorecards/Delete-a-rule-returns-OK-response.frozen diff --git a/cassettes/features/v2/service_scorecards/Delete-a-rule-returns-OK-response.yml b/cassettes/features/v2/scorecards/Delete-a-rule-returns-OK-response.yml similarity index 100% rename from cassettes/features/v2/service_scorecards/Delete-a-rule-returns-OK-response.yml rename to cassettes/features/v2/scorecards/Delete-a-rule-returns-OK-response.yml diff --git a/cassettes/features/v2/service_scorecards/Get-all-rules-returns-OK-response.frozen b/cassettes/features/v2/scorecards/Get-all-rules-returns-OK-response.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/Get-all-rules-returns-OK-response.frozen rename to cassettes/features/v2/scorecards/Get-all-rules-returns-OK-response.frozen diff --git a/cassettes/features/v2/service_scorecards/Get-all-rules-returns-OK-response.yml b/cassettes/features/v2/scorecards/Get-all-rules-returns-OK-response.yml similarity index 100% rename from cassettes/features/v2/service_scorecards/Get-all-rules-returns-OK-response.yml rename to cassettes/features/v2/scorecards/Get-all-rules-returns-OK-response.yml diff --git a/cassettes/features/v2/service_scorecards/List-all-rule-outcomes-returns-OK-response-with-pagination.frozen b/cassettes/features/v2/scorecards/List-all-rule-outcomes-returns-OK-response-with-pagination.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/List-all-rule-outcomes-returns-OK-response-with-pagination.frozen rename to cassettes/features/v2/scorecards/List-all-rule-outcomes-returns-OK-response-with-pagination.frozen diff --git a/cassettes/features/v2/service_scorecards/List-all-rule-outcomes-returns-OK-response-with-pagination.yml b/cassettes/features/v2/scorecards/List-all-rule-outcomes-returns-OK-response-with-pagination.yml similarity index 100% rename from cassettes/features/v2/service_scorecards/List-all-rule-outcomes-returns-OK-response-with-pagination.yml rename to cassettes/features/v2/scorecards/List-all-rule-outcomes-returns-OK-response-with-pagination.yml diff --git a/cassettes/features/v2/service_scorecards/List-all-rule-outcomes-returns-OK-response.frozen b/cassettes/features/v2/scorecards/List-all-rule-outcomes-returns-OK-response.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/List-all-rule-outcomes-returns-OK-response.frozen rename to cassettes/features/v2/scorecards/List-all-rule-outcomes-returns-OK-response.frozen diff --git a/cassettes/features/v2/service_scorecards/List-all-rule-outcomes-returns-OK-response.yml b/cassettes/features/v2/scorecards/List-all-rule-outcomes-returns-OK-response.yml similarity index 100% rename from cassettes/features/v2/service_scorecards/List-all-rule-outcomes-returns-OK-response.yml rename to cassettes/features/v2/scorecards/List-all-rule-outcomes-returns-OK-response.yml diff --git a/cassettes/features/v2/service_scorecards/List-all-rules-returns-OK-response-with-pagination.frozen b/cassettes/features/v2/scorecards/List-all-rules-returns-OK-response-with-pagination.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/List-all-rules-returns-OK-response-with-pagination.frozen rename to cassettes/features/v2/scorecards/List-all-rules-returns-OK-response-with-pagination.frozen diff --git a/cassettes/features/v2/service_scorecards/List-all-rules-returns-OK-response-with-pagination.yml b/cassettes/features/v2/scorecards/List-all-rules-returns-OK-response-with-pagination.yml similarity index 100% rename from cassettes/features/v2/service_scorecards/List-all-rules-returns-OK-response-with-pagination.yml rename to cassettes/features/v2/scorecards/List-all-rules-returns-OK-response-with-pagination.yml diff --git a/cassettes/features/v2/service_scorecards/List-all-rules-returns-OK-response.frozen b/cassettes/features/v2/scorecards/List-all-rules-returns-OK-response.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/List-all-rules-returns-OK-response.frozen rename to cassettes/features/v2/scorecards/List-all-rules-returns-OK-response.frozen diff --git a/cassettes/features/v2/service_scorecards/List-all-rules-returns-OK-response.yml b/cassettes/features/v2/scorecards/List-all-rules-returns-OK-response.yml similarity index 100% rename from cassettes/features/v2/service_scorecards/List-all-rules-returns-OK-response.yml rename to cassettes/features/v2/scorecards/List-all-rules-returns-OK-response.yml diff --git a/cassettes/features/v2/service_scorecards/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response.frozen b/cassettes/features/v2/scorecards/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response.frozen rename to cassettes/features/v2/scorecards/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response.frozen diff --git a/cassettes/features/v2/service_scorecards/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response.yml b/cassettes/features/v2/scorecards/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response.yml similarity index 100% rename from cassettes/features/v2/service_scorecards/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response.yml rename to cassettes/features/v2/scorecards/Update-Scorecard-outcomes-asynchronously-returns-Accepted-response.yml diff --git a/cassettes/features/v2/service_scorecards/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response.frozen b/cassettes/features/v2/scorecards/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response.frozen rename to cassettes/features/v2/scorecards/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response.frozen diff --git a/cassettes/features/v2/service_scorecards/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response.yml b/cassettes/features/v2/scorecards/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response.yml similarity index 100% rename from cassettes/features/v2/service_scorecards/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response.yml rename to cassettes/features/v2/scorecards/Update-Scorecard-outcomes-asynchronously-returns-Bad-Request-response.yml diff --git a/cassettes/features/v2/service_scorecards/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response.frozen b/cassettes/features/v2/scorecards/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response.frozen rename to cassettes/features/v2/scorecards/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response.frozen diff --git a/cassettes/features/v2/service_scorecards/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response.yml b/cassettes/features/v2/scorecards/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response.yml similarity index 100% rename from cassettes/features/v2/service_scorecards/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response.yml rename to cassettes/features/v2/scorecards/Update-Scorecard-outcomes-asynchronously-returns-Conflict-response.yml diff --git a/cassettes/features/v2/service_scorecards/Update-an-existing-rule-returns-Rule-updated-successfully-response.frozen b/cassettes/features/v2/scorecards/Update-an-existing-rule-returns-Rule-updated-successfully-response.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/Update-an-existing-rule-returns-Rule-updated-successfully-response.frozen rename to cassettes/features/v2/scorecards/Update-an-existing-rule-returns-Rule-updated-successfully-response.frozen diff --git a/cassettes/features/v2/service_scorecards/Update-an-existing-rule-returns-Rule-updated-successfully-response.yml b/cassettes/features/v2/scorecards/Update-an-existing-rule-returns-Rule-updated-successfully-response.yml similarity index 98% rename from cassettes/features/v2/service_scorecards/Update-an-existing-rule-returns-Rule-updated-successfully-response.yml rename to cassettes/features/v2/scorecards/Update-an-existing-rule-returns-Rule-updated-successfully-response.yml index 3f33fb602556..e60ecc7b0bb8 100644 --- a/cassettes/features/v2/service_scorecards/Update-an-existing-rule-returns-Rule-updated-successfully-response.yml +++ b/cassettes/features/v2/scorecards/Update-an-existing-rule-returns-Rule-updated-successfully-response.yml @@ -29,7 +29,7 @@ http_interactions: body: encoding: UTF-8 string: '{"data":{"attributes":{"description":"Updated description via test","enabled":true,"name":"Test-Update_an_existing_rule_returns_Rule_updated_successfully_response-1722307632","scorecard_name":"OpenAPI - Spec Test Best Practices"}}}' + Spec Test Best Practices"},"type":"rule"}}' headers: Accept: - application/json diff --git a/cassettes/features/v2/service_scorecards/Update-an-existing-scorecard-rule-returns-Bad-Request-response.frozen b/cassettes/features/v2/scorecards/Update-an-existing-scorecard-rule-returns-Bad-Request-response.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/Update-an-existing-scorecard-rule-returns-Bad-Request-response.frozen rename to cassettes/features/v2/scorecards/Update-an-existing-scorecard-rule-returns-Bad-Request-response.frozen diff --git a/cassettes/features/v2/service_scorecards/Update-an-existing-scorecard-rule-returns-Bad-Request-response.yml b/cassettes/features/v2/scorecards/Update-an-existing-scorecard-rule-returns-Bad-Request-response.yml similarity index 100% rename from cassettes/features/v2/service_scorecards/Update-an-existing-scorecard-rule-returns-Bad-Request-response.yml rename to cassettes/features/v2/scorecards/Update-an-existing-scorecard-rule-returns-Bad-Request-response.yml diff --git a/cassettes/features/v2/service_scorecards/Update-an-existing-scorecard-rule-returns-Not-Found-response.frozen b/cassettes/features/v2/scorecards/Update-an-existing-scorecard-rule-returns-Not-Found-response.frozen similarity index 100% rename from cassettes/features/v2/service_scorecards/Update-an-existing-scorecard-rule-returns-Not-Found-response.frozen rename to cassettes/features/v2/scorecards/Update-an-existing-scorecard-rule-returns-Not-Found-response.frozen diff --git a/cassettes/features/v2/service_scorecards/Update-an-existing-scorecard-rule-returns-Not-Found-response.yml b/cassettes/features/v2/scorecards/Update-an-existing-scorecard-rule-returns-Not-Found-response.yml similarity index 100% rename from cassettes/features/v2/service_scorecards/Update-an-existing-scorecard-rule-returns-Not-Found-response.yml rename to cassettes/features/v2/scorecards/Update-an-existing-scorecard-rule-returns-Not-Found-response.yml diff --git a/examples/v2/scorecards/CreateScorecardCampaign.rb b/examples/v2/scorecards/CreateScorecardCampaign.rb new file mode 100644 index 000000000000..70532d161392 --- /dev/null +++ b/examples/v2/scorecards/CreateScorecardCampaign.rb @@ -0,0 +1,26 @@ +# Create a new campaign returns "Created" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new + +body = DatadogAPIClient::V2::CreateCampaignRequest.new({ + data: DatadogAPIClient::V2::CreateCampaignRequestData.new({ + attributes: DatadogAPIClient::V2::CreateCampaignRequestAttributes.new({ + 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: DatadogAPIClient::V2::CampaignStatus::IN_PROGRESS, + }), + type: DatadogAPIClient::V2::CampaignType::CAMPAIGN, + }), +}) +p api_instance.create_scorecard_campaign(body) diff --git a/examples/v2/service-scorecards/CreateScorecardOutcomesBatch.rb b/examples/v2/scorecards/CreateScorecardOutcomesBatch.rb similarity index 94% rename from examples/v2/service-scorecards/CreateScorecardOutcomesBatch.rb rename to examples/v2/scorecards/CreateScorecardOutcomesBatch.rb index 882f59fabc19..4623b37eb964 100644 --- a/examples/v2/service-scorecards/CreateScorecardOutcomesBatch.rb +++ b/examples/v2/scorecards/CreateScorecardOutcomesBatch.rb @@ -4,7 +4,7 @@ DatadogAPIClient.configure do |config| config.unstable_operations["v2.create_scorecard_outcomes_batch".to_sym] = true end -api_instance = DatadogAPIClient::V2::ServiceScorecardsAPI.new +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new # there is a valid "create_scorecard_rule" in the system CREATE_SCORECARD_RULE_DATA_ID = ENV["CREATE_SCORECARD_RULE_DATA_ID"] diff --git a/examples/v2/service-scorecards/CreateScorecardRule.rb b/examples/v2/scorecards/CreateScorecardRule.rb similarity index 57% rename from examples/v2/service-scorecards/CreateScorecardRule.rb rename to examples/v2/scorecards/CreateScorecardRule.rb index 12231cf0d678..2d2b8db08955 100644 --- a/examples/v2/service-scorecards/CreateScorecardRule.rb +++ b/examples/v2/scorecards/CreateScorecardRule.rb @@ -1,16 +1,13 @@ # Create a new rule returns "Created" response require "datadog_api_client" -DatadogAPIClient.configure do |config| - config.unstable_operations["v2.create_scorecard_rule".to_sym] = true -end -api_instance = DatadogAPIClient::V2::ServiceScorecardsAPI.new +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new body = DatadogAPIClient::V2::CreateRuleRequest.new({ data: DatadogAPIClient::V2::CreateRuleRequestData.new({ - attributes: DatadogAPIClient::V2::RuleAttributes.new({ + attributes: DatadogAPIClient::V2::RuleAttributesRequest.new({ enabled: true, - name: "Example-Service-Scorecard", + name: "Example-Scorecard", scorecard_name: "Observability Best Practices", }), type: DatadogAPIClient::V2::RuleType::RULE, diff --git a/examples/v2/scorecards/DeleteScorecardCampaign.rb b/examples/v2/scorecards/DeleteScorecardCampaign.rb new file mode 100644 index 000000000000..fd9ae112ea6d --- /dev/null +++ b/examples/v2/scorecards/DeleteScorecardCampaign.rb @@ -0,0 +1,5 @@ +# Delete a campaign returns "No Content" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new +api_instance.delete_scorecard_campaign("c10ODp0VCrrIpXmz") diff --git a/examples/v2/service-scorecards/DeleteScorecardRule.rb b/examples/v2/scorecards/DeleteScorecardRule.rb similarity index 59% rename from examples/v2/service-scorecards/DeleteScorecardRule.rb rename to examples/v2/scorecards/DeleteScorecardRule.rb index 6acb2c75a384..7fade85ba17d 100644 --- a/examples/v2/service-scorecards/DeleteScorecardRule.rb +++ b/examples/v2/scorecards/DeleteScorecardRule.rb @@ -1,10 +1,7 @@ # Delete a rule returns "OK" response require "datadog_api_client" -DatadogAPIClient.configure do |config| - config.unstable_operations["v2.delete_scorecard_rule".to_sym] = true -end -api_instance = DatadogAPIClient::V2::ServiceScorecardsAPI.new +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new # there is a valid "create_scorecard_rule" in the system CREATE_SCORECARD_RULE_DATA_ID = ENV["CREATE_SCORECARD_RULE_DATA_ID"] diff --git a/examples/v2/scorecards/GetScorecardCampaign.rb b/examples/v2/scorecards/GetScorecardCampaign.rb new file mode 100644 index 000000000000..aeb486c2e225 --- /dev/null +++ b/examples/v2/scorecards/GetScorecardCampaign.rb @@ -0,0 +1,5 @@ +# Get a campaign returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new +p api_instance.get_scorecard_campaign("c10ODp0VCrrIpXmz") diff --git a/examples/v2/scorecards/ListScorecardCampaigns.rb b/examples/v2/scorecards/ListScorecardCampaigns.rb new file mode 100644 index 000000000000..74f867627505 --- /dev/null +++ b/examples/v2/scorecards/ListScorecardCampaigns.rb @@ -0,0 +1,5 @@ +# List all campaigns returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new +p api_instance.list_scorecard_campaigns() diff --git a/examples/v2/scorecards/ListScorecardOutcomes.rb b/examples/v2/scorecards/ListScorecardOutcomes.rb new file mode 100644 index 000000000000..1230b4093c3e --- /dev/null +++ b/examples/v2/scorecards/ListScorecardOutcomes.rb @@ -0,0 +1,5 @@ +# List all rule outcomes returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new +p api_instance.list_scorecard_outcomes() diff --git a/examples/v2/service-scorecards/ListScorecardOutcomes_2663454275.rb b/examples/v2/scorecards/ListScorecardOutcomes_2663454275.rb similarity index 60% rename from examples/v2/service-scorecards/ListScorecardOutcomes_2663454275.rb rename to examples/v2/scorecards/ListScorecardOutcomes_2663454275.rb index 2e5070c2c761..055bd348358f 100644 --- a/examples/v2/service-scorecards/ListScorecardOutcomes_2663454275.rb +++ b/examples/v2/scorecards/ListScorecardOutcomes_2663454275.rb @@ -1,10 +1,7 @@ # List all rule outcomes returns "OK" response with pagination require "datadog_api_client" -DatadogAPIClient.configure do |config| - config.unstable_operations["v2.list_scorecard_outcomes".to_sym] = true -end -api_instance = DatadogAPIClient::V2::ServiceScorecardsAPI.new +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new opts = { page_size: 2, fields_outcome: "state", diff --git a/examples/v2/scorecards/ListScorecardRules.rb b/examples/v2/scorecards/ListScorecardRules.rb new file mode 100644 index 000000000000..4eab75c66aca --- /dev/null +++ b/examples/v2/scorecards/ListScorecardRules.rb @@ -0,0 +1,5 @@ +# List all rules returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new +p api_instance.list_scorecard_rules() diff --git a/examples/v2/service-scorecards/ListScorecardRules_4057666343.rb b/examples/v2/scorecards/ListScorecardRules_4057666343.rb similarity index 57% rename from examples/v2/service-scorecards/ListScorecardRules_4057666343.rb rename to examples/v2/scorecards/ListScorecardRules_4057666343.rb index c89fbd1e3d3b..c149fccc8fd0 100644 --- a/examples/v2/service-scorecards/ListScorecardRules_4057666343.rb +++ b/examples/v2/scorecards/ListScorecardRules_4057666343.rb @@ -1,10 +1,7 @@ # List all rules returns "OK" response with pagination require "datadog_api_client" -DatadogAPIClient.configure do |config| - config.unstable_operations["v2.list_scorecard_rules".to_sym] = true -end -api_instance = DatadogAPIClient::V2::ServiceScorecardsAPI.new +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new opts = { page_size: 2, fields_rule: "name", diff --git a/examples/v2/scorecards/ListScorecards.rb b/examples/v2/scorecards/ListScorecards.rb new file mode 100644 index 000000000000..83bc5ab78652 --- /dev/null +++ b/examples/v2/scorecards/ListScorecards.rb @@ -0,0 +1,5 @@ +# List all scorecards returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new +p api_instance.list_scorecards() diff --git a/examples/v2/scorecards/UpdateScorecardCampaign.rb b/examples/v2/scorecards/UpdateScorecardCampaign.rb new file mode 100644 index 000000000000..60f77aca65ed --- /dev/null +++ b/examples/v2/scorecards/UpdateScorecardCampaign.rb @@ -0,0 +1,26 @@ +# Update a campaign returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new + +body = DatadogAPIClient::V2::UpdateCampaignRequest.new({ + data: DatadogAPIClient::V2::UpdateCampaignRequestData.new({ + attributes: DatadogAPIClient::V2::UpdateCampaignRequestAttributes.new({ + 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: DatadogAPIClient::V2::CampaignType::CAMPAIGN, + }), +}) +p api_instance.update_scorecard_campaign("c10ODp0VCrrIpXmz", body) diff --git a/examples/v2/scorecards/UpdateScorecardOutcomes.rb b/examples/v2/scorecards/UpdateScorecardOutcomes.rb new file mode 100644 index 000000000000..940af6f9f517 --- /dev/null +++ b/examples/v2/scorecards/UpdateScorecardOutcomes.rb @@ -0,0 +1,21 @@ +# Update Scorecard outcomes returns "Accepted" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new + +body = DatadogAPIClient::V2::UpdateOutcomesAsyncRequest.new({ + data: DatadogAPIClient::V2::UpdateOutcomesAsyncRequestData.new({ + attributes: DatadogAPIClient::V2::UpdateOutcomesAsyncAttributes.new({ + results: [ + DatadogAPIClient::V2::UpdateOutcomesAsyncRequestItem.new({ + entity_reference: "service:my-service", + remarks: 'See: Services', + rule_id: "q8MQxk8TCqrHnWkx", + state: DatadogAPIClient::V2::State::PASS, + }), + ], + }), + type: DatadogAPIClient::V2::UpdateOutcomesAsyncType::BATCHED_OUTCOME, + }), +}) +p api_instance.update_scorecard_outcomes(body) diff --git a/examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.rb b/examples/v2/scorecards/UpdateScorecardOutcomes_2262047257.rb similarity index 78% rename from examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.rb rename to examples/v2/scorecards/UpdateScorecardOutcomes_2262047257.rb index b2c19901654b..69dcca50558d 100644 --- a/examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.rb +++ b/examples/v2/scorecards/UpdateScorecardOutcomes_2262047257.rb @@ -1,10 +1,7 @@ # Update Scorecard outcomes asynchronously returns "Accepted" response require "datadog_api_client" -DatadogAPIClient.configure do |config| - config.unstable_operations["v2.update_scorecard_outcomes_async".to_sym] = true -end -api_instance = DatadogAPIClient::V2::ServiceScorecardsAPI.new +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new # there is a valid "create_scorecard_rule" in the system CREATE_SCORECARD_RULE_DATA_ID = ENV["CREATE_SCORECARD_RULE_DATA_ID"] @@ -24,4 +21,4 @@ type: DatadogAPIClient::V2::UpdateOutcomesAsyncType::BATCHED_OUTCOME, }), }) -p api_instance.update_scorecard_outcomes_async(body) +p api_instance.update_scorecard_outcomes(body) diff --git a/examples/v2/scorecards/UpdateScorecardRule.rb b/examples/v2/scorecards/UpdateScorecardRule.rb new file mode 100644 index 000000000000..75d274b6caa0 --- /dev/null +++ b/examples/v2/scorecards/UpdateScorecardRule.rb @@ -0,0 +1,18 @@ +# Update an existing scorecard rule returns "Rule updated successfully" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new + +body = DatadogAPIClient::V2::UpdateRuleRequest.new({ + data: DatadogAPIClient::V2::UpdateRuleRequestData.new({ + attributes: DatadogAPIClient::V2::RuleAttributesRequest.new({ + enabled: true, + level: 2, + name: "Team Defined", + scope_query: "kind:service", + scorecard_name: "Deployments automated via Deployment Trains", + }), + type: DatadogAPIClient::V2::RuleType::RULE, + }), +}) +p api_instance.update_scorecard_rule("rule_id", body) diff --git a/examples/v2/service-scorecards/UpdateScorecardRule.rb b/examples/v2/scorecards/UpdateScorecardRule_1831541184.rb similarity index 78% rename from examples/v2/service-scorecards/UpdateScorecardRule.rb rename to examples/v2/scorecards/UpdateScorecardRule_1831541184.rb index 9c50490b525b..bbfc8f63a19e 100644 --- a/examples/v2/service-scorecards/UpdateScorecardRule.rb +++ b/examples/v2/scorecards/UpdateScorecardRule_1831541184.rb @@ -1,10 +1,7 @@ # Update an existing rule returns "Rule updated successfully" response require "datadog_api_client" -DatadogAPIClient.configure do |config| - config.unstable_operations["v2.update_scorecard_rule".to_sym] = true -end -api_instance = DatadogAPIClient::V2::ServiceScorecardsAPI.new +api_instance = DatadogAPIClient::V2::ScorecardsAPI.new # there is a valid "create_scorecard_rule" in the system CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME = ENV["CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME"] @@ -13,7 +10,8 @@ body = DatadogAPIClient::V2::UpdateRuleRequest.new({ data: DatadogAPIClient::V2::UpdateRuleRequestData.new({ - attributes: DatadogAPIClient::V2::RuleAttributes.new({ + type: DatadogAPIClient::V2::RuleType::RULE, + attributes: DatadogAPIClient::V2::RuleAttributesRequest.new({ enabled: true, name: CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME, scorecard_name: CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME, diff --git a/examples/v2/service-scorecards/ListScorecardOutcomes.rb b/examples/v2/service-scorecards/ListScorecardOutcomes.rb deleted file mode 100644 index 92c8b76ff18c..000000000000 --- a/examples/v2/service-scorecards/ListScorecardOutcomes.rb +++ /dev/null @@ -1,8 +0,0 @@ -# List all rule outcomes returns "OK" response - -require "datadog_api_client" -DatadogAPIClient.configure do |config| - config.unstable_operations["v2.list_scorecard_outcomes".to_sym] = true -end -api_instance = DatadogAPIClient::V2::ServiceScorecardsAPI.new -p api_instance.list_scorecard_outcomes() diff --git a/examples/v2/service-scorecards/ListScorecardRules.rb b/examples/v2/service-scorecards/ListScorecardRules.rb deleted file mode 100644 index b9d6c388e5ff..000000000000 --- a/examples/v2/service-scorecards/ListScorecardRules.rb +++ /dev/null @@ -1,8 +0,0 @@ -# List all rules returns "OK" response - -require "datadog_api_client" -DatadogAPIClient.configure do |config| - config.unstable_operations["v2.list_scorecard_rules".to_sym] = true -end -api_instance = DatadogAPIClient::V2::ServiceScorecardsAPI.new -p api_instance.list_scorecard_rules() diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 9c7dbfe9962b..1862deb447bf 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -3638,6 +3638,28 @@ "page_size" => "Integer", "filter_application_id" => "String", }, + "v2.ListScorecardCampaigns" => { + "page_limit" => "Integer", + "page_offset" => "Integer", + "filter_campaign_name" => "String", + "filter_campaign_status" => "String", + "filter_campaign_owner" => "String", + }, + "v2.CreateScorecardCampaign" => { + "body" => "CreateCampaignRequest", + }, + "v2.DeleteScorecardCampaign" => { + "campaign_id" => "String", + }, + "v2.GetScorecardCampaign" => { + "campaign_id" => "String", + "include" => "String", + "include_meta" => "Boolean", + }, + "v2.UpdateScorecardCampaign" => { + "campaign_id" => "String", + "body" => "UpdateCampaignRequest", + }, "v2.ListScorecardOutcomes" => { "page_size" => "Integer", "page_offset" => "Integer", @@ -3650,7 +3672,7 @@ "filter_rule_id" => "String", "filter_rule_name" => "String", }, - "v2.UpdateScorecardOutcomesAsync" => { + "v2.UpdateScorecardOutcomes" => { "body" => "UpdateOutcomesAsyncRequest", }, "v2.CreateScorecardOutcomesBatch" => { @@ -3678,6 +3700,13 @@ "rule_id" => "String", "body" => "UpdateRuleRequest", }, + "v2.ListScorecards" => { + "page_offset" => "Integer", + "page_size" => "Integer", + "filter_scorecard_id" => "String", + "filter_scorecard_name" => "String", + "filter_scorecard_description" => "String", + }, "v2.UnassignSeatsUser" => { "body" => "UnassignSeatsUserRequest", }, 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/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 74df85e5c1a9..ad5680e94fe5 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -389,12 +389,6 @@ def initialize "v2.query_users": false, "v2.update_connection": false, "v2.create_scorecard_outcomes_batch": false, - "v2.create_scorecard_rule": false, - "v2.delete_scorecard_rule": false, - "v2.list_scorecard_outcomes": false, - "v2.list_scorecard_rules": false, - "v2.update_scorecard_outcomes_async": false, - "v2.update_scorecard_rule": false, "v2.list_entity_risk_scores": false, "v2.create_incident_service": false, "v2.delete_incident_service": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index b38f547854a2..8644837286c8 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1493,6 +1493,11 @@ def overrides "v2.bulk_put_apps_datastore_items_request_data" => "BulkPutAppsDatastoreItemsRequestData", "v2.bulk_put_apps_datastore_items_request_data_attributes" => "BulkPutAppsDatastoreItemsRequestDataAttributes", "v2.calculated_field" => "CalculatedField", + "v2.campaign_response" => "CampaignResponse", + "v2.campaign_response_attributes" => "CampaignResponseAttributes", + "v2.campaign_response_data" => "CampaignResponseData", + "v2.campaign_status" => "CampaignStatus", + "v2.campaign_type" => "CampaignType", "v2.cancel_data_deletion_response_body" => "CancelDataDeletionResponseBody", "v2.case" => "Case", "v2.case3rd_party_ticket_status" => "Case3rdPartyTicketStatus", @@ -1900,6 +1905,9 @@ def overrides "v2.create_attachment_request_data" => "CreateAttachmentRequestData", "v2.create_attachment_request_data_attributes" => "CreateAttachmentRequestDataAttributes", "v2.create_attachment_request_data_attributes_attachment" => "CreateAttachmentRequestDataAttributesAttachment", + "v2.create_campaign_request" => "CreateCampaignRequest", + "v2.create_campaign_request_attributes" => "CreateCampaignRequestAttributes", + "v2.create_campaign_request_data" => "CreateCampaignRequestData", "v2.create_case_request_array" => "CreateCaseRequestArray", "v2.create_case_request_data" => "CreateCaseRequestData", "v2.create_case_request_data_attributes" => "CreateCaseRequestDataAttributes", @@ -3285,6 +3293,7 @@ def overrides "v2.list_apps_response_meta" => "ListAppsResponseMeta", "v2.list_apps_response_meta_page" => "ListAppsResponseMetaPage", "v2.list_assets_sbo_ms_response" => "ListAssetsSBOMsResponse", + "v2.list_campaigns_response" => "ListCampaignsResponse", "v2.list_connections_response" => "ListConnectionsResponse", "v2.list_connections_response_data" => "ListConnectionsResponseData", "v2.list_connections_response_data_attributes" => "ListConnectionsResponseDataAttributes", @@ -3320,6 +3329,7 @@ def overrides "v2.list_rules_response" => "ListRulesResponse", "v2.list_rules_response_data_item" => "ListRulesResponseDataItem", "v2.list_rules_response_links" => "ListRulesResponseLinks", + "v2.list_scorecards_response" => "ListScorecardsResponse", "v2.list_security_findings_response" => "ListSecurityFindingsResponse", "v2.list_tags_response" => "ListTagsResponse", "v2.list_tags_response_data" => "ListTagsResponseData", @@ -4112,6 +4122,7 @@ def overrides "v2.output_schema_parameters_type" => "OutputSchemaParametersType", "v2.overwrite_allocations_request" => "OverwriteAllocationsRequest", "v2.page_urgency" => "PageUrgency", + "v2.paginated_response_meta" => "PaginatedResponseMeta", "v2.pagination" => "Pagination", "v2.pagination_meta" => "PaginationMeta", "v2.pagination_meta_page" => "PaginationMetaPage", @@ -4482,6 +4493,7 @@ def overrides "v2.routing_rule_relationships_policy_data_type" => "RoutingRuleRelationshipsPolicyDataType", "v2.routing_rule_type" => "RoutingRuleType", "v2.rule_attributes" => "RuleAttributes", + "v2.rule_attributes_request" => "RuleAttributesRequest", "v2.rule_outcome_relationships" => "RuleOutcomeRelationships", "v2.ruleset_resp" => "RulesetResp", "v2.ruleset_resp_array" => "RulesetRespArray", @@ -4693,6 +4705,9 @@ def overrides "v2.schedule_user" => "ScheduleUser", "v2.schedule_user_attributes" => "ScheduleUserAttributes", "v2.schedule_user_type" => "ScheduleUserType", + "v2.scorecard_list_response_attributes" => "ScorecardListResponseAttributes", + "v2.scorecard_list_response_data" => "ScorecardListResponseData", + "v2.scorecard_list_type" => "ScorecardListType", "v2.scorecard_type" => "ScorecardType", "v2.search_issues_include_query_parameter_item" => "SearchIssuesIncludeQueryParameterItem", "v2.seat_assignments_data_type" => "SeatAssignmentsDataType", @@ -5582,6 +5597,9 @@ def overrides "v2.update_apps_datastore_request" => "UpdateAppsDatastoreRequest", "v2.update_apps_datastore_request_data" => "UpdateAppsDatastoreRequestData", "v2.update_apps_datastore_request_data_attributes" => "UpdateAppsDatastoreRequestDataAttributes", + "v2.update_campaign_request" => "UpdateCampaignRequest", + "v2.update_campaign_request_attributes" => "UpdateCampaignRequestAttributes", + "v2.update_campaign_request_data" => "UpdateCampaignRequestData", "v2.update_connection_request" => "UpdateConnectionRequest", "v2.update_connection_request_data" => "UpdateConnectionRequestData", "v2.update_connection_request_data_attributes" => "UpdateConnectionRequestDataAttributes", @@ -5924,13 +5942,13 @@ def overrides "v2.rum_replay_sessions_api" => "RumReplaySessionsAPI", "v2.rum_replay_viewership_api" => "RumReplayViewershipAPI", "v2.rum_retention_filters_api" => "RumRetentionFiltersAPI", + "v2.scorecards_api" => "ScorecardsAPI", "v2.seats_api" => "SeatsAPI", "v2.security_monitoring_api" => "SecurityMonitoringAPI", "v2.sensitive_data_scanner_api" => "SensitiveDataScannerAPI", "v2.service_accounts_api" => "ServiceAccountsAPI", "v2.service_definition_api" => "ServiceDefinitionAPI", "v2.service_level_objectives_api" => "ServiceLevelObjectivesAPI", - "v2.service_scorecards_api" => "ServiceScorecardsAPI", "v2.service_now_integration_api" => "ServiceNowIntegrationAPI", "v2.software_catalog_api" => "SoftwareCatalogAPI", "v2.spa_api" => "SpaAPI", diff --git a/lib/datadog_api_client/v2/api/service_scorecards_api.rb b/lib/datadog_api_client/v2/api/scorecards_api.rb similarity index 52% rename from lib/datadog_api_client/v2/api/service_scorecards_api.rb rename to lib/datadog_api_client/v2/api/scorecards_api.rb index b9ba3606557a..4fe588c15742 100644 --- a/lib/datadog_api_client/v2/api/service_scorecards_api.rb +++ b/lib/datadog_api_client/v2/api/scorecards_api.rb @@ -16,13 +16,80 @@ require 'cgi' module DatadogAPIClient::V2 - class ServiceScorecardsAPI + class ScorecardsAPI attr_accessor :api_client def initialize(api_client = DatadogAPIClient::APIClient.default) @api_client = api_client end + # Create a new campaign. + # + # @see #create_scorecard_campaign_with_http_info + def create_scorecard_campaign(body, opts = {}) + data, _status_code, _headers = create_scorecard_campaign_with_http_info(body, opts) + data + end + + # Create a new campaign. + # + # Creates a new scorecard campaign. + # + # @param body [CreateCampaignRequest] Campaign data. + # @param opts [Hash] the optional parameters + # @return [Array<(CampaignResponse, Integer, Hash)>] CampaignResponse data, response status code and response headers + def create_scorecard_campaign_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ScorecardsAPI.create_scorecard_campaign ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling ScorecardsAPI.create_scorecard_campaign" + end + # resource path + local_var_path = '/api/v2/scorecard/campaigns' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'CampaignResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_scorecard_campaign, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScorecardsAPI#create_scorecard_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create outcomes batch. # # @see #create_scorecard_outcomes_batch_with_http_info @@ -35,10 +102,13 @@ def create_scorecard_outcomes_batch(body, opts = {}) # # Sets multiple service-rule outcomes in a single batched request. # + # @deprecated This API is deprecated. + # # @param body [OutcomesBatchRequest] Set of scorecard outcomes. # @param opts [Hash] the optional parameters # @return [Array<(OutcomesBatchResponse, Integer, Hash)>] OutcomesBatchResponse data, response status code and response headers def create_scorecard_outcomes_batch_with_http_info(body, opts = {}) + warn "[DEPRECATION] `CreateScorecardOutcomesBatch` is deprecated." unstable_enabled = @api_client.config.unstable_operations["v2.create_scorecard_outcomes_batch".to_sym] if unstable_enabled @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_scorecard_outcomes_batch") @@ -47,11 +117,11 @@ def create_scorecard_outcomes_batch_with_http_info(body, opts = {}) end if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ServiceScorecardsAPI.create_scorecard_outcomes_batch ...' + @api_client.config.logger.debug 'Calling API: ScorecardsAPI.create_scorecard_outcomes_batch ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? - fail ArgumentError, "Missing the required parameter 'body' when calling ServiceScorecardsAPI.create_scorecard_outcomes_batch" + fail ArgumentError, "Missing the required parameter 'body' when calling ScorecardsAPI.create_scorecard_outcomes_batch" end # resource path local_var_path = '/api/v2/scorecard/outcomes/batch' @@ -91,7 +161,7 @@ def create_scorecard_outcomes_batch_with_http_info(body, opts = {}) data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: ServiceScorecardsAPI#create_scorecard_outcomes_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: ScorecardsAPI#create_scorecard_outcomes_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end @@ -112,19 +182,13 @@ def create_scorecard_rule(body, opts = {}) # @param opts [Hash] the optional parameters # @return [Array<(CreateRuleResponse, Integer, Hash)>] CreateRuleResponse data, response status code and response headers def create_scorecard_rule_with_http_info(body, opts = {}) - unstable_enabled = @api_client.config.unstable_operations["v2.create_scorecard_rule".to_sym] - if unstable_enabled - @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_scorecard_rule") - else - raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_scorecard_rule")) - end if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ServiceScorecardsAPI.create_scorecard_rule ...' + @api_client.config.logger.debug 'Calling API: ScorecardsAPI.create_scorecard_rule ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? - fail ArgumentError, "Missing the required parameter 'body' when calling ServiceScorecardsAPI.create_scorecard_rule" + fail ArgumentError, "Missing the required parameter 'body' when calling ScorecardsAPI.create_scorecard_rule" end # resource path local_var_path = '/api/v2/scorecard/rules' @@ -164,7 +228,72 @@ def create_scorecard_rule_with_http_info(body, opts = {}) data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: ServiceScorecardsAPI#create_scorecard_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: ScorecardsAPI#create_scorecard_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete a campaign. + # + # @see #delete_scorecard_campaign_with_http_info + def delete_scorecard_campaign(campaign_id, opts = {}) + delete_scorecard_campaign_with_http_info(campaign_id, opts) + nil + end + + # Delete a campaign. + # + # Deletes a single campaign by ID or key. + # + # @param campaign_id [String] Campaign ID or key. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_scorecard_campaign_with_http_info(campaign_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ScorecardsAPI.delete_scorecard_campaign ...' + end + # verify the required parameter 'campaign_id' is set + if @api_client.config.client_side_validation && campaign_id.nil? + fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ScorecardsAPI.delete_scorecard_campaign" + end + # resource path + local_var_path = '/api/v2/scorecard/campaigns/{campaign_id}'.sub('{campaign_id}', CGI.escape(campaign_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :delete_scorecard_campaign, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScorecardsAPI#delete_scorecard_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end @@ -185,19 +314,13 @@ def delete_scorecard_rule(rule_id, opts = {}) # @param opts [Hash] the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_scorecard_rule_with_http_info(rule_id, opts = {}) - unstable_enabled = @api_client.config.unstable_operations["v2.delete_scorecard_rule".to_sym] - if unstable_enabled - @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_scorecard_rule") - else - raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_scorecard_rule")) - end if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ServiceScorecardsAPI.delete_scorecard_rule ...' + @api_client.config.logger.debug 'Calling API: ScorecardsAPI.delete_scorecard_rule ...' end # verify the required parameter 'rule_id' is set if @api_client.config.client_side_validation && rule_id.nil? - fail ArgumentError, "Missing the required parameter 'rule_id' when calling ServiceScorecardsAPI.delete_scorecard_rule" + fail ArgumentError, "Missing the required parameter 'rule_id' when calling ScorecardsAPI.delete_scorecard_rule" end # resource path local_var_path = '/api/v2/scorecard/rules/{rule_id}'.sub('{rule_id}', CGI.escape(rule_id.to_s).gsub('%2F', '/')) @@ -235,7 +358,146 @@ def delete_scorecard_rule_with_http_info(rule_id, opts = {}) data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: ServiceScorecardsAPI#delete_scorecard_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: ScorecardsAPI#delete_scorecard_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a campaign. + # + # @see #get_scorecard_campaign_with_http_info + def get_scorecard_campaign(campaign_id, opts = {}) + data, _status_code, _headers = get_scorecard_campaign_with_http_info(campaign_id, opts) + data + end + + # Get a campaign. + # + # Fetches a single campaign by ID or key. + # + # @param campaign_id [String] Campaign ID or key. + # @param opts [Hash] the optional parameters + # @option opts [String] :include Include related data (for example, scores). + # @option opts [Boolean] :include_meta Include metadata (entity and rule counts). + # @return [Array<(CampaignResponse, Integer, Hash)>] CampaignResponse data, response status code and response headers + def get_scorecard_campaign_with_http_info(campaign_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ScorecardsAPI.get_scorecard_campaign ...' + end + # verify the required parameter 'campaign_id' is set + if @api_client.config.client_side_validation && campaign_id.nil? + fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ScorecardsAPI.get_scorecard_campaign" + end + # resource path + local_var_path = '/api/v2/scorecard/campaigns/{campaign_id}'.sub('{campaign_id}', CGI.escape(campaign_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? + query_params[:'include_meta'] = opts[:'include_meta'] if !opts[:'include_meta'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CampaignResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_scorecard_campaign, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScorecardsAPI#get_scorecard_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List all campaigns. + # + # @see #list_scorecard_campaigns_with_http_info + def list_scorecard_campaigns(opts = {}) + data, _status_code, _headers = list_scorecard_campaigns_with_http_info(opts) + data + end + + # List all campaigns. + # + # Fetches all scorecard campaigns. + # + # @param opts [Hash] the optional parameters + # @option opts [Integer] :page_limit Maximum number of campaigns to return. + # @option opts [Integer] :page_offset Offset for pagination. + # @option opts [String] :filter_campaign_name Filter campaigns by name (full-text search). + # @option opts [String] :filter_campaign_status Filter campaigns by status. + # @option opts [String] :filter_campaign_owner Filter campaigns by owner UUID. + # @return [Array<(ListCampaignsResponse, Integer, Hash)>] ListCampaignsResponse data, response status code and response headers + def list_scorecard_campaigns_with_http_info(opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ScorecardsAPI.list_scorecard_campaigns ...' + end + # resource path + local_var_path = '/api/v2/scorecard/campaigns' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil? + query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil? + query_params[:'filter[campaign][name]'] = opts[:'filter_campaign_name'] if !opts[:'filter_campaign_name'].nil? + query_params[:'filter[campaign][status]'] = opts[:'filter_campaign_status'] if !opts[:'filter_campaign_status'].nil? + query_params[:'filter[campaign][owner]'] = opts[:'filter_campaign_owner'] if !opts[:'filter_campaign_owner'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListCampaignsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_scorecard_campaigns, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScorecardsAPI#list_scorecard_campaigns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end @@ -258,22 +520,16 @@ def list_scorecard_outcomes(opts = {}) # @option opts [String] :include Include related rule details in the response. # @option opts [String] :fields_outcome Return only specified values in the outcome attributes. # @option opts [String] :fields_rule Return only specified values in the included rule details. - # @option opts [String] :filter_outcome_service_name Filter the outcomes on a specific service name. - # @option opts [String] :filter_outcome_state Filter the outcomes by a specific state. - # @option opts [Boolean] :filter_rule_enabled Filter outcomes on whether a rule is enabled/disabled. + # @option opts [String] :filter_outcome_service_name Filter outcomes on a specific service name. + # @option opts [String] :filter_outcome_state Filter outcomes by a specific state. + # @option opts [Boolean] :filter_rule_enabled Filter outcomes based on whether a rule is enabled or disabled. # @option opts [String] :filter_rule_id Filter outcomes based on rule ID. # @option opts [String] :filter_rule_name Filter outcomes based on rule name. # @return [Array<(OutcomesResponse, Integer, Hash)>] OutcomesResponse data, response status code and response headers def list_scorecard_outcomes_with_http_info(opts = {}) - unstable_enabled = @api_client.config.unstable_operations["v2.list_scorecard_outcomes".to_sym] - if unstable_enabled - @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_scorecard_outcomes") - else - raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_scorecard_outcomes")) - end if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ServiceScorecardsAPI.list_scorecard_outcomes ...' + @api_client.config.logger.debug 'Calling API: ScorecardsAPI.list_scorecard_outcomes ...' end # resource path local_var_path = '/api/v2/scorecard/outcomes' @@ -321,7 +577,7 @@ def list_scorecard_outcomes_with_http_info(opts = {}) data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: ServiceScorecardsAPI#list_scorecard_outcomes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: ScorecardsAPI#list_scorecard_outcomes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end @@ -372,15 +628,9 @@ def list_scorecard_rules(opts = {}) # @option opts [String] :fields_scorecard Return only specific fields in the included response for scorecard attributes. # @return [Array<(ListRulesResponse, Integer, Hash)>] ListRulesResponse data, response status code and response headers def list_scorecard_rules_with_http_info(opts = {}) - unstable_enabled = @api_client.config.unstable_operations["v2.list_scorecard_rules".to_sym] - if unstable_enabled - @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_scorecard_rules") - else - raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_scorecard_rules")) - end if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ServiceScorecardsAPI.list_scorecard_rules ...' + @api_client.config.logger.debug 'Calling API: ScorecardsAPI.list_scorecard_rules ...' end # resource path local_var_path = '/api/v2/scorecard/rules' @@ -428,7 +678,7 @@ def list_scorecard_rules_with_http_info(opts = {}) data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: ServiceScorecardsAPI#list_scorecard_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: ScorecardsAPI#list_scorecard_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end @@ -454,35 +704,171 @@ def list_scorecard_rules_with_pagination(opts = {}) end end - # Update Scorecard outcomes asynchronously. + # List all scorecards. + # + # @see #list_scorecards_with_http_info + def list_scorecards(opts = {}) + data, _status_code, _headers = list_scorecards_with_http_info(opts) + data + end + + # List all scorecards. + # + # Fetches all scorecards. + # + # @param opts [Hash] the optional parameters + # @option opts [Integer] :page_offset Offset for pagination. + # @option opts [Integer] :page_size Maximum number of scorecards to return. + # @option opts [String] :filter_scorecard_id Filter by scorecard ID. + # @option opts [String] :filter_scorecard_name Filter by scorecard name (partial match). + # @option opts [String] :filter_scorecard_description Filter by scorecard description (partial match). + # @return [Array<(ListScorecardsResponse, Integer, Hash)>] ListScorecardsResponse data, response status code and response headers + def list_scorecards_with_http_info(opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ScorecardsAPI.list_scorecards ...' + end + # resource path + local_var_path = '/api/v2/scorecard/scorecards' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil? + query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil? + query_params[:'filter[scorecard][id]'] = opts[:'filter_scorecard_id'] if !opts[:'filter_scorecard_id'].nil? + query_params[:'filter[scorecard][name]'] = opts[:'filter_scorecard_name'] if !opts[:'filter_scorecard_name'].nil? + query_params[:'filter[scorecard][description]'] = opts[:'filter_scorecard_description'] if !opts[:'filter_scorecard_description'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListScorecardsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_scorecards, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScorecardsAPI#list_scorecards\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a campaign. + # + # @see #update_scorecard_campaign_with_http_info + def update_scorecard_campaign(campaign_id, body, opts = {}) + data, _status_code, _headers = update_scorecard_campaign_with_http_info(campaign_id, body, opts) + data + end + + # Update a campaign. + # + # Updates an existing campaign. + # + # @param campaign_id [String] Campaign ID or key. + # @param body [UpdateCampaignRequest] Campaign data. + # @param opts [Hash] the optional parameters + # @return [Array<(CampaignResponse, Integer, Hash)>] CampaignResponse data, response status code and response headers + def update_scorecard_campaign_with_http_info(campaign_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ScorecardsAPI.update_scorecard_campaign ...' + end + # verify the required parameter 'campaign_id' is set + if @api_client.config.client_side_validation && campaign_id.nil? + fail ArgumentError, "Missing the required parameter 'campaign_id' when calling ScorecardsAPI.update_scorecard_campaign" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling ScorecardsAPI.update_scorecard_campaign" + end + # resource path + local_var_path = '/api/v2/scorecard/campaigns/{campaign_id}'.sub('{campaign_id}', CGI.escape(campaign_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'CampaignResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_scorecard_campaign, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ScorecardsAPI#update_scorecard_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update Scorecard outcomes. # - # @see #update_scorecard_outcomes_async_with_http_info - def update_scorecard_outcomes_async(body, opts = {}) - update_scorecard_outcomes_async_with_http_info(body, opts) + # @see #update_scorecard_outcomes_with_http_info + def update_scorecard_outcomes(body, opts = {}) + update_scorecard_outcomes_with_http_info(body, opts) nil end - # Update Scorecard outcomes asynchronously. + # Update Scorecard outcomes. # # Updates multiple scorecard rule outcomes in a single batched request. # # @param body [UpdateOutcomesAsyncRequest] Set of scorecard outcomes. # @param opts [Hash] the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers - def update_scorecard_outcomes_async_with_http_info(body, opts = {}) - unstable_enabled = @api_client.config.unstable_operations["v2.update_scorecard_outcomes_async".to_sym] - if unstable_enabled - @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_scorecard_outcomes_async") - else - raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_scorecard_outcomes_async")) - end + def update_scorecard_outcomes_with_http_info(body, opts = {}) if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ServiceScorecardsAPI.update_scorecard_outcomes_async ...' + @api_client.config.logger.debug 'Calling API: ScorecardsAPI.update_scorecard_outcomes ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? - fail ArgumentError, "Missing the required parameter 'body' when calling ServiceScorecardsAPI.update_scorecard_outcomes_async" + fail ArgumentError, "Missing the required parameter 'body' when calling ScorecardsAPI.update_scorecard_outcomes" end # resource path local_var_path = '/api/v2/scorecard/outcomes' @@ -510,7 +896,7 @@ def update_scorecard_outcomes_async_with_http_info(body, opts = {}) auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( - :operation => :update_scorecard_outcomes_async, + :operation => :update_scorecard_outcomes, :header_params => header_params, :query_params => query_params, :form_params => form_params, @@ -522,12 +908,12 @@ def update_scorecard_outcomes_async_with_http_info(body, opts = {}) data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: ServiceScorecardsAPI#update_scorecard_outcomes_async\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: ScorecardsAPI#update_scorecard_outcomes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end - # Update an existing rule. + # Update an existing scorecard rule. # # @see #update_scorecard_rule_with_http_info def update_scorecard_rule(rule_id, body, opts = {}) @@ -535,7 +921,7 @@ def update_scorecard_rule(rule_id, body, opts = {}) data end - # Update an existing rule. + # Update an existing scorecard rule. # # Updates an existing rule. # @@ -544,23 +930,17 @@ def update_scorecard_rule(rule_id, body, opts = {}) # @param opts [Hash] the optional parameters # @return [Array<(UpdateRuleResponse, Integer, Hash)>] UpdateRuleResponse data, response status code and response headers def update_scorecard_rule_with_http_info(rule_id, body, opts = {}) - unstable_enabled = @api_client.config.unstable_operations["v2.update_scorecard_rule".to_sym] - if unstable_enabled - @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_scorecard_rule") - else - raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_scorecard_rule")) - end if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ServiceScorecardsAPI.update_scorecard_rule ...' + @api_client.config.logger.debug 'Calling API: ScorecardsAPI.update_scorecard_rule ...' end # verify the required parameter 'rule_id' is set if @api_client.config.client_side_validation && rule_id.nil? - fail ArgumentError, "Missing the required parameter 'rule_id' when calling ServiceScorecardsAPI.update_scorecard_rule" + fail ArgumentError, "Missing the required parameter 'rule_id' when calling ScorecardsAPI.update_scorecard_rule" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? - fail ArgumentError, "Missing the required parameter 'body' when calling ServiceScorecardsAPI.update_scorecard_rule" + fail ArgumentError, "Missing the required parameter 'body' when calling ScorecardsAPI.update_scorecard_rule" end # resource path local_var_path = '/api/v2/scorecard/rules/{rule_id}'.sub('{rule_id}', CGI.escape(rule_id.to_s).gsub('%2F', '/')) @@ -600,7 +980,7 @@ def update_scorecard_rule_with_http_info(rule_id, body, opts = {}) data, status_code, headers = @api_client.call_api(Net::HTTP::Put, local_var_path, new_options) if @api_client.config.debugging - @api_client.config.logger.debug "API called: ServiceScorecardsAPI#update_scorecard_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + @api_client.config.logger.debug "API called: ScorecardsAPI#update_scorecard_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end diff --git a/lib/datadog_api_client/v2/models/campaign_response.rb b/lib/datadog_api_client/v2/models/campaign_response.rb new file mode 100644 index 000000000000..11f08c246bdf --- /dev/null +++ b/lib/datadog_api_client/v2/models/campaign_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing campaign data. + class CampaignResponse + include BaseGenericModel + + # Campaign data. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CampaignResponseData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CampaignResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/campaign_response_attributes.rb b/lib/datadog_api_client/v2/models/campaign_response_attributes.rb new file mode 100644 index 000000000000..ce333b32952c --- /dev/null +++ b/lib/datadog_api_client/v2/models/campaign_response_attributes.rb @@ -0,0 +1,289 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Campaign attributes. + class CampaignResponseAttributes + include BaseGenericModel + + # Creation time of the campaign. + attr_reader :created_at + + # The description of the campaign. + attr_accessor :description + + # The due date of the campaign. + attr_accessor :due_date + + # Entity scope query to filter entities for this campaign. + attr_accessor :entity_scope + + # Guidance for the campaign. + attr_accessor :guidance + + # The unique key for the campaign. + attr_reader :key + + # Time of last campaign modification. + attr_reader :modified_at + + # The name of the campaign. + attr_reader :name + + # The UUID of the campaign owner. + attr_reader :owner + + # The start date of the campaign. + attr_reader :start_date + + # The status of the campaign. + attr_reader :status + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_at' => :'created_at', + :'description' => :'description', + :'due_date' => :'due_date', + :'entity_scope' => :'entity_scope', + :'guidance' => :'guidance', + :'key' => :'key', + :'modified_at' => :'modified_at', + :'name' => :'name', + :'owner' => :'owner', + :'start_date' => :'start_date', + :'status' => :'status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_at' => :'Time', + :'description' => :'String', + :'due_date' => :'Time', + :'entity_scope' => :'String', + :'guidance' => :'String', + :'key' => :'String', + :'modified_at' => :'Time', + :'name' => :'String', + :'owner' => :'String', + :'start_date' => :'Time', + :'status' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CampaignResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'due_date') + self.due_date = attributes[:'due_date'] + end + + if attributes.key?(:'entity_scope') + self.entity_scope = attributes[:'entity_scope'] + end + + if attributes.key?(:'guidance') + self.guidance = attributes[:'guidance'] + end + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'modified_at') + self.modified_at = attributes[:'modified_at'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'owner') + self.owner = attributes[:'owner'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @created_at.nil? + return false if @key.nil? + return false if @modified_at.nil? + return false if @name.nil? + return false if @owner.nil? + return false if @start_date.nil? + return false if @status.nil? + true + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param key [Object] Object to be assigned + # @!visibility private + def key=(key) + if key.nil? + fail ArgumentError, 'invalid value for "key", key cannot be nil.' + end + @key = key + end + + # Custom attribute writer method with validation + # @param modified_at [Object] Object to be assigned + # @!visibility private + def modified_at=(modified_at) + if modified_at.nil? + fail ArgumentError, 'invalid value for "modified_at", modified_at cannot be nil.' + end + @modified_at = modified_at + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param owner [Object] Object to be assigned + # @!visibility private + def owner=(owner) + if owner.nil? + fail ArgumentError, 'invalid value for "owner", owner cannot be nil.' + end + @owner = owner + end + + # Custom attribute writer method with validation + # @param start_date [Object] Object to be assigned + # @!visibility private + def start_date=(start_date) + if start_date.nil? + fail ArgumentError, 'invalid value for "start_date", start_date cannot be nil.' + end + @start_date = start_date + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_at == o.created_at && + description == o.description && + due_date == o.due_date && + entity_scope == o.entity_scope && + guidance == o.guidance && + key == o.key && + modified_at == o.modified_at && + name == o.name && + owner == o.owner && + start_date == o.start_date && + status == o.status && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_at, description, due_date, entity_scope, guidance, key, modified_at, name, owner, start_date, status, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/campaign_response_data.rb b/lib/datadog_api_client/v2/models/campaign_response_data.rb new file mode 100644 index 000000000000..fbe06241eeb2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/campaign_response_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Campaign data. + class CampaignResponseData + include BaseGenericModel + + # Campaign attributes. + attr_reader :attributes + + # The unique ID of the campaign. + attr_reader :id + + # The JSON:API type for campaigns. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CampaignResponseAttributes', + :'id' => :'String', + :'type' => :'CampaignType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CampaignResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/campaign_status.rb b/lib/datadog_api_client/v2/models/campaign_status.rb new file mode 100644 index 000000000000..e0c87ef9311d --- /dev/null +++ b/lib/datadog_api_client/v2/models/campaign_status.rb @@ -0,0 +1,28 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The status of the campaign. + class CampaignStatus + include BaseEnumModel + + IN_PROGRESS = "in_progress".freeze + NOT_STARTED = "not_started".freeze + COMPLETED = "completed".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/campaign_type.rb b/lib/datadog_api_client/v2/models/campaign_type.rb new file mode 100644 index 000000000000..7fc87f03c39d --- /dev/null +++ b/lib/datadog_api_client/v2/models/campaign_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The JSON:API type for campaigns. + class CampaignType + include BaseEnumModel + + CAMPAIGN = "campaign".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/create_campaign_request.rb b/lib/datadog_api_client/v2/models/create_campaign_request.rb new file mode 100644 index 000000000000..8f75c5745cad --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_campaign_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request to create a new campaign. + class CreateCampaignRequest + include BaseGenericModel + + # Data for creating a new campaign. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'CreateCampaignRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreateCampaignRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_campaign_request_attributes.rb b/lib/datadog_api_client/v2/models/create_campaign_request_attributes.rb new file mode 100644 index 000000000000..f0ea0b600a93 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_campaign_request_attributes.rb @@ -0,0 +1,259 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for creating a new campaign. + class CreateCampaignRequestAttributes + include BaseGenericModel + + # The description of the campaign. + attr_accessor :description + + # The due date of the campaign. + attr_accessor :due_date + + # Entity scope query to filter entities for this campaign. + attr_accessor :entity_scope + + # Guidance for the campaign. + attr_accessor :guidance + + # The unique key for the campaign. + attr_reader :key + + # The name of the campaign. + attr_reader :name + + # The UUID of the campaign owner. + attr_reader :owner_id + + # Array of rule IDs associated with this campaign. + attr_reader :rule_ids + + # The start date of the campaign. + attr_reader :start_date + + # The status of the campaign. + attr_accessor :status + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'due_date' => :'due_date', + :'entity_scope' => :'entity_scope', + :'guidance' => :'guidance', + :'key' => :'key', + :'name' => :'name', + :'owner_id' => :'owner_id', + :'rule_ids' => :'rule_ids', + :'start_date' => :'start_date', + :'status' => :'status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'due_date' => :'Time', + :'entity_scope' => :'String', + :'guidance' => :'String', + :'key' => :'String', + :'name' => :'String', + :'owner_id' => :'String', + :'rule_ids' => :'Array', + :'start_date' => :'Time', + :'status' => :'CampaignStatus' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreateCampaignRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'due_date') + self.due_date = attributes[:'due_date'] + end + + if attributes.key?(:'entity_scope') + self.entity_scope = attributes[:'entity_scope'] + end + + if attributes.key?(:'guidance') + self.guidance = attributes[:'guidance'] + end + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'owner_id') + self.owner_id = attributes[:'owner_id'] + end + + if attributes.key?(:'rule_ids') + if (value = attributes[:'rule_ids']).is_a?(Array) + self.rule_ids = value + end + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @key.nil? + return false if @name.nil? + return false if @owner_id.nil? + return false if @rule_ids.nil? + return false if @start_date.nil? + true + end + + # Custom attribute writer method with validation + # @param key [Object] Object to be assigned + # @!visibility private + def key=(key) + if key.nil? + fail ArgumentError, 'invalid value for "key", key cannot be nil.' + end + @key = key + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param owner_id [Object] Object to be assigned + # @!visibility private + def owner_id=(owner_id) + if owner_id.nil? + fail ArgumentError, 'invalid value for "owner_id", owner_id cannot be nil.' + end + @owner_id = owner_id + end + + # Custom attribute writer method with validation + # @param rule_ids [Object] Object to be assigned + # @!visibility private + def rule_ids=(rule_ids) + if rule_ids.nil? + fail ArgumentError, 'invalid value for "rule_ids", rule_ids cannot be nil.' + end + @rule_ids = rule_ids + end + + # Custom attribute writer method with validation + # @param start_date [Object] Object to be assigned + # @!visibility private + def start_date=(start_date) + if start_date.nil? + fail ArgumentError, 'invalid value for "start_date", start_date cannot be nil.' + end + @start_date = start_date + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + due_date == o.due_date && + entity_scope == o.entity_scope && + guidance == o.guidance && + key == o.key && + name == o.name && + owner_id == o.owner_id && + rule_ids == o.rule_ids && + start_date == o.start_date && + status == o.status && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, due_date, entity_scope, guidance, key, name, owner_id, rule_ids, start_date, status, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_campaign_request_data.rb b/lib/datadog_api_client/v2/models/create_campaign_request_data.rb new file mode 100644 index 000000000000..624d259cc11e --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_campaign_request_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data for creating a new campaign. + class CreateCampaignRequestData + include BaseGenericModel + + # Attributes for creating a new campaign. + attr_reader :attributes + + # The JSON:API type for campaigns. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'CreateCampaignRequestAttributes', + :'type' => :'CampaignType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreateCampaignRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_rule_request_data.rb b/lib/datadog_api_client/v2/models/create_rule_request_data.rb index cc4f5a486329..b11ec121861e 100644 --- a/lib/datadog_api_client/v2/models/create_rule_request_data.rb +++ b/lib/datadog_api_client/v2/models/create_rule_request_data.rb @@ -21,7 +21,7 @@ module DatadogAPIClient::V2 class CreateRuleRequestData include BaseGenericModel - # Details of a rule. + # Attributes for creating or updating a rule. Server-managed fields (created_at, modified_at, custom) are excluded. attr_accessor :attributes # The JSON:API type for scorecard rules. @@ -42,7 +42,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'attributes' => :'RuleAttributes', + :'attributes' => :'RuleAttributesRequest', :'type' => :'RuleType' } end diff --git a/lib/datadog_api_client/v2/models/list_campaigns_response.rb b/lib/datadog_api_client/v2/models/list_campaigns_response.rb new file mode 100644 index 000000000000..6c3cecb46d20 --- /dev/null +++ b/lib/datadog_api_client/v2/models/list_campaigns_response.rb @@ -0,0 +1,146 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a list of campaigns. + class ListCampaignsResponse + include BaseGenericModel + + # Array of campaigns. + attr_reader :data + + # Metadata for scores response. + attr_reader :meta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'meta' => :'PaginatedResponseMeta' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ListCampaignsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + return false if @meta.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Custom attribute writer method with validation + # @param meta [Object] Object to be assigned + # @!visibility private + def meta=(meta) + if meta.nil? + fail ArgumentError, 'invalid value for "meta", meta cannot be nil.' + end + @meta = meta + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + meta == o.meta && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, meta, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/list_scorecards_response.rb b/lib/datadog_api_client/v2/models/list_scorecards_response.rb new file mode 100644 index 000000000000..84320d61fd31 --- /dev/null +++ b/lib/datadog_api_client/v2/models/list_scorecards_response.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a list of scorecards. + class ListScorecardsResponse + include BaseGenericModel + + # Array of scorecards. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ListScorecardsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/paginated_response_meta.rb b/lib/datadog_api_client/v2/models/paginated_response_meta.rb new file mode 100644 index 000000000000..ebd135586ae3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/paginated_response_meta.rb @@ -0,0 +1,186 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Metadata for scores response. + class PaginatedResponseMeta + include BaseGenericModel + + # Number of entities in this response. + attr_reader :count + + # Pagination limit. + attr_reader :limit + + # Pagination offset. + attr_reader :offset + + # Total number of entities available. + attr_reader :total + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'count' => :'count', + :'limit' => :'limit', + :'offset' => :'offset', + :'total' => :'total' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'count' => :'Integer', + :'limit' => :'Integer', + :'offset' => :'Integer', + :'total' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::PaginatedResponseMeta` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'count') + self.count = attributes[:'count'] + end + + if attributes.key?(:'limit') + self.limit = attributes[:'limit'] + end + + if attributes.key?(:'offset') + self.offset = attributes[:'offset'] + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @count.nil? + return false if @limit.nil? + return false if @offset.nil? + return false if @total.nil? + true + end + + # Custom attribute writer method with validation + # @param count [Object] Object to be assigned + # @!visibility private + def count=(count) + if count.nil? + fail ArgumentError, 'invalid value for "count", count cannot be nil.' + end + @count = count + end + + # Custom attribute writer method with validation + # @param limit [Object] Object to be assigned + # @!visibility private + def limit=(limit) + if limit.nil? + fail ArgumentError, 'invalid value for "limit", limit cannot be nil.' + end + @limit = limit + end + + # Custom attribute writer method with validation + # @param offset [Object] Object to be assigned + # @!visibility private + def offset=(offset) + if offset.nil? + fail ArgumentError, 'invalid value for "offset", offset cannot be nil.' + end + @offset = offset + end + + # Custom attribute writer method with validation + # @param total [Object] Object to be assigned + # @!visibility private + def total=(total) + if total.nil? + fail ArgumentError, 'invalid value for "total", total cannot be nil.' + end + @total = total + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + count == o.count && + limit == o.limit && + offset == o.offset && + total == o.total && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [count, limit, offset, total, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rule_attributes.rb b/lib/datadog_api_client/v2/models/rule_attributes.rb index 15a41060681b..ba1b57178a77 100644 --- a/lib/datadog_api_client/v2/models/rule_attributes.rb +++ b/lib/datadog_api_client/v2/models/rule_attributes.rb @@ -48,6 +48,9 @@ class RuleAttributes # Owner of the rule. attr_accessor :owner + # A query to filter which entities this rule applies to. + attr_accessor :scope_query + # The scorecard name to which this rule must belong. attr_accessor :scorecard_name @@ -66,6 +69,7 @@ def self.attribute_map :'modified_at' => :'modified_at', :'name' => :'name', :'owner' => :'owner', + :'scope_query' => :'scope_query', :'scorecard_name' => :'scorecard_name' } end @@ -83,6 +87,7 @@ def self.openapi_types :'modified_at' => :'Time', :'name' => :'String', :'owner' => :'String', + :'scope_query' => :'String', :'scorecard_name' => :'String' } end @@ -141,6 +146,10 @@ def initialize(attributes = {}) self.owner = attributes[:'owner'] end + if attributes.key?(:'scope_query') + self.scope_query = attributes[:'scope_query'] + end + if attributes.key?(:'scorecard_name') self.scorecard_name = attributes[:'scorecard_name'] end @@ -203,6 +212,7 @@ def ==(o) modified_at == o.modified_at && name == o.name && owner == o.owner && + scope_query == o.scope_query && scorecard_name == o.scorecard_name && additional_properties == o.additional_properties end @@ -211,7 +221,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [category, created_at, custom, description, enabled, level, modified_at, name, owner, scorecard_name, additional_properties].hash + [category, created_at, custom, description, enabled, level, modified_at, name, owner, scope_query, scorecard_name, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/rule_attributes_request.rb b/lib/datadog_api_client/v2/models/rule_attributes_request.rb new file mode 100644 index 000000000000..23e9f0258fc7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rule_attributes_request.rb @@ -0,0 +1,187 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for creating or updating a rule. Server-managed fields (created_at, modified_at, custom) are excluded. + class RuleAttributesRequest + include BaseGenericModel + + # Explanation of the rule. + attr_accessor :description + + # If enabled, the rule is calculated as part of the score. + attr_accessor :enabled + + # The maturity level of the rule (1, 2, or 3). + attr_reader :level + + # Name of the rule. + attr_accessor :name + + # Owner of the rule. + attr_accessor :owner + + # A query to filter which entities this rule applies to. + attr_accessor :scope_query + + # The scorecard name to which this rule must belong. + attr_accessor :scorecard_name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'enabled' => :'enabled', + :'level' => :'level', + :'name' => :'name', + :'owner' => :'owner', + :'scope_query' => :'scope_query', + :'scorecard_name' => :'scorecard_name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'enabled' => :'Boolean', + :'level' => :'Integer', + :'name' => :'String', + :'owner' => :'String', + :'scope_query' => :'String', + :'scorecard_name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RuleAttributesRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'level') + self.level = attributes[:'level'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'owner') + self.owner = attributes[:'owner'] + end + + if attributes.key?(:'scope_query') + self.scope_query = attributes[:'scope_query'] + end + + if attributes.key?(:'scorecard_name') + self.scorecard_name = attributes[:'scorecard_name'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if !@level.nil? && @level > 3 + return false if !@level.nil? && @level < 1 + true + end + + # Custom attribute writer method with validation + # @param level [Object] Object to be assigned + # @!visibility private + def level=(level) + if !level.nil? && level > 3 + fail ArgumentError, 'invalid value for "level", must be smaller than or equal to 3.' + end + if !level.nil? && level < 1 + fail ArgumentError, 'invalid value for "level", must be greater than or equal to 1.' + end + @level = level + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + enabled == o.enabled && + level == o.level && + name == o.name && + owner == o.owner && + scope_query == o.scope_query && + scorecard_name == o.scorecard_name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, enabled, level, name, owner, scope_query, scorecard_name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/scorecard_list_response_attributes.rb b/lib/datadog_api_client/v2/models/scorecard_list_response_attributes.rb new file mode 100644 index 000000000000..3c3af966bcb6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/scorecard_list_response_attributes.rb @@ -0,0 +1,175 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Scorecard attributes. + class ScorecardListResponseAttributes + include BaseGenericModel + + # Creation time of the scorecard. + attr_reader :created_at + + # The description of the scorecard. + attr_accessor :description + + # Time of last scorecard modification. + attr_reader :modified_at + + # The name of the scorecard. + attr_reader :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_at' => :'created_at', + :'description' => :'description', + :'modified_at' => :'modified_at', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_at' => :'Time', + :'description' => :'String', + :'modified_at' => :'Time', + :'name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScorecardListResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'modified_at') + self.modified_at = attributes[:'modified_at'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @created_at.nil? + return false if @modified_at.nil? + return false if @name.nil? + true + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param modified_at [Object] Object to be assigned + # @!visibility private + def modified_at=(modified_at) + if modified_at.nil? + fail ArgumentError, 'invalid value for "modified_at", modified_at cannot be nil.' + end + @modified_at = modified_at + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_at == o.created_at && + description == o.description && + modified_at == o.modified_at && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_at, description, modified_at, name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/scorecard_list_response_data.rb b/lib/datadog_api_client/v2/models/scorecard_list_response_data.rb new file mode 100644 index 000000000000..d91c980b37dd --- /dev/null +++ b/lib/datadog_api_client/v2/models/scorecard_list_response_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Scorecard data. + class ScorecardListResponseData + include BaseGenericModel + + # Scorecard attributes. + attr_reader :attributes + + # The unique ID of the scorecard. + attr_reader :id + + # The JSON:API type for scorecard list. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ScorecardListResponseAttributes', + :'id' => :'String', + :'type' => :'ScorecardListType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ScorecardListResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/scorecard_list_type.rb b/lib/datadog_api_client/v2/models/scorecard_list_type.rb new file mode 100644 index 000000000000..887c6824dc52 --- /dev/null +++ b/lib/datadog_api_client/v2/models/scorecard_list_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The JSON:API type for scorecard list. + class ScorecardListType + include BaseEnumModel + + SCORECARD = "scorecard".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/update_campaign_request.rb b/lib/datadog_api_client/v2/models/update_campaign_request.rb new file mode 100644 index 000000000000..c8cdc281aaba --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_campaign_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request to update a campaign. + class UpdateCampaignRequest + include BaseGenericModel + + # Data for updating a campaign. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'UpdateCampaignRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::UpdateCampaignRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_campaign_request_attributes.rb b/lib/datadog_api_client/v2/models/update_campaign_request_attributes.rb new file mode 100644 index 000000000000..defcd1b7087f --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_campaign_request_attributes.rb @@ -0,0 +1,259 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for updating a campaign. + class UpdateCampaignRequestAttributes + include BaseGenericModel + + # The description of the campaign. + attr_accessor :description + + # The due date of the campaign. + attr_accessor :due_date + + # Entity scope query to filter entities for this campaign. + attr_accessor :entity_scope + + # Guidance for the campaign. + attr_accessor :guidance + + # The unique key for the campaign. + attr_accessor :key + + # The name of the campaign. + attr_reader :name + + # The UUID of the campaign owner. + attr_reader :owner_id + + # Array of rule IDs associated with this campaign. + attr_reader :rule_ids + + # The start date of the campaign. + attr_reader :start_date + + # The status of the campaign. + attr_reader :status + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'description' => :'description', + :'due_date' => :'due_date', + :'entity_scope' => :'entity_scope', + :'guidance' => :'guidance', + :'key' => :'key', + :'name' => :'name', + :'owner_id' => :'owner_id', + :'rule_ids' => :'rule_ids', + :'start_date' => :'start_date', + :'status' => :'status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'description' => :'String', + :'due_date' => :'Time', + :'entity_scope' => :'String', + :'guidance' => :'String', + :'key' => :'String', + :'name' => :'String', + :'owner_id' => :'String', + :'rule_ids' => :'Array', + :'start_date' => :'Time', + :'status' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::UpdateCampaignRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'due_date') + self.due_date = attributes[:'due_date'] + end + + if attributes.key?(:'entity_scope') + self.entity_scope = attributes[:'entity_scope'] + end + + if attributes.key?(:'guidance') + self.guidance = attributes[:'guidance'] + end + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'owner_id') + self.owner_id = attributes[:'owner_id'] + end + + if attributes.key?(:'rule_ids') + if (value = attributes[:'rule_ids']).is_a?(Array) + self.rule_ids = value + end + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @name.nil? + return false if @owner_id.nil? + return false if @rule_ids.nil? + return false if @start_date.nil? + return false if @status.nil? + true + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param owner_id [Object] Object to be assigned + # @!visibility private + def owner_id=(owner_id) + if owner_id.nil? + fail ArgumentError, 'invalid value for "owner_id", owner_id cannot be nil.' + end + @owner_id = owner_id + end + + # Custom attribute writer method with validation + # @param rule_ids [Object] Object to be assigned + # @!visibility private + def rule_ids=(rule_ids) + if rule_ids.nil? + fail ArgumentError, 'invalid value for "rule_ids", rule_ids cannot be nil.' + end + @rule_ids = rule_ids + end + + # Custom attribute writer method with validation + # @param start_date [Object] Object to be assigned + # @!visibility private + def start_date=(start_date) + if start_date.nil? + fail ArgumentError, 'invalid value for "start_date", start_date cannot be nil.' + end + @start_date = start_date + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + description == o.description && + due_date == o.due_date && + entity_scope == o.entity_scope && + guidance == o.guidance && + key == o.key && + name == o.name && + owner_id == o.owner_id && + rule_ids == o.rule_ids && + start_date == o.start_date && + status == o.status && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [description, due_date, entity_scope, guidance, key, name, owner_id, rule_ids, start_date, status, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_campaign_request_data.rb b/lib/datadog_api_client/v2/models/update_campaign_request_data.rb new file mode 100644 index 000000000000..703916fb25c7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/update_campaign_request_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data for updating a campaign. + class UpdateCampaignRequestData + include BaseGenericModel + + # Attributes for updating a campaign. + attr_reader :attributes + + # The JSON:API type for campaigns. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'UpdateCampaignRequestAttributes', + :'type' => :'CampaignType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::UpdateCampaignRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/update_rule_request_data.rb b/lib/datadog_api_client/v2/models/update_rule_request_data.rb index 3863db42fdbf..20bbcffa3dc8 100644 --- a/lib/datadog_api_client/v2/models/update_rule_request_data.rb +++ b/lib/datadog_api_client/v2/models/update_rule_request_data.rb @@ -21,7 +21,7 @@ module DatadogAPIClient::V2 class UpdateRuleRequestData include BaseGenericModel - # Details of a rule. + # Attributes for creating or updating a rule. Server-managed fields (created_at, modified_at, custom) are excluded. attr_accessor :attributes # The JSON:API type for scorecard rules. @@ -42,7 +42,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'attributes' => :'RuleAttributes', + :'attributes' => :'RuleAttributesRequest', :'type' => :'RuleType' } end