diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml
index e83df8269e5..45c7a5c5909 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/api/datadog/configuration.go b/api/datadog/configuration.go
index 1996ac0a07e..8bdd59c23a6 100644
--- a/api/datadog/configuration.go
+++ b/api/datadog/configuration.go
@@ -849,12 +849,6 @@ func NewConfiguration() *Configuration {
"v2.QueryUsers": false,
"v2.UpdateConnection": false,
"v2.CreateScorecardOutcomesBatch": false,
- "v2.CreateScorecardRule": false,
- "v2.DeleteScorecardRule": false,
- "v2.ListScorecardOutcomes": false,
- "v2.ListScorecardRules": false,
- "v2.UpdateScorecardOutcomesAsync": false,
- "v2.UpdateScorecardRule": false,
"v2.ListEntityRiskScores": false,
"v2.CreateIncidentService": false,
"v2.DeleteIncidentService": false,
diff --git a/api/datadogV2/api_service_scorecards.go b/api/datadogV2/api_scorecards.go
similarity index 53%
rename from api/datadogV2/api_service_scorecards.go
rename to api/datadogV2/api_scorecards.go
index 3eb36640662..21900259c74 100644
--- a/api/datadogV2/api_service_scorecards.go
+++ b/api/datadogV2/api_scorecards.go
@@ -14,12 +14,103 @@ import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)
-// ServiceScorecardsApi service type
-type ServiceScorecardsApi datadog.Service
+// ScorecardsApi service type
+type ScorecardsApi datadog.Service
+
+// CreateScorecardCampaign Create a new campaign.
+// Creates a new scorecard campaign.
+func (a *ScorecardsApi) CreateScorecardCampaign(ctx _context.Context, body CreateCampaignRequest) (CampaignResponse, *_nethttp.Response, error) {
+ var (
+ localVarHTTPMethod = _nethttp.MethodPost
+ localVarPostBody interface{}
+ localVarReturnValue CampaignResponse
+ )
+
+ localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ScorecardsApi.CreateScorecardCampaign")
+ if err != nil {
+ return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
+ }
+
+ localVarPath := localBasePath + "/api/v2/scorecard/campaigns"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := _neturl.Values{}
+ localVarFormParams := _neturl.Values{}
+ localVarHeaderParams["Content-Type"] = "application/json"
+ localVarHeaderParams["Accept"] = "application/json"
+
+ // body params
+ localVarPostBody = &body
+ if a.Client.Cfg.DelegatedTokenConfig != nil {
+ err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+ } else {
+ datadog.SetAuthKeys(
+ ctx,
+ &localVarHeaderParams,
+ [2]string{"apiKeyAuth", "DD-API-KEY"},
+ [2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
+ )
+ }
+ req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHTTPResponse, err := a.Client.CallAPI(req)
+ if err != nil || localVarHTTPResponse == nil {
+ return localVarReturnValue, localVarHTTPResponse, err
+ }
+
+ localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
+ if err != nil {
+ return localVarReturnValue, localVarHTTPResponse, err
+ }
+
+ if localVarHTTPResponse.StatusCode >= 300 {
+ newErr := datadog.GenericOpenAPIError{
+ ErrorBody: localVarBody,
+ ErrorMessage: localVarHTTPResponse.Status,
+ }
+ if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 {
+ var v JSONAPIErrorResponse
+ err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ newErr.ErrorModel = v
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ if localVarHTTPResponse.StatusCode == 429 {
+ var v APIErrorResponse
+ err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ newErr.ErrorModel = v
+ }
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+
+ err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := datadog.GenericOpenAPIError{
+ ErrorBody: localVarBody,
+ ErrorMessage: err.Error(),
+ }
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHTTPResponse, nil
+}
// CreateScorecardOutcomesBatch Create outcomes batch.
// Sets multiple service-rule outcomes in a single batched request.
-func (a *ServiceScorecardsApi) CreateScorecardOutcomesBatch(ctx _context.Context, body OutcomesBatchRequest) (OutcomesBatchResponse, *_nethttp.Response, error) {
+//
+// Deprecated: This API is deprecated.
+func (a *ScorecardsApi) CreateScorecardOutcomesBatch(ctx _context.Context, body OutcomesBatchRequest) (OutcomesBatchResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
@@ -35,7 +126,7 @@ func (a *ServiceScorecardsApi) CreateScorecardOutcomesBatch(ctx _context.Context
_log.Printf("WARNING: Using unstable operation '%s'", operationId)
}
- localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ServiceScorecardsApi.CreateScorecardOutcomesBatch")
+ localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ScorecardsApi.CreateScorecardOutcomesBatch")
if err != nil {
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}
@@ -108,23 +199,14 @@ func (a *ServiceScorecardsApi) CreateScorecardOutcomesBatch(ctx _context.Context
// CreateScorecardRule Create a new rule.
// Creates a new rule.
-func (a *ServiceScorecardsApi) CreateScorecardRule(ctx _context.Context, body CreateRuleRequest) (CreateRuleResponse, *_nethttp.Response, error) {
+func (a *ScorecardsApi) CreateScorecardRule(ctx _context.Context, body CreateRuleRequest) (CreateRuleResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarReturnValue CreateRuleResponse
)
- operationId := "v2.CreateScorecardRule"
- isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
- if !isOperationEnabled {
- return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
- }
- if isOperationEnabled && a.Client.Cfg.Debug {
- _log.Printf("WARNING: Using unstable operation '%s'", operationId)
- }
-
- localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ServiceScorecardsApi.CreateScorecardRule")
+ localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ScorecardsApi.CreateScorecardRule")
if err != nil {
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}
@@ -195,24 +277,92 @@ func (a *ServiceScorecardsApi) CreateScorecardRule(ctx _context.Context, body Cr
return localVarReturnValue, localVarHTTPResponse, nil
}
-// DeleteScorecardRule Delete a rule.
-// Deletes a single rule.
-func (a *ServiceScorecardsApi) DeleteScorecardRule(ctx _context.Context, ruleId string) (*_nethttp.Response, error) {
+// DeleteScorecardCampaign Delete a campaign.
+// Deletes a single campaign by ID or key.
+func (a *ScorecardsApi) DeleteScorecardCampaign(ctx _context.Context, campaignId string) (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodDelete
localVarPostBody interface{}
)
- operationId := "v2.DeleteScorecardRule"
- isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
- if !isOperationEnabled {
- return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
+ localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ScorecardsApi.DeleteScorecardCampaign")
+ if err != nil {
+ return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}
- if isOperationEnabled && a.Client.Cfg.Debug {
- _log.Printf("WARNING: Using unstable operation '%s'", operationId)
+
+ localVarPath := localBasePath + "/api/v2/scorecard/campaigns/{campaign_id}"
+ localVarPath = datadog.ReplacePathParameter(localVarPath, "{campaign_id}", _neturl.PathEscape(datadog.ParameterToString(campaignId, "")))
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := _neturl.Values{}
+ localVarFormParams := _neturl.Values{}
+ localVarHeaderParams["Accept"] = "*/*"
+
+ if a.Client.Cfg.DelegatedTokenConfig != nil {
+ err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
+ if err != nil {
+ return nil, err
+ }
+ } else {
+ datadog.SetAuthKeys(
+ ctx,
+ &localVarHeaderParams,
+ [2]string{"apiKeyAuth", "DD-API-KEY"},
+ [2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
+ )
+ }
+ req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHTTPResponse, err := a.Client.CallAPI(req)
+ if err != nil || localVarHTTPResponse == nil {
+ return localVarHTTPResponse, err
+ }
+
+ localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
+ if err != nil {
+ return localVarHTTPResponse, err
+ }
+
+ if localVarHTTPResponse.StatusCode >= 300 {
+ newErr := datadog.GenericOpenAPIError{
+ ErrorBody: localVarBody,
+ ErrorMessage: localVarHTTPResponse.Status,
+ }
+ if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 {
+ var v JSONAPIErrorResponse
+ err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ return localVarHTTPResponse, newErr
+ }
+ newErr.ErrorModel = v
+ return localVarHTTPResponse, newErr
+ }
+ if localVarHTTPResponse.StatusCode == 429 {
+ var v APIErrorResponse
+ err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ return localVarHTTPResponse, newErr
+ }
+ newErr.ErrorModel = v
+ }
+ return localVarHTTPResponse, newErr
}
- localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ServiceScorecardsApi.DeleteScorecardRule")
+ return localVarHTTPResponse, nil
+}
+
+// DeleteScorecardRule Delete a rule.
+// Deletes a single rule.
+func (a *ScorecardsApi) DeleteScorecardRule(ctx _context.Context, ruleId string) (*_nethttp.Response, error) {
+ var (
+ localVarHTTPMethod = _nethttp.MethodDelete
+ localVarPostBody interface{}
+ )
+
+ localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ScorecardsApi.DeleteScorecardRule")
if err != nil {
return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}
@@ -228,7 +378,268 @@ func (a *ServiceScorecardsApi) DeleteScorecardRule(ctx _context.Context, ruleId
if a.Client.Cfg.DelegatedTokenConfig != nil {
err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
if err != nil {
- return nil, err
+ return nil, err
+ }
+ } else {
+ datadog.SetAuthKeys(
+ ctx,
+ &localVarHeaderParams,
+ [2]string{"apiKeyAuth", "DD-API-KEY"},
+ [2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
+ )
+ }
+ req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
+ if err != nil {
+ return nil, err
+ }
+
+ localVarHTTPResponse, err := a.Client.CallAPI(req)
+ if err != nil || localVarHTTPResponse == nil {
+ return localVarHTTPResponse, err
+ }
+
+ localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
+ if err != nil {
+ return localVarHTTPResponse, err
+ }
+
+ if localVarHTTPResponse.StatusCode >= 300 {
+ newErr := datadog.GenericOpenAPIError{
+ ErrorBody: localVarBody,
+ ErrorMessage: localVarHTTPResponse.Status,
+ }
+ if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {
+ var v APIErrorResponse
+ err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ return localVarHTTPResponse, newErr
+ }
+ newErr.ErrorModel = v
+ }
+ return localVarHTTPResponse, newErr
+ }
+
+ return localVarHTTPResponse, nil
+}
+
+// GetScorecardCampaignOptionalParameters holds optional parameters for GetScorecardCampaign.
+type GetScorecardCampaignOptionalParameters struct {
+ Include *string
+ IncludeMeta *bool
+}
+
+// NewGetScorecardCampaignOptionalParameters creates an empty struct for parameters.
+func NewGetScorecardCampaignOptionalParameters() *GetScorecardCampaignOptionalParameters {
+ this := GetScorecardCampaignOptionalParameters{}
+ return &this
+}
+
+// WithInclude sets the corresponding parameter name and returns the struct.
+func (r *GetScorecardCampaignOptionalParameters) WithInclude(include string) *GetScorecardCampaignOptionalParameters {
+ r.Include = &include
+ return r
+}
+
+// WithIncludeMeta sets the corresponding parameter name and returns the struct.
+func (r *GetScorecardCampaignOptionalParameters) WithIncludeMeta(includeMeta bool) *GetScorecardCampaignOptionalParameters {
+ r.IncludeMeta = &includeMeta
+ return r
+}
+
+// GetScorecardCampaign Get a campaign.
+// Fetches a single campaign by ID or key.
+func (a *ScorecardsApi) GetScorecardCampaign(ctx _context.Context, campaignId string, o ...GetScorecardCampaignOptionalParameters) (CampaignResponse, *_nethttp.Response, error) {
+ var (
+ localVarHTTPMethod = _nethttp.MethodGet
+ localVarPostBody interface{}
+ localVarReturnValue CampaignResponse
+ optionalParams GetScorecardCampaignOptionalParameters
+ )
+
+ if len(o) > 1 {
+ return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetScorecardCampaignOptionalParameters is allowed")
+ }
+ if len(o) == 1 {
+ optionalParams = o[0]
+ }
+
+ localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ScorecardsApi.GetScorecardCampaign")
+ if err != nil {
+ return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
+ }
+
+ localVarPath := localBasePath + "/api/v2/scorecard/campaigns/{campaign_id}"
+ localVarPath = datadog.ReplacePathParameter(localVarPath, "{campaign_id}", _neturl.PathEscape(datadog.ParameterToString(campaignId, "")))
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := _neturl.Values{}
+ localVarFormParams := _neturl.Values{}
+ if optionalParams.Include != nil {
+ localVarQueryParams.Add("include", datadog.ParameterToString(*optionalParams.Include, ""))
+ }
+ if optionalParams.IncludeMeta != nil {
+ localVarQueryParams.Add("include_meta", datadog.ParameterToString(*optionalParams.IncludeMeta, ""))
+ }
+ localVarHeaderParams["Accept"] = "application/json"
+
+ if a.Client.Cfg.DelegatedTokenConfig != nil {
+ err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+ } else {
+ datadog.SetAuthKeys(
+ ctx,
+ &localVarHeaderParams,
+ [2]string{"apiKeyAuth", "DD-API-KEY"},
+ [2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
+ )
+ }
+ req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHTTPResponse, err := a.Client.CallAPI(req)
+ if err != nil || localVarHTTPResponse == nil {
+ return localVarReturnValue, localVarHTTPResponse, err
+ }
+
+ localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
+ if err != nil {
+ return localVarReturnValue, localVarHTTPResponse, err
+ }
+
+ if localVarHTTPResponse.StatusCode >= 300 {
+ newErr := datadog.GenericOpenAPIError{
+ ErrorBody: localVarBody,
+ ErrorMessage: localVarHTTPResponse.Status,
+ }
+ if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 {
+ var v JSONAPIErrorResponse
+ err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ newErr.ErrorModel = v
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ if localVarHTTPResponse.StatusCode == 429 {
+ var v APIErrorResponse
+ err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ newErr.ErrorModel = v
+ }
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+
+ err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := datadog.GenericOpenAPIError{
+ ErrorBody: localVarBody,
+ ErrorMessage: err.Error(),
+ }
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHTTPResponse, nil
+}
+
+// ListScorecardCampaignsOptionalParameters holds optional parameters for ListScorecardCampaigns.
+type ListScorecardCampaignsOptionalParameters struct {
+ PageLimit *int64
+ PageOffset *int64
+ FilterCampaignName *string
+ FilterCampaignStatus *string
+ FilterCampaignOwner *string
+}
+
+// NewListScorecardCampaignsOptionalParameters creates an empty struct for parameters.
+func NewListScorecardCampaignsOptionalParameters() *ListScorecardCampaignsOptionalParameters {
+ this := ListScorecardCampaignsOptionalParameters{}
+ return &this
+}
+
+// WithPageLimit sets the corresponding parameter name and returns the struct.
+func (r *ListScorecardCampaignsOptionalParameters) WithPageLimit(pageLimit int64) *ListScorecardCampaignsOptionalParameters {
+ r.PageLimit = &pageLimit
+ return r
+}
+
+// WithPageOffset sets the corresponding parameter name and returns the struct.
+func (r *ListScorecardCampaignsOptionalParameters) WithPageOffset(pageOffset int64) *ListScorecardCampaignsOptionalParameters {
+ r.PageOffset = &pageOffset
+ return r
+}
+
+// WithFilterCampaignName sets the corresponding parameter name and returns the struct.
+func (r *ListScorecardCampaignsOptionalParameters) WithFilterCampaignName(filterCampaignName string) *ListScorecardCampaignsOptionalParameters {
+ r.FilterCampaignName = &filterCampaignName
+ return r
+}
+
+// WithFilterCampaignStatus sets the corresponding parameter name and returns the struct.
+func (r *ListScorecardCampaignsOptionalParameters) WithFilterCampaignStatus(filterCampaignStatus string) *ListScorecardCampaignsOptionalParameters {
+ r.FilterCampaignStatus = &filterCampaignStatus
+ return r
+}
+
+// WithFilterCampaignOwner sets the corresponding parameter name and returns the struct.
+func (r *ListScorecardCampaignsOptionalParameters) WithFilterCampaignOwner(filterCampaignOwner string) *ListScorecardCampaignsOptionalParameters {
+ r.FilterCampaignOwner = &filterCampaignOwner
+ return r
+}
+
+// ListScorecardCampaigns List all campaigns.
+// Fetches all scorecard campaigns.
+func (a *ScorecardsApi) ListScorecardCampaigns(ctx _context.Context, o ...ListScorecardCampaignsOptionalParameters) (ListCampaignsResponse, *_nethttp.Response, error) {
+ var (
+ localVarHTTPMethod = _nethttp.MethodGet
+ localVarPostBody interface{}
+ localVarReturnValue ListCampaignsResponse
+ optionalParams ListScorecardCampaignsOptionalParameters
+ )
+
+ if len(o) > 1 {
+ return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListScorecardCampaignsOptionalParameters is allowed")
+ }
+ if len(o) == 1 {
+ optionalParams = o[0]
+ }
+
+ localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ScorecardsApi.ListScorecardCampaigns")
+ if err != nil {
+ return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
+ }
+
+ localVarPath := localBasePath + "/api/v2/scorecard/campaigns"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := _neturl.Values{}
+ localVarFormParams := _neturl.Values{}
+ if optionalParams.PageLimit != nil {
+ localVarQueryParams.Add("page[limit]", datadog.ParameterToString(*optionalParams.PageLimit, ""))
+ }
+ if optionalParams.PageOffset != nil {
+ localVarQueryParams.Add("page[offset]", datadog.ParameterToString(*optionalParams.PageOffset, ""))
+ }
+ if optionalParams.FilterCampaignName != nil {
+ localVarQueryParams.Add("filter[campaign][name]", datadog.ParameterToString(*optionalParams.FilterCampaignName, ""))
+ }
+ if optionalParams.FilterCampaignStatus != nil {
+ localVarQueryParams.Add("filter[campaign][status]", datadog.ParameterToString(*optionalParams.FilterCampaignStatus, ""))
+ }
+ if optionalParams.FilterCampaignOwner != nil {
+ localVarQueryParams.Add("filter[campaign][owner]", datadog.ParameterToString(*optionalParams.FilterCampaignOwner, ""))
+ }
+ localVarHeaderParams["Accept"] = "application/json"
+
+ if a.Client.Cfg.DelegatedTokenConfig != nil {
+ err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
+ if err != nil {
+ return localVarReturnValue, nil, err
}
} else {
datadog.SetAuthKeys(
@@ -240,17 +651,17 @@ func (a *ServiceScorecardsApi) DeleteScorecardRule(ctx _context.Context, ruleId
}
req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
if err != nil {
- return nil, err
+ return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.Client.CallAPI(req)
if err != nil || localVarHTTPResponse == nil {
- return localVarHTTPResponse, err
+ return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
if err != nil {
- return localVarHTTPResponse, err
+ return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
@@ -258,18 +669,36 @@ func (a *ServiceScorecardsApi) DeleteScorecardRule(ctx _context.Context, ruleId
ErrorBody: localVarBody,
ErrorMessage: localVarHTTPResponse.Status,
}
- if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 {
+ if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 {
+ var v JSONAPIErrorResponse
+ err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ newErr.ErrorModel = v
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ if localVarHTTPResponse.StatusCode == 429 {
var v APIErrorResponse
err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
- return localVarHTTPResponse, newErr
+ return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.ErrorModel = v
}
- return localVarHTTPResponse, newErr
+ return localVarReturnValue, localVarHTTPResponse, newErr
}
- return localVarHTTPResponse, nil
+ err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := datadog.GenericOpenAPIError{
+ ErrorBody: localVarBody,
+ ErrorMessage: err.Error(),
+ }
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHTTPResponse, nil
}
// ListScorecardOutcomesOptionalParameters holds optional parameters for ListScorecardOutcomes.
@@ -354,7 +783,7 @@ func (r *ListScorecardOutcomesOptionalParameters) WithFilterRuleName(filterRuleN
// ListScorecardOutcomes List all rule outcomes.
// Fetches all rule outcomes.
-func (a *ServiceScorecardsApi) ListScorecardOutcomes(ctx _context.Context, o ...ListScorecardOutcomesOptionalParameters) (OutcomesResponse, *_nethttp.Response, error) {
+func (a *ScorecardsApi) ListScorecardOutcomes(ctx _context.Context, o ...ListScorecardOutcomesOptionalParameters) (OutcomesResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@@ -369,16 +798,7 @@ func (a *ServiceScorecardsApi) ListScorecardOutcomes(ctx _context.Context, o ...
optionalParams = o[0]
}
- operationId := "v2.ListScorecardOutcomes"
- isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
- if !isOperationEnabled {
- return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
- }
- if isOperationEnabled && a.Client.Cfg.Debug {
- _log.Printf("WARNING: Using unstable operation '%s'", operationId)
- }
-
- localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ServiceScorecardsApi.ListScorecardOutcomes")
+ localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ScorecardsApi.ListScorecardOutcomes")
if err != nil {
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}
@@ -477,7 +897,7 @@ func (a *ServiceScorecardsApi) ListScorecardOutcomes(ctx _context.Context, o ...
}
// ListScorecardOutcomesWithPagination provides a paginated version of ListScorecardOutcomes returning a channel with all items.
-func (a *ServiceScorecardsApi) ListScorecardOutcomesWithPagination(ctx _context.Context, o ...ListScorecardOutcomesOptionalParameters) (<-chan datadog.PaginationResult[OutcomesResponseDataItem], func()) {
+func (a *ScorecardsApi) ListScorecardOutcomesWithPagination(ctx _context.Context, o ...ListScorecardOutcomesOptionalParameters) (<-chan datadog.PaginationResult[OutcomesResponseDataItem], func()) {
ctx, cancel := _context.WithCancel(ctx)
pageSize_ := int64(10)
if len(o) == 0 {
@@ -608,7 +1028,7 @@ func (r *ListScorecardRulesOptionalParameters) WithFieldsScorecard(fieldsScoreca
// ListScorecardRules List all rules.
// Fetch all rules.
-func (a *ServiceScorecardsApi) ListScorecardRules(ctx _context.Context, o ...ListScorecardRulesOptionalParameters) (ListRulesResponse, *_nethttp.Response, error) {
+func (a *ScorecardsApi) ListScorecardRules(ctx _context.Context, o ...ListScorecardRulesOptionalParameters) (ListRulesResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
@@ -623,16 +1043,7 @@ func (a *ServiceScorecardsApi) ListScorecardRules(ctx _context.Context, o ...Lis
optionalParams = o[0]
}
- operationId := "v2.ListScorecardRules"
- isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
- if !isOperationEnabled {
- return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
- }
- if isOperationEnabled && a.Client.Cfg.Debug {
- _log.Printf("WARNING: Using unstable operation '%s'", operationId)
- }
-
- localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ServiceScorecardsApi.ListScorecardRules")
+ localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ScorecardsApi.ListScorecardRules")
if err != nil {
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}
@@ -731,7 +1142,7 @@ func (a *ServiceScorecardsApi) ListScorecardRules(ctx _context.Context, o ...Lis
}
// ListScorecardRulesWithPagination provides a paginated version of ListScorecardRules returning a channel with all items.
-func (a *ServiceScorecardsApi) ListScorecardRulesWithPagination(ctx _context.Context, o ...ListScorecardRulesOptionalParameters) (<-chan datadog.PaginationResult[ListRulesResponseDataItem], func()) {
+func (a *ScorecardsApi) ListScorecardRulesWithPagination(ctx _context.Context, o ...ListScorecardRulesOptionalParameters) (<-chan datadog.PaginationResult[ListRulesResponseDataItem], func()) {
ctx, cancel := _context.WithCancel(ctx)
pageSize_ := int64(10)
if len(o) == 0 {
@@ -780,24 +1191,259 @@ func (a *ServiceScorecardsApi) ListScorecardRulesWithPagination(ctx _context.Con
return items, cancel
}
-// UpdateScorecardOutcomesAsync Update Scorecard outcomes asynchronously.
-// Updates multiple scorecard rule outcomes in a single batched request.
-func (a *ServiceScorecardsApi) UpdateScorecardOutcomesAsync(ctx _context.Context, body UpdateOutcomesAsyncRequest) (*_nethttp.Response, error) {
+// ListScorecardsOptionalParameters holds optional parameters for ListScorecards.
+type ListScorecardsOptionalParameters struct {
+ PageOffset *int64
+ PageSize *int64
+ FilterScorecardId *string
+ FilterScorecardName *string
+ FilterScorecardDescription *string
+}
+
+// NewListScorecardsOptionalParameters creates an empty struct for parameters.
+func NewListScorecardsOptionalParameters() *ListScorecardsOptionalParameters {
+ this := ListScorecardsOptionalParameters{}
+ return &this
+}
+
+// WithPageOffset sets the corresponding parameter name and returns the struct.
+func (r *ListScorecardsOptionalParameters) WithPageOffset(pageOffset int64) *ListScorecardsOptionalParameters {
+ r.PageOffset = &pageOffset
+ return r
+}
+
+// WithPageSize sets the corresponding parameter name and returns the struct.
+func (r *ListScorecardsOptionalParameters) WithPageSize(pageSize int64) *ListScorecardsOptionalParameters {
+ r.PageSize = &pageSize
+ return r
+}
+
+// WithFilterScorecardId sets the corresponding parameter name and returns the struct.
+func (r *ListScorecardsOptionalParameters) WithFilterScorecardId(filterScorecardId string) *ListScorecardsOptionalParameters {
+ r.FilterScorecardId = &filterScorecardId
+ return r
+}
+
+// WithFilterScorecardName sets the corresponding parameter name and returns the struct.
+func (r *ListScorecardsOptionalParameters) WithFilterScorecardName(filterScorecardName string) *ListScorecardsOptionalParameters {
+ r.FilterScorecardName = &filterScorecardName
+ return r
+}
+
+// WithFilterScorecardDescription sets the corresponding parameter name and returns the struct.
+func (r *ListScorecardsOptionalParameters) WithFilterScorecardDescription(filterScorecardDescription string) *ListScorecardsOptionalParameters {
+ r.FilterScorecardDescription = &filterScorecardDescription
+ return r
+}
+
+// ListScorecards List all scorecards.
+// Fetches all scorecards.
+func (a *ScorecardsApi) ListScorecards(ctx _context.Context, o ...ListScorecardsOptionalParameters) (ListScorecardsResponse, *_nethttp.Response, error) {
var (
- localVarHTTPMethod = _nethttp.MethodPost
- localVarPostBody interface{}
+ localVarHTTPMethod = _nethttp.MethodGet
+ localVarPostBody interface{}
+ localVarReturnValue ListScorecardsResponse
+ optionalParams ListScorecardsOptionalParameters
)
- operationId := "v2.UpdateScorecardOutcomesAsync"
- isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
- if !isOperationEnabled {
- return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
+ if len(o) > 1 {
+ return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListScorecardsOptionalParameters is allowed")
}
- if isOperationEnabled && a.Client.Cfg.Debug {
- _log.Printf("WARNING: Using unstable operation '%s'", operationId)
+ if len(o) == 1 {
+ optionalParams = o[0]
+ }
+
+ localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ScorecardsApi.ListScorecards")
+ if err != nil {
+ return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
+ }
+
+ localVarPath := localBasePath + "/api/v2/scorecard/scorecards"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := _neturl.Values{}
+ localVarFormParams := _neturl.Values{}
+ if optionalParams.PageOffset != nil {
+ localVarQueryParams.Add("page[offset]", datadog.ParameterToString(*optionalParams.PageOffset, ""))
+ }
+ if optionalParams.PageSize != nil {
+ localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, ""))
+ }
+ if optionalParams.FilterScorecardId != nil {
+ localVarQueryParams.Add("filter[scorecard][id]", datadog.ParameterToString(*optionalParams.FilterScorecardId, ""))
+ }
+ if optionalParams.FilterScorecardName != nil {
+ localVarQueryParams.Add("filter[scorecard][name]", datadog.ParameterToString(*optionalParams.FilterScorecardName, ""))
+ }
+ if optionalParams.FilterScorecardDescription != nil {
+ localVarQueryParams.Add("filter[scorecard][description]", datadog.ParameterToString(*optionalParams.FilterScorecardDescription, ""))
+ }
+ localVarHeaderParams["Accept"] = "application/json"
+
+ if a.Client.Cfg.DelegatedTokenConfig != nil {
+ err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+ } else {
+ datadog.SetAuthKeys(
+ ctx,
+ &localVarHeaderParams,
+ [2]string{"apiKeyAuth", "DD-API-KEY"},
+ [2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
+ )
+ }
+ req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHTTPResponse, err := a.Client.CallAPI(req)
+ if err != nil || localVarHTTPResponse == nil {
+ return localVarReturnValue, localVarHTTPResponse, err
+ }
+
+ localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
+ if err != nil {
+ return localVarReturnValue, localVarHTTPResponse, err
+ }
+
+ if localVarHTTPResponse.StatusCode >= 300 {
+ newErr := datadog.GenericOpenAPIError{
+ ErrorBody: localVarBody,
+ ErrorMessage: localVarHTTPResponse.Status,
+ }
+ if localVarHTTPResponse.StatusCode == 403 {
+ var v JSONAPIErrorResponse
+ err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ newErr.ErrorModel = v
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ if localVarHTTPResponse.StatusCode == 429 {
+ var v APIErrorResponse
+ err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ newErr.ErrorModel = v
+ }
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+
+ err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := datadog.GenericOpenAPIError{
+ ErrorBody: localVarBody,
+ ErrorMessage: err.Error(),
+ }
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHTTPResponse, nil
+}
+
+// UpdateScorecardCampaign Update a campaign.
+// Updates an existing campaign.
+func (a *ScorecardsApi) UpdateScorecardCampaign(ctx _context.Context, campaignId string, body UpdateCampaignRequest) (CampaignResponse, *_nethttp.Response, error) {
+ var (
+ localVarHTTPMethod = _nethttp.MethodPut
+ localVarPostBody interface{}
+ localVarReturnValue CampaignResponse
+ )
+
+ localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ScorecardsApi.UpdateScorecardCampaign")
+ if err != nil {
+ return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
+ }
+
+ localVarPath := localBasePath + "/api/v2/scorecard/campaigns/{campaign_id}"
+ localVarPath = datadog.ReplacePathParameter(localVarPath, "{campaign_id}", _neturl.PathEscape(datadog.ParameterToString(campaignId, "")))
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := _neturl.Values{}
+ localVarFormParams := _neturl.Values{}
+ localVarHeaderParams["Content-Type"] = "application/json"
+ localVarHeaderParams["Accept"] = "application/json"
+
+ // body params
+ localVarPostBody = &body
+ if a.Client.Cfg.DelegatedTokenConfig != nil {
+ err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+ } else {
+ datadog.SetAuthKeys(
+ ctx,
+ &localVarHeaderParams,
+ [2]string{"apiKeyAuth", "DD-API-KEY"},
+ [2]string{"appKeyAuth", "DD-APPLICATION-KEY"},
+ )
+ }
+ req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHTTPResponse, err := a.Client.CallAPI(req)
+ if err != nil || localVarHTTPResponse == nil {
+ return localVarReturnValue, localVarHTTPResponse, err
+ }
+
+ localVarBody, err := datadog.ReadBody(localVarHTTPResponse)
+ if err != nil {
+ return localVarReturnValue, localVarHTTPResponse, err
+ }
+
+ if localVarHTTPResponse.StatusCode >= 300 {
+ newErr := datadog.GenericOpenAPIError{
+ ErrorBody: localVarBody,
+ ErrorMessage: localVarHTTPResponse.Status,
+ }
+ if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 {
+ var v JSONAPIErrorResponse
+ err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ newErr.ErrorModel = v
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ if localVarHTTPResponse.StatusCode == 429 {
+ var v APIErrorResponse
+ err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ newErr.ErrorModel = v
+ }
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+
+ err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := datadog.GenericOpenAPIError{
+ ErrorBody: localVarBody,
+ ErrorMessage: err.Error(),
+ }
+ return localVarReturnValue, localVarHTTPResponse, newErr
}
- localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ServiceScorecardsApi.UpdateScorecardOutcomesAsync")
+ return localVarReturnValue, localVarHTTPResponse, nil
+}
+
+// UpdateScorecardOutcomes Update Scorecard outcomes.
+// Updates multiple scorecard rule outcomes in a single batched request.
+func (a *ScorecardsApi) UpdateScorecardOutcomes(ctx _context.Context, body UpdateOutcomesAsyncRequest) (*_nethttp.Response, error) {
+ var (
+ localVarHTTPMethod = _nethttp.MethodPost
+ localVarPostBody interface{}
+ )
+
+ localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ScorecardsApi.UpdateScorecardOutcomes")
if err != nil {
return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}
@@ -859,25 +1505,16 @@ func (a *ServiceScorecardsApi) UpdateScorecardOutcomesAsync(ctx _context.Context
return localVarHTTPResponse, nil
}
-// UpdateScorecardRule Update an existing rule.
+// UpdateScorecardRule Update an existing scorecard rule.
// Updates an existing rule.
-func (a *ServiceScorecardsApi) UpdateScorecardRule(ctx _context.Context, ruleId string, body UpdateRuleRequest) (UpdateRuleResponse, *_nethttp.Response, error) {
+func (a *ScorecardsApi) UpdateScorecardRule(ctx _context.Context, ruleId string, body UpdateRuleRequest) (UpdateRuleResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarReturnValue UpdateRuleResponse
)
- operationId := "v2.UpdateScorecardRule"
- isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
- if !isOperationEnabled {
- return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
- }
- if isOperationEnabled && a.Client.Cfg.Debug {
- _log.Printf("WARNING: Using unstable operation '%s'", operationId)
- }
-
- localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ServiceScorecardsApi.UpdateScorecardRule")
+ localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.ScorecardsApi.UpdateScorecardRule")
if err != nil {
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
}
@@ -949,9 +1586,9 @@ func (a *ServiceScorecardsApi) UpdateScorecardRule(ctx _context.Context, ruleId
return localVarReturnValue, localVarHTTPResponse, nil
}
-// NewServiceScorecardsApi Returns NewServiceScorecardsApi.
-func NewServiceScorecardsApi(client *datadog.APIClient) *ServiceScorecardsApi {
- return &ServiceScorecardsApi{
+// NewScorecardsApi Returns NewScorecardsApi.
+func NewScorecardsApi(client *datadog.APIClient) *ScorecardsApi {
+ return &ScorecardsApi{
Client: client,
}
}
diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go
index 824455a0c79..630a7535de0 100644
--- a/api/datadogV2/doc.go
+++ b/api/datadogV2/doc.go
@@ -671,6 +671,19 @@
// - [RumRetentionFiltersApi.ListRetentionFilters]
// - [RumRetentionFiltersApi.OrderRetentionFilters]
// - [RumRetentionFiltersApi.UpdateRetentionFilter]
+// - [ScorecardsApi.CreateScorecardCampaign]
+// - [ScorecardsApi.CreateScorecardOutcomesBatch]
+// - [ScorecardsApi.CreateScorecardRule]
+// - [ScorecardsApi.DeleteScorecardCampaign]
+// - [ScorecardsApi.DeleteScorecardRule]
+// - [ScorecardsApi.GetScorecardCampaign]
+// - [ScorecardsApi.ListScorecardCampaigns]
+// - [ScorecardsApi.ListScorecardOutcomes]
+// - [ScorecardsApi.ListScorecardRules]
+// - [ScorecardsApi.ListScorecards]
+// - [ScorecardsApi.UpdateScorecardCampaign]
+// - [ScorecardsApi.UpdateScorecardOutcomes]
+// - [ScorecardsApi.UpdateScorecardRule]
// - [SeatsApi.AssignSeatsUser]
// - [SeatsApi.GetSeatsUsers]
// - [SeatsApi.UnassignSeatsUser]
@@ -783,13 +796,6 @@
// - [ServiceLevelObjectivesApi.GetSLOReport]
// - [ServiceLevelObjectivesApi.GetSLOReportJobStatus]
// - [ServiceLevelObjectivesApi.GetSloStatus]
-// - [ServiceScorecardsApi.CreateScorecardOutcomesBatch]
-// - [ServiceScorecardsApi.CreateScorecardRule]
-// - [ServiceScorecardsApi.DeleteScorecardRule]
-// - [ServiceScorecardsApi.ListScorecardOutcomes]
-// - [ServiceScorecardsApi.ListScorecardRules]
-// - [ServiceScorecardsApi.UpdateScorecardOutcomesAsync]
-// - [ServiceScorecardsApi.UpdateScorecardRule]
// - [ServiceNowIntegrationApi.CreateServiceNowTemplate]
// - [ServiceNowIntegrationApi.DeleteServiceNowTemplate]
// - [ServiceNowIntegrationApi.GetServiceNowTemplate]
diff --git a/api/datadogV2/model_campaign_response.go b/api/datadogV2/model_campaign_response.go
new file mode 100644
index 00000000000..85f38925ba5
--- /dev/null
+++ b/api/datadogV2/model_campaign_response.go
@@ -0,0 +1,110 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// CampaignResponse Response containing campaign data.
+type CampaignResponse struct {
+ // Campaign data.
+ Data CampaignResponseData `json:"data"`
+ // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
+ UnparsedObject map[string]interface{} `json:"-"`
+ AdditionalProperties map[string]interface{} `json:"-"`
+}
+
+// NewCampaignResponse instantiates a new CampaignResponse object.
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed.
+func NewCampaignResponse(data CampaignResponseData) *CampaignResponse {
+ this := CampaignResponse{}
+ this.Data = data
+ return &this
+}
+
+// NewCampaignResponseWithDefaults instantiates a new CampaignResponse object.
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set.
+func NewCampaignResponseWithDefaults() *CampaignResponse {
+ this := CampaignResponse{}
+ return &this
+}
+
+// GetData returns the Data field value.
+func (o *CampaignResponse) GetData() CampaignResponseData {
+ if o == nil {
+ var ret CampaignResponseData
+ return ret
+ }
+ return o.Data
+}
+
+// GetDataOk returns a tuple with the Data field value
+// and a boolean to check if the value has been set.
+func (o *CampaignResponse) GetDataOk() (*CampaignResponseData, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Data, true
+}
+
+// SetData sets field value.
+func (o *CampaignResponse) SetData(v CampaignResponseData) {
+ o.Data = v
+}
+
+// MarshalJSON serializes the struct using spec logic.
+func (o CampaignResponse) MarshalJSON() ([]byte, error) {
+ toSerialize := map[string]interface{}{}
+ if o.UnparsedObject != nil {
+ return datadog.Marshal(o.UnparsedObject)
+ }
+ toSerialize["data"] = o.Data
+
+ for key, value := range o.AdditionalProperties {
+ toSerialize[key] = value
+ }
+ return datadog.Marshal(toSerialize)
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (o *CampaignResponse) UnmarshalJSON(bytes []byte) (err error) {
+ all := struct {
+ Data *CampaignResponseData `json:"data"`
+ }{}
+ if err = datadog.Unmarshal(bytes, &all); err != nil {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+ if all.Data == nil {
+ return fmt.Errorf("required field data missing")
+ }
+ additionalProperties := make(map[string]interface{})
+ if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
+ datadog.DeleteKeys(additionalProperties, &[]string{"data"})
+ } else {
+ return err
+ }
+
+ hasInvalidField := false
+ if all.Data.UnparsedObject != nil && o.UnparsedObject == nil {
+ hasInvalidField = true
+ }
+ o.Data = *all.Data
+
+ if len(additionalProperties) > 0 {
+ o.AdditionalProperties = additionalProperties
+ }
+
+ if hasInvalidField {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+
+ return nil
+}
diff --git a/api/datadogV2/model_campaign_response_attributes.go b/api/datadogV2/model_campaign_response_attributes.go
new file mode 100644
index 00000000000..5461cba7f27
--- /dev/null
+++ b/api/datadogV2/model_campaign_response_attributes.go
@@ -0,0 +1,450 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+ "time"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// CampaignResponseAttributes Campaign attributes.
+type CampaignResponseAttributes struct {
+ // Creation time of the campaign.
+ CreatedAt time.Time `json:"created_at"`
+ // The description of the campaign.
+ Description *string `json:"description,omitempty"`
+ // The due date of the campaign.
+ DueDate *time.Time `json:"due_date,omitempty"`
+ // Entity scope query to filter entities for this campaign.
+ EntityScope *string `json:"entity_scope,omitempty"`
+ // Guidance for the campaign.
+ Guidance *string `json:"guidance,omitempty"`
+ // The unique key for the campaign.
+ Key string `json:"key"`
+ // Time of last campaign modification.
+ ModifiedAt time.Time `json:"modified_at"`
+ // The name of the campaign.
+ Name string `json:"name"`
+ // The UUID of the campaign owner.
+ Owner string `json:"owner"`
+ // The start date of the campaign.
+ StartDate time.Time `json:"start_date"`
+ // The status of the campaign.
+ Status string `json:"status"`
+ // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
+ UnparsedObject map[string]interface{} `json:"-"`
+ AdditionalProperties map[string]interface{} `json:"-"`
+}
+
+// NewCampaignResponseAttributes instantiates a new CampaignResponseAttributes object.
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed.
+func NewCampaignResponseAttributes(createdAt time.Time, key string, modifiedAt time.Time, name string, owner string, startDate time.Time, status string) *CampaignResponseAttributes {
+ this := CampaignResponseAttributes{}
+ this.CreatedAt = createdAt
+ this.Key = key
+ this.ModifiedAt = modifiedAt
+ this.Name = name
+ this.Owner = owner
+ this.StartDate = startDate
+ this.Status = status
+ return &this
+}
+
+// NewCampaignResponseAttributesWithDefaults instantiates a new CampaignResponseAttributes object.
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set.
+func NewCampaignResponseAttributesWithDefaults() *CampaignResponseAttributes {
+ this := CampaignResponseAttributes{}
+ return &this
+}
+
+// GetCreatedAt returns the CreatedAt field value.
+func (o *CampaignResponseAttributes) GetCreatedAt() time.Time {
+ if o == nil {
+ var ret time.Time
+ return ret
+ }
+ return o.CreatedAt
+}
+
+// GetCreatedAtOk returns a tuple with the CreatedAt field value
+// and a boolean to check if the value has been set.
+func (o *CampaignResponseAttributes) GetCreatedAtOk() (*time.Time, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.CreatedAt, true
+}
+
+// SetCreatedAt sets field value.
+func (o *CampaignResponseAttributes) SetCreatedAt(v time.Time) {
+ o.CreatedAt = v
+}
+
+// GetDescription returns the Description field value if set, zero value otherwise.
+func (o *CampaignResponseAttributes) GetDescription() string {
+ if o == nil || o.Description == nil {
+ var ret string
+ return ret
+ }
+ return *o.Description
+}
+
+// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *CampaignResponseAttributes) GetDescriptionOk() (*string, bool) {
+ if o == nil || o.Description == nil {
+ return nil, false
+ }
+ return o.Description, true
+}
+
+// HasDescription returns a boolean if a field has been set.
+func (o *CampaignResponseAttributes) HasDescription() bool {
+ return o != nil && o.Description != nil
+}
+
+// SetDescription gets a reference to the given string and assigns it to the Description field.
+func (o *CampaignResponseAttributes) SetDescription(v string) {
+ o.Description = &v
+}
+
+// GetDueDate returns the DueDate field value if set, zero value otherwise.
+func (o *CampaignResponseAttributes) GetDueDate() time.Time {
+ if o == nil || o.DueDate == nil {
+ var ret time.Time
+ return ret
+ }
+ return *o.DueDate
+}
+
+// GetDueDateOk returns a tuple with the DueDate field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *CampaignResponseAttributes) GetDueDateOk() (*time.Time, bool) {
+ if o == nil || o.DueDate == nil {
+ return nil, false
+ }
+ return o.DueDate, true
+}
+
+// HasDueDate returns a boolean if a field has been set.
+func (o *CampaignResponseAttributes) HasDueDate() bool {
+ return o != nil && o.DueDate != nil
+}
+
+// SetDueDate gets a reference to the given time.Time and assigns it to the DueDate field.
+func (o *CampaignResponseAttributes) SetDueDate(v time.Time) {
+ o.DueDate = &v
+}
+
+// GetEntityScope returns the EntityScope field value if set, zero value otherwise.
+func (o *CampaignResponseAttributes) GetEntityScope() string {
+ if o == nil || o.EntityScope == nil {
+ var ret string
+ return ret
+ }
+ return *o.EntityScope
+}
+
+// GetEntityScopeOk returns a tuple with the EntityScope field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *CampaignResponseAttributes) GetEntityScopeOk() (*string, bool) {
+ if o == nil || o.EntityScope == nil {
+ return nil, false
+ }
+ return o.EntityScope, true
+}
+
+// HasEntityScope returns a boolean if a field has been set.
+func (o *CampaignResponseAttributes) HasEntityScope() bool {
+ return o != nil && o.EntityScope != nil
+}
+
+// SetEntityScope gets a reference to the given string and assigns it to the EntityScope field.
+func (o *CampaignResponseAttributes) SetEntityScope(v string) {
+ o.EntityScope = &v
+}
+
+// GetGuidance returns the Guidance field value if set, zero value otherwise.
+func (o *CampaignResponseAttributes) GetGuidance() string {
+ if o == nil || o.Guidance == nil {
+ var ret string
+ return ret
+ }
+ return *o.Guidance
+}
+
+// GetGuidanceOk returns a tuple with the Guidance field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *CampaignResponseAttributes) GetGuidanceOk() (*string, bool) {
+ if o == nil || o.Guidance == nil {
+ return nil, false
+ }
+ return o.Guidance, true
+}
+
+// HasGuidance returns a boolean if a field has been set.
+func (o *CampaignResponseAttributes) HasGuidance() bool {
+ return o != nil && o.Guidance != nil
+}
+
+// SetGuidance gets a reference to the given string and assigns it to the Guidance field.
+func (o *CampaignResponseAttributes) SetGuidance(v string) {
+ o.Guidance = &v
+}
+
+// GetKey returns the Key field value.
+func (o *CampaignResponseAttributes) GetKey() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+ return o.Key
+}
+
+// GetKeyOk returns a tuple with the Key field value
+// and a boolean to check if the value has been set.
+func (o *CampaignResponseAttributes) GetKeyOk() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Key, true
+}
+
+// SetKey sets field value.
+func (o *CampaignResponseAttributes) SetKey(v string) {
+ o.Key = v
+}
+
+// GetModifiedAt returns the ModifiedAt field value.
+func (o *CampaignResponseAttributes) GetModifiedAt() time.Time {
+ if o == nil {
+ var ret time.Time
+ return ret
+ }
+ return o.ModifiedAt
+}
+
+// GetModifiedAtOk returns a tuple with the ModifiedAt field value
+// and a boolean to check if the value has been set.
+func (o *CampaignResponseAttributes) GetModifiedAtOk() (*time.Time, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.ModifiedAt, true
+}
+
+// SetModifiedAt sets field value.
+func (o *CampaignResponseAttributes) SetModifiedAt(v time.Time) {
+ o.ModifiedAt = v
+}
+
+// GetName returns the Name field value.
+func (o *CampaignResponseAttributes) GetName() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+ return o.Name
+}
+
+// GetNameOk returns a tuple with the Name field value
+// and a boolean to check if the value has been set.
+func (o *CampaignResponseAttributes) GetNameOk() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Name, true
+}
+
+// SetName sets field value.
+func (o *CampaignResponseAttributes) SetName(v string) {
+ o.Name = v
+}
+
+// GetOwner returns the Owner field value.
+func (o *CampaignResponseAttributes) GetOwner() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+ return o.Owner
+}
+
+// GetOwnerOk returns a tuple with the Owner field value
+// and a boolean to check if the value has been set.
+func (o *CampaignResponseAttributes) GetOwnerOk() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Owner, true
+}
+
+// SetOwner sets field value.
+func (o *CampaignResponseAttributes) SetOwner(v string) {
+ o.Owner = v
+}
+
+// GetStartDate returns the StartDate field value.
+func (o *CampaignResponseAttributes) GetStartDate() time.Time {
+ if o == nil {
+ var ret time.Time
+ return ret
+ }
+ return o.StartDate
+}
+
+// GetStartDateOk returns a tuple with the StartDate field value
+// and a boolean to check if the value has been set.
+func (o *CampaignResponseAttributes) GetStartDateOk() (*time.Time, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.StartDate, true
+}
+
+// SetStartDate sets field value.
+func (o *CampaignResponseAttributes) SetStartDate(v time.Time) {
+ o.StartDate = v
+}
+
+// GetStatus returns the Status field value.
+func (o *CampaignResponseAttributes) GetStatus() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+ return o.Status
+}
+
+// GetStatusOk returns a tuple with the Status field value
+// and a boolean to check if the value has been set.
+func (o *CampaignResponseAttributes) GetStatusOk() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Status, true
+}
+
+// SetStatus sets field value.
+func (o *CampaignResponseAttributes) SetStatus(v string) {
+ o.Status = v
+}
+
+// MarshalJSON serializes the struct using spec logic.
+func (o CampaignResponseAttributes) MarshalJSON() ([]byte, error) {
+ toSerialize := map[string]interface{}{}
+ if o.UnparsedObject != nil {
+ return datadog.Marshal(o.UnparsedObject)
+ }
+ if o.CreatedAt.Nanosecond() == 0 {
+ toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00")
+ } else {
+ toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00")
+ }
+ if o.Description != nil {
+ toSerialize["description"] = o.Description
+ }
+ if o.DueDate != nil {
+ if o.DueDate.Nanosecond() == 0 {
+ toSerialize["due_date"] = o.DueDate.Format("2006-01-02T15:04:05Z07:00")
+ } else {
+ toSerialize["due_date"] = o.DueDate.Format("2006-01-02T15:04:05.000Z07:00")
+ }
+ }
+ if o.EntityScope != nil {
+ toSerialize["entity_scope"] = o.EntityScope
+ }
+ if o.Guidance != nil {
+ toSerialize["guidance"] = o.Guidance
+ }
+ toSerialize["key"] = o.Key
+ if o.ModifiedAt.Nanosecond() == 0 {
+ toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00")
+ } else {
+ toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00")
+ }
+ toSerialize["name"] = o.Name
+ toSerialize["owner"] = o.Owner
+ if o.StartDate.Nanosecond() == 0 {
+ toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05Z07:00")
+ } else {
+ toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05.000Z07:00")
+ }
+ toSerialize["status"] = o.Status
+
+ for key, value := range o.AdditionalProperties {
+ toSerialize[key] = value
+ }
+ return datadog.Marshal(toSerialize)
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (o *CampaignResponseAttributes) UnmarshalJSON(bytes []byte) (err error) {
+ all := struct {
+ CreatedAt *time.Time `json:"created_at"`
+ Description *string `json:"description,omitempty"`
+ DueDate *time.Time `json:"due_date,omitempty"`
+ EntityScope *string `json:"entity_scope,omitempty"`
+ Guidance *string `json:"guidance,omitempty"`
+ Key *string `json:"key"`
+ ModifiedAt *time.Time `json:"modified_at"`
+ Name *string `json:"name"`
+ Owner *string `json:"owner"`
+ StartDate *time.Time `json:"start_date"`
+ Status *string `json:"status"`
+ }{}
+ if err = datadog.Unmarshal(bytes, &all); err != nil {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+ if all.CreatedAt == nil {
+ return fmt.Errorf("required field created_at missing")
+ }
+ if all.Key == nil {
+ return fmt.Errorf("required field key missing")
+ }
+ if all.ModifiedAt == nil {
+ return fmt.Errorf("required field modified_at missing")
+ }
+ if all.Name == nil {
+ return fmt.Errorf("required field name missing")
+ }
+ if all.Owner == nil {
+ return fmt.Errorf("required field owner missing")
+ }
+ if all.StartDate == nil {
+ return fmt.Errorf("required field start_date missing")
+ }
+ if all.Status == nil {
+ return fmt.Errorf("required field status missing")
+ }
+ additionalProperties := make(map[string]interface{})
+ if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
+ datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "description", "due_date", "entity_scope", "guidance", "key", "modified_at", "name", "owner", "start_date", "status"})
+ } else {
+ return err
+ }
+ o.CreatedAt = *all.CreatedAt
+ o.Description = all.Description
+ o.DueDate = all.DueDate
+ o.EntityScope = all.EntityScope
+ o.Guidance = all.Guidance
+ o.Key = *all.Key
+ o.ModifiedAt = *all.ModifiedAt
+ o.Name = *all.Name
+ o.Owner = *all.Owner
+ o.StartDate = *all.StartDate
+ o.Status = *all.Status
+
+ if len(additionalProperties) > 0 {
+ o.AdditionalProperties = additionalProperties
+ }
+
+ return nil
+}
diff --git a/api/datadogV2/model_campaign_response_data.go b/api/datadogV2/model_campaign_response_data.go
new file mode 100644
index 00000000000..828991aa0fb
--- /dev/null
+++ b/api/datadogV2/model_campaign_response_data.go
@@ -0,0 +1,178 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// CampaignResponseData Campaign data.
+type CampaignResponseData struct {
+ // Campaign attributes.
+ Attributes CampaignResponseAttributes `json:"attributes"`
+ // The unique ID of the campaign.
+ Id string `json:"id"`
+ // The JSON:API type for campaigns.
+ Type CampaignType `json:"type"`
+ // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
+ UnparsedObject map[string]interface{} `json:"-"`
+ AdditionalProperties map[string]interface{} `json:"-"`
+}
+
+// NewCampaignResponseData instantiates a new CampaignResponseData object.
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed.
+func NewCampaignResponseData(attributes CampaignResponseAttributes, id string, typeVar CampaignType) *CampaignResponseData {
+ this := CampaignResponseData{}
+ this.Attributes = attributes
+ this.Id = id
+ this.Type = typeVar
+ return &this
+}
+
+// NewCampaignResponseDataWithDefaults instantiates a new CampaignResponseData object.
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set.
+func NewCampaignResponseDataWithDefaults() *CampaignResponseData {
+ this := CampaignResponseData{}
+ return &this
+}
+
+// GetAttributes returns the Attributes field value.
+func (o *CampaignResponseData) GetAttributes() CampaignResponseAttributes {
+ if o == nil {
+ var ret CampaignResponseAttributes
+ return ret
+ }
+ return o.Attributes
+}
+
+// GetAttributesOk returns a tuple with the Attributes field value
+// and a boolean to check if the value has been set.
+func (o *CampaignResponseData) GetAttributesOk() (*CampaignResponseAttributes, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Attributes, true
+}
+
+// SetAttributes sets field value.
+func (o *CampaignResponseData) SetAttributes(v CampaignResponseAttributes) {
+ o.Attributes = v
+}
+
+// GetId returns the Id field value.
+func (o *CampaignResponseData) GetId() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+ return o.Id
+}
+
+// GetIdOk returns a tuple with the Id field value
+// and a boolean to check if the value has been set.
+func (o *CampaignResponseData) GetIdOk() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Id, true
+}
+
+// SetId sets field value.
+func (o *CampaignResponseData) SetId(v string) {
+ o.Id = v
+}
+
+// GetType returns the Type field value.
+func (o *CampaignResponseData) GetType() CampaignType {
+ if o == nil {
+ var ret CampaignType
+ return ret
+ }
+ return o.Type
+}
+
+// GetTypeOk returns a tuple with the Type field value
+// and a boolean to check if the value has been set.
+func (o *CampaignResponseData) GetTypeOk() (*CampaignType, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Type, true
+}
+
+// SetType sets field value.
+func (o *CampaignResponseData) SetType(v CampaignType) {
+ o.Type = v
+}
+
+// MarshalJSON serializes the struct using spec logic.
+func (o CampaignResponseData) MarshalJSON() ([]byte, error) {
+ toSerialize := map[string]interface{}{}
+ if o.UnparsedObject != nil {
+ return datadog.Marshal(o.UnparsedObject)
+ }
+ toSerialize["attributes"] = o.Attributes
+ toSerialize["id"] = o.Id
+ toSerialize["type"] = o.Type
+
+ for key, value := range o.AdditionalProperties {
+ toSerialize[key] = value
+ }
+ return datadog.Marshal(toSerialize)
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (o *CampaignResponseData) UnmarshalJSON(bytes []byte) (err error) {
+ all := struct {
+ Attributes *CampaignResponseAttributes `json:"attributes"`
+ Id *string `json:"id"`
+ Type *CampaignType `json:"type"`
+ }{}
+ if err = datadog.Unmarshal(bytes, &all); err != nil {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+ if all.Attributes == nil {
+ return fmt.Errorf("required field attributes missing")
+ }
+ if all.Id == nil {
+ return fmt.Errorf("required field id missing")
+ }
+ if all.Type == nil {
+ return fmt.Errorf("required field type missing")
+ }
+ additionalProperties := make(map[string]interface{})
+ if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
+ datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"})
+ } else {
+ return err
+ }
+
+ hasInvalidField := false
+ if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil {
+ hasInvalidField = true
+ }
+ o.Attributes = *all.Attributes
+ o.Id = *all.Id
+ if !all.Type.IsValid() {
+ hasInvalidField = true
+ } else {
+ o.Type = *all.Type
+ }
+
+ if len(additionalProperties) > 0 {
+ o.AdditionalProperties = additionalProperties
+ }
+
+ if hasInvalidField {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+
+ return nil
+}
diff --git a/api/datadogV2/model_campaign_status.go b/api/datadogV2/model_campaign_status.go
new file mode 100644
index 00000000000..83ca59448b5
--- /dev/null
+++ b/api/datadogV2/model_campaign_status.go
@@ -0,0 +1,68 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// CampaignStatus The status of the campaign.
+type CampaignStatus string
+
+// List of CampaignStatus.
+const (
+ CAMPAIGNSTATUS_IN_PROGRESS CampaignStatus = "in_progress"
+ CAMPAIGNSTATUS_NOT_STARTED CampaignStatus = "not_started"
+ CAMPAIGNSTATUS_COMPLETED CampaignStatus = "completed"
+)
+
+var allowedCampaignStatusEnumValues = []CampaignStatus{
+ CAMPAIGNSTATUS_IN_PROGRESS,
+ CAMPAIGNSTATUS_NOT_STARTED,
+ CAMPAIGNSTATUS_COMPLETED,
+}
+
+// GetAllowedValues reeturns the list of possible values.
+func (v *CampaignStatus) GetAllowedValues() []CampaignStatus {
+ return allowedCampaignStatusEnumValues
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (v *CampaignStatus) UnmarshalJSON(src []byte) error {
+ var value string
+ err := datadog.Unmarshal(src, &value)
+ if err != nil {
+ return err
+ }
+ *v = CampaignStatus(value)
+ return nil
+}
+
+// NewCampaignStatusFromValue returns a pointer to a valid CampaignStatus
+// for the value passed as argument, or an error if the value passed is not allowed by the enum.
+func NewCampaignStatusFromValue(v string) (*CampaignStatus, error) {
+ ev := CampaignStatus(v)
+ if ev.IsValid() {
+ return &ev, nil
+ }
+ return nil, fmt.Errorf("invalid value '%v' for CampaignStatus: valid values are %v", v, allowedCampaignStatusEnumValues)
+}
+
+// IsValid return true if the value is valid for the enum, false otherwise.
+func (v CampaignStatus) IsValid() bool {
+ for _, existing := range allowedCampaignStatusEnumValues {
+ if existing == v {
+ return true
+ }
+ }
+ return false
+}
+
+// Ptr returns reference to CampaignStatus value.
+func (v CampaignStatus) Ptr() *CampaignStatus {
+ return &v
+}
diff --git a/api/datadogV2/model_campaign_type.go b/api/datadogV2/model_campaign_type.go
new file mode 100644
index 00000000000..f20c4a3eb37
--- /dev/null
+++ b/api/datadogV2/model_campaign_type.go
@@ -0,0 +1,64 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// CampaignType The JSON:API type for campaigns.
+type CampaignType string
+
+// List of CampaignType.
+const (
+ CAMPAIGNTYPE_CAMPAIGN CampaignType = "campaign"
+)
+
+var allowedCampaignTypeEnumValues = []CampaignType{
+ CAMPAIGNTYPE_CAMPAIGN,
+}
+
+// GetAllowedValues reeturns the list of possible values.
+func (v *CampaignType) GetAllowedValues() []CampaignType {
+ return allowedCampaignTypeEnumValues
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (v *CampaignType) UnmarshalJSON(src []byte) error {
+ var value string
+ err := datadog.Unmarshal(src, &value)
+ if err != nil {
+ return err
+ }
+ *v = CampaignType(value)
+ return nil
+}
+
+// NewCampaignTypeFromValue returns a pointer to a valid CampaignType
+// for the value passed as argument, or an error if the value passed is not allowed by the enum.
+func NewCampaignTypeFromValue(v string) (*CampaignType, error) {
+ ev := CampaignType(v)
+ if ev.IsValid() {
+ return &ev, nil
+ }
+ return nil, fmt.Errorf("invalid value '%v' for CampaignType: valid values are %v", v, allowedCampaignTypeEnumValues)
+}
+
+// IsValid return true if the value is valid for the enum, false otherwise.
+func (v CampaignType) IsValid() bool {
+ for _, existing := range allowedCampaignTypeEnumValues {
+ if existing == v {
+ return true
+ }
+ }
+ return false
+}
+
+// Ptr returns reference to CampaignType value.
+func (v CampaignType) Ptr() *CampaignType {
+ return &v
+}
diff --git a/api/datadogV2/model_create_campaign_request.go b/api/datadogV2/model_create_campaign_request.go
new file mode 100644
index 00000000000..fe388a839f1
--- /dev/null
+++ b/api/datadogV2/model_create_campaign_request.go
@@ -0,0 +1,110 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// CreateCampaignRequest Request to create a new campaign.
+type CreateCampaignRequest struct {
+ // Data for creating a new campaign.
+ Data CreateCampaignRequestData `json:"data"`
+ // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
+ UnparsedObject map[string]interface{} `json:"-"`
+ AdditionalProperties map[string]interface{} `json:"-"`
+}
+
+// NewCreateCampaignRequest instantiates a new CreateCampaignRequest object.
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed.
+func NewCreateCampaignRequest(data CreateCampaignRequestData) *CreateCampaignRequest {
+ this := CreateCampaignRequest{}
+ this.Data = data
+ return &this
+}
+
+// NewCreateCampaignRequestWithDefaults instantiates a new CreateCampaignRequest object.
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set.
+func NewCreateCampaignRequestWithDefaults() *CreateCampaignRequest {
+ this := CreateCampaignRequest{}
+ return &this
+}
+
+// GetData returns the Data field value.
+func (o *CreateCampaignRequest) GetData() CreateCampaignRequestData {
+ if o == nil {
+ var ret CreateCampaignRequestData
+ return ret
+ }
+ return o.Data
+}
+
+// GetDataOk returns a tuple with the Data field value
+// and a boolean to check if the value has been set.
+func (o *CreateCampaignRequest) GetDataOk() (*CreateCampaignRequestData, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Data, true
+}
+
+// SetData sets field value.
+func (o *CreateCampaignRequest) SetData(v CreateCampaignRequestData) {
+ o.Data = v
+}
+
+// MarshalJSON serializes the struct using spec logic.
+func (o CreateCampaignRequest) MarshalJSON() ([]byte, error) {
+ toSerialize := map[string]interface{}{}
+ if o.UnparsedObject != nil {
+ return datadog.Marshal(o.UnparsedObject)
+ }
+ toSerialize["data"] = o.Data
+
+ for key, value := range o.AdditionalProperties {
+ toSerialize[key] = value
+ }
+ return datadog.Marshal(toSerialize)
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (o *CreateCampaignRequest) UnmarshalJSON(bytes []byte) (err error) {
+ all := struct {
+ Data *CreateCampaignRequestData `json:"data"`
+ }{}
+ if err = datadog.Unmarshal(bytes, &all); err != nil {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+ if all.Data == nil {
+ return fmt.Errorf("required field data missing")
+ }
+ additionalProperties := make(map[string]interface{})
+ if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
+ datadog.DeleteKeys(additionalProperties, &[]string{"data"})
+ } else {
+ return err
+ }
+
+ hasInvalidField := false
+ if all.Data.UnparsedObject != nil && o.UnparsedObject == nil {
+ hasInvalidField = true
+ }
+ o.Data = *all.Data
+
+ if len(additionalProperties) > 0 {
+ o.AdditionalProperties = additionalProperties
+ }
+
+ if hasInvalidField {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+
+ return nil
+}
diff --git a/api/datadogV2/model_create_campaign_request_attributes.go b/api/datadogV2/model_create_campaign_request_attributes.go
new file mode 100644
index 00000000000..6bf3210d5c0
--- /dev/null
+++ b/api/datadogV2/model_create_campaign_request_attributes.go
@@ -0,0 +1,423 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+ "time"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// CreateCampaignRequestAttributes Attributes for creating a new campaign.
+type CreateCampaignRequestAttributes struct {
+ // The description of the campaign.
+ Description *string `json:"description,omitempty"`
+ // The due date of the campaign.
+ DueDate *time.Time `json:"due_date,omitempty"`
+ // Entity scope query to filter entities for this campaign.
+ EntityScope *string `json:"entity_scope,omitempty"`
+ // Guidance for the campaign.
+ Guidance *string `json:"guidance,omitempty"`
+ // The unique key for the campaign.
+ Key string `json:"key"`
+ // The name of the campaign.
+ Name string `json:"name"`
+ // The UUID of the campaign owner.
+ OwnerId string `json:"owner_id"`
+ // Array of rule IDs associated with this campaign.
+ RuleIds []string `json:"rule_ids"`
+ // The start date of the campaign.
+ StartDate time.Time `json:"start_date"`
+ // The status of the campaign.
+ Status *CampaignStatus `json:"status,omitempty"`
+ // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
+ UnparsedObject map[string]interface{} `json:"-"`
+ AdditionalProperties map[string]interface{} `json:"-"`
+}
+
+// NewCreateCampaignRequestAttributes instantiates a new CreateCampaignRequestAttributes object.
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed.
+func NewCreateCampaignRequestAttributes(key string, name string, ownerId string, ruleIds []string, startDate time.Time) *CreateCampaignRequestAttributes {
+ this := CreateCampaignRequestAttributes{}
+ this.Key = key
+ this.Name = name
+ this.OwnerId = ownerId
+ this.RuleIds = ruleIds
+ this.StartDate = startDate
+ return &this
+}
+
+// NewCreateCampaignRequestAttributesWithDefaults instantiates a new CreateCampaignRequestAttributes object.
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set.
+func NewCreateCampaignRequestAttributesWithDefaults() *CreateCampaignRequestAttributes {
+ this := CreateCampaignRequestAttributes{}
+ return &this
+}
+
+// GetDescription returns the Description field value if set, zero value otherwise.
+func (o *CreateCampaignRequestAttributes) GetDescription() string {
+ if o == nil || o.Description == nil {
+ var ret string
+ return ret
+ }
+ return *o.Description
+}
+
+// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *CreateCampaignRequestAttributes) GetDescriptionOk() (*string, bool) {
+ if o == nil || o.Description == nil {
+ return nil, false
+ }
+ return o.Description, true
+}
+
+// HasDescription returns a boolean if a field has been set.
+func (o *CreateCampaignRequestAttributes) HasDescription() bool {
+ return o != nil && o.Description != nil
+}
+
+// SetDescription gets a reference to the given string and assigns it to the Description field.
+func (o *CreateCampaignRequestAttributes) SetDescription(v string) {
+ o.Description = &v
+}
+
+// GetDueDate returns the DueDate field value if set, zero value otherwise.
+func (o *CreateCampaignRequestAttributes) GetDueDate() time.Time {
+ if o == nil || o.DueDate == nil {
+ var ret time.Time
+ return ret
+ }
+ return *o.DueDate
+}
+
+// GetDueDateOk returns a tuple with the DueDate field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *CreateCampaignRequestAttributes) GetDueDateOk() (*time.Time, bool) {
+ if o == nil || o.DueDate == nil {
+ return nil, false
+ }
+ return o.DueDate, true
+}
+
+// HasDueDate returns a boolean if a field has been set.
+func (o *CreateCampaignRequestAttributes) HasDueDate() bool {
+ return o != nil && o.DueDate != nil
+}
+
+// SetDueDate gets a reference to the given time.Time and assigns it to the DueDate field.
+func (o *CreateCampaignRequestAttributes) SetDueDate(v time.Time) {
+ o.DueDate = &v
+}
+
+// GetEntityScope returns the EntityScope field value if set, zero value otherwise.
+func (o *CreateCampaignRequestAttributes) GetEntityScope() string {
+ if o == nil || o.EntityScope == nil {
+ var ret string
+ return ret
+ }
+ return *o.EntityScope
+}
+
+// GetEntityScopeOk returns a tuple with the EntityScope field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *CreateCampaignRequestAttributes) GetEntityScopeOk() (*string, bool) {
+ if o == nil || o.EntityScope == nil {
+ return nil, false
+ }
+ return o.EntityScope, true
+}
+
+// HasEntityScope returns a boolean if a field has been set.
+func (o *CreateCampaignRequestAttributes) HasEntityScope() bool {
+ return o != nil && o.EntityScope != nil
+}
+
+// SetEntityScope gets a reference to the given string and assigns it to the EntityScope field.
+func (o *CreateCampaignRequestAttributes) SetEntityScope(v string) {
+ o.EntityScope = &v
+}
+
+// GetGuidance returns the Guidance field value if set, zero value otherwise.
+func (o *CreateCampaignRequestAttributes) GetGuidance() string {
+ if o == nil || o.Guidance == nil {
+ var ret string
+ return ret
+ }
+ return *o.Guidance
+}
+
+// GetGuidanceOk returns a tuple with the Guidance field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *CreateCampaignRequestAttributes) GetGuidanceOk() (*string, bool) {
+ if o == nil || o.Guidance == nil {
+ return nil, false
+ }
+ return o.Guidance, true
+}
+
+// HasGuidance returns a boolean if a field has been set.
+func (o *CreateCampaignRequestAttributes) HasGuidance() bool {
+ return o != nil && o.Guidance != nil
+}
+
+// SetGuidance gets a reference to the given string and assigns it to the Guidance field.
+func (o *CreateCampaignRequestAttributes) SetGuidance(v string) {
+ o.Guidance = &v
+}
+
+// GetKey returns the Key field value.
+func (o *CreateCampaignRequestAttributes) GetKey() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+ return o.Key
+}
+
+// GetKeyOk returns a tuple with the Key field value
+// and a boolean to check if the value has been set.
+func (o *CreateCampaignRequestAttributes) GetKeyOk() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Key, true
+}
+
+// SetKey sets field value.
+func (o *CreateCampaignRequestAttributes) SetKey(v string) {
+ o.Key = v
+}
+
+// GetName returns the Name field value.
+func (o *CreateCampaignRequestAttributes) GetName() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+ return o.Name
+}
+
+// GetNameOk returns a tuple with the Name field value
+// and a boolean to check if the value has been set.
+func (o *CreateCampaignRequestAttributes) GetNameOk() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Name, true
+}
+
+// SetName sets field value.
+func (o *CreateCampaignRequestAttributes) SetName(v string) {
+ o.Name = v
+}
+
+// GetOwnerId returns the OwnerId field value.
+func (o *CreateCampaignRequestAttributes) GetOwnerId() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+ return o.OwnerId
+}
+
+// GetOwnerIdOk returns a tuple with the OwnerId field value
+// and a boolean to check if the value has been set.
+func (o *CreateCampaignRequestAttributes) GetOwnerIdOk() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.OwnerId, true
+}
+
+// SetOwnerId sets field value.
+func (o *CreateCampaignRequestAttributes) SetOwnerId(v string) {
+ o.OwnerId = v
+}
+
+// GetRuleIds returns the RuleIds field value.
+func (o *CreateCampaignRequestAttributes) GetRuleIds() []string {
+ if o == nil {
+ var ret []string
+ return ret
+ }
+ return o.RuleIds
+}
+
+// GetRuleIdsOk returns a tuple with the RuleIds field value
+// and a boolean to check if the value has been set.
+func (o *CreateCampaignRequestAttributes) GetRuleIdsOk() (*[]string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.RuleIds, true
+}
+
+// SetRuleIds sets field value.
+func (o *CreateCampaignRequestAttributes) SetRuleIds(v []string) {
+ o.RuleIds = v
+}
+
+// GetStartDate returns the StartDate field value.
+func (o *CreateCampaignRequestAttributes) GetStartDate() time.Time {
+ if o == nil {
+ var ret time.Time
+ return ret
+ }
+ return o.StartDate
+}
+
+// GetStartDateOk returns a tuple with the StartDate field value
+// and a boolean to check if the value has been set.
+func (o *CreateCampaignRequestAttributes) GetStartDateOk() (*time.Time, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.StartDate, true
+}
+
+// SetStartDate sets field value.
+func (o *CreateCampaignRequestAttributes) SetStartDate(v time.Time) {
+ o.StartDate = v
+}
+
+// GetStatus returns the Status field value if set, zero value otherwise.
+func (o *CreateCampaignRequestAttributes) GetStatus() CampaignStatus {
+ if o == nil || o.Status == nil {
+ var ret CampaignStatus
+ return ret
+ }
+ return *o.Status
+}
+
+// GetStatusOk returns a tuple with the Status field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *CreateCampaignRequestAttributes) GetStatusOk() (*CampaignStatus, bool) {
+ if o == nil || o.Status == nil {
+ return nil, false
+ }
+ return o.Status, true
+}
+
+// HasStatus returns a boolean if a field has been set.
+func (o *CreateCampaignRequestAttributes) HasStatus() bool {
+ return o != nil && o.Status != nil
+}
+
+// SetStatus gets a reference to the given CampaignStatus and assigns it to the Status field.
+func (o *CreateCampaignRequestAttributes) SetStatus(v CampaignStatus) {
+ o.Status = &v
+}
+
+// MarshalJSON serializes the struct using spec logic.
+func (o CreateCampaignRequestAttributes) MarshalJSON() ([]byte, error) {
+ toSerialize := map[string]interface{}{}
+ if o.UnparsedObject != nil {
+ return datadog.Marshal(o.UnparsedObject)
+ }
+ if o.Description != nil {
+ toSerialize["description"] = o.Description
+ }
+ if o.DueDate != nil {
+ if o.DueDate.Nanosecond() == 0 {
+ toSerialize["due_date"] = o.DueDate.Format("2006-01-02T15:04:05Z07:00")
+ } else {
+ toSerialize["due_date"] = o.DueDate.Format("2006-01-02T15:04:05.000Z07:00")
+ }
+ }
+ if o.EntityScope != nil {
+ toSerialize["entity_scope"] = o.EntityScope
+ }
+ if o.Guidance != nil {
+ toSerialize["guidance"] = o.Guidance
+ }
+ toSerialize["key"] = o.Key
+ toSerialize["name"] = o.Name
+ toSerialize["owner_id"] = o.OwnerId
+ toSerialize["rule_ids"] = o.RuleIds
+ if o.StartDate.Nanosecond() == 0 {
+ toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05Z07:00")
+ } else {
+ toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05.000Z07:00")
+ }
+ if o.Status != nil {
+ toSerialize["status"] = o.Status
+ }
+
+ for key, value := range o.AdditionalProperties {
+ toSerialize[key] = value
+ }
+ return datadog.Marshal(toSerialize)
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (o *CreateCampaignRequestAttributes) UnmarshalJSON(bytes []byte) (err error) {
+ all := struct {
+ Description *string `json:"description,omitempty"`
+ DueDate *time.Time `json:"due_date,omitempty"`
+ EntityScope *string `json:"entity_scope,omitempty"`
+ Guidance *string `json:"guidance,omitempty"`
+ Key *string `json:"key"`
+ Name *string `json:"name"`
+ OwnerId *string `json:"owner_id"`
+ RuleIds *[]string `json:"rule_ids"`
+ StartDate *time.Time `json:"start_date"`
+ Status *CampaignStatus `json:"status,omitempty"`
+ }{}
+ if err = datadog.Unmarshal(bytes, &all); err != nil {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+ if all.Key == nil {
+ return fmt.Errorf("required field key missing")
+ }
+ if all.Name == nil {
+ return fmt.Errorf("required field name missing")
+ }
+ if all.OwnerId == nil {
+ return fmt.Errorf("required field owner_id missing")
+ }
+ if all.RuleIds == nil {
+ return fmt.Errorf("required field rule_ids missing")
+ }
+ if all.StartDate == nil {
+ return fmt.Errorf("required field start_date missing")
+ }
+ additionalProperties := make(map[string]interface{})
+ if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
+ datadog.DeleteKeys(additionalProperties, &[]string{"description", "due_date", "entity_scope", "guidance", "key", "name", "owner_id", "rule_ids", "start_date", "status"})
+ } else {
+ return err
+ }
+
+ hasInvalidField := false
+ o.Description = all.Description
+ o.DueDate = all.DueDate
+ o.EntityScope = all.EntityScope
+ o.Guidance = all.Guidance
+ o.Key = *all.Key
+ o.Name = *all.Name
+ o.OwnerId = *all.OwnerId
+ o.RuleIds = *all.RuleIds
+ o.StartDate = *all.StartDate
+ if all.Status != nil && !all.Status.IsValid() {
+ hasInvalidField = true
+ } else {
+ o.Status = all.Status
+ }
+
+ if len(additionalProperties) > 0 {
+ o.AdditionalProperties = additionalProperties
+ }
+
+ if hasInvalidField {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+
+ return nil
+}
diff --git a/api/datadogV2/model_create_campaign_request_data.go b/api/datadogV2/model_create_campaign_request_data.go
new file mode 100644
index 00000000000..0f25f078382
--- /dev/null
+++ b/api/datadogV2/model_create_campaign_request_data.go
@@ -0,0 +1,146 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// CreateCampaignRequestData Data for creating a new campaign.
+type CreateCampaignRequestData struct {
+ // Attributes for creating a new campaign.
+ Attributes CreateCampaignRequestAttributes `json:"attributes"`
+ // The JSON:API type for campaigns.
+ Type CampaignType `json:"type"`
+ // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
+ UnparsedObject map[string]interface{} `json:"-"`
+ AdditionalProperties map[string]interface{} `json:"-"`
+}
+
+// NewCreateCampaignRequestData instantiates a new CreateCampaignRequestData object.
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed.
+func NewCreateCampaignRequestData(attributes CreateCampaignRequestAttributes, typeVar CampaignType) *CreateCampaignRequestData {
+ this := CreateCampaignRequestData{}
+ this.Attributes = attributes
+ this.Type = typeVar
+ return &this
+}
+
+// NewCreateCampaignRequestDataWithDefaults instantiates a new CreateCampaignRequestData object.
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set.
+func NewCreateCampaignRequestDataWithDefaults() *CreateCampaignRequestData {
+ this := CreateCampaignRequestData{}
+ return &this
+}
+
+// GetAttributes returns the Attributes field value.
+func (o *CreateCampaignRequestData) GetAttributes() CreateCampaignRequestAttributes {
+ if o == nil {
+ var ret CreateCampaignRequestAttributes
+ return ret
+ }
+ return o.Attributes
+}
+
+// GetAttributesOk returns a tuple with the Attributes field value
+// and a boolean to check if the value has been set.
+func (o *CreateCampaignRequestData) GetAttributesOk() (*CreateCampaignRequestAttributes, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Attributes, true
+}
+
+// SetAttributes sets field value.
+func (o *CreateCampaignRequestData) SetAttributes(v CreateCampaignRequestAttributes) {
+ o.Attributes = v
+}
+
+// GetType returns the Type field value.
+func (o *CreateCampaignRequestData) GetType() CampaignType {
+ if o == nil {
+ var ret CampaignType
+ return ret
+ }
+ return o.Type
+}
+
+// GetTypeOk returns a tuple with the Type field value
+// and a boolean to check if the value has been set.
+func (o *CreateCampaignRequestData) GetTypeOk() (*CampaignType, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Type, true
+}
+
+// SetType sets field value.
+func (o *CreateCampaignRequestData) SetType(v CampaignType) {
+ o.Type = v
+}
+
+// MarshalJSON serializes the struct using spec logic.
+func (o CreateCampaignRequestData) MarshalJSON() ([]byte, error) {
+ toSerialize := map[string]interface{}{}
+ if o.UnparsedObject != nil {
+ return datadog.Marshal(o.UnparsedObject)
+ }
+ toSerialize["attributes"] = o.Attributes
+ toSerialize["type"] = o.Type
+
+ for key, value := range o.AdditionalProperties {
+ toSerialize[key] = value
+ }
+ return datadog.Marshal(toSerialize)
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (o *CreateCampaignRequestData) UnmarshalJSON(bytes []byte) (err error) {
+ all := struct {
+ Attributes *CreateCampaignRequestAttributes `json:"attributes"`
+ Type *CampaignType `json:"type"`
+ }{}
+ if err = datadog.Unmarshal(bytes, &all); err != nil {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+ if all.Attributes == nil {
+ return fmt.Errorf("required field attributes missing")
+ }
+ if all.Type == nil {
+ return fmt.Errorf("required field type missing")
+ }
+ additionalProperties := make(map[string]interface{})
+ if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
+ datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"})
+ } else {
+ return err
+ }
+
+ hasInvalidField := false
+ if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil {
+ hasInvalidField = true
+ }
+ o.Attributes = *all.Attributes
+ if !all.Type.IsValid() {
+ hasInvalidField = true
+ } else {
+ o.Type = *all.Type
+ }
+
+ if len(additionalProperties) > 0 {
+ o.AdditionalProperties = additionalProperties
+ }
+
+ if hasInvalidField {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+
+ return nil
+}
diff --git a/api/datadogV2/model_create_rule_request_data.go b/api/datadogV2/model_create_rule_request_data.go
index c03cc1b31c1..a8a75a1f06a 100644
--- a/api/datadogV2/model_create_rule_request_data.go
+++ b/api/datadogV2/model_create_rule_request_data.go
@@ -10,8 +10,8 @@ import (
// CreateRuleRequestData Scorecard create rule request data.
type CreateRuleRequestData struct {
- // Details of a rule.
- Attributes *RuleAttributes `json:"attributes,omitempty"`
+ // Attributes for creating or updating a rule. Server-managed fields (created_at, modified_at, custom) are excluded.
+ Attributes *RuleAttributesRequest `json:"attributes,omitempty"`
// The JSON:API type for scorecard rules.
Type *RuleType `json:"type,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
@@ -41,9 +41,9 @@ func NewCreateRuleRequestDataWithDefaults() *CreateRuleRequestData {
}
// GetAttributes returns the Attributes field value if set, zero value otherwise.
-func (o *CreateRuleRequestData) GetAttributes() RuleAttributes {
+func (o *CreateRuleRequestData) GetAttributes() RuleAttributesRequest {
if o == nil || o.Attributes == nil {
- var ret RuleAttributes
+ var ret RuleAttributesRequest
return ret
}
return *o.Attributes
@@ -51,7 +51,7 @@ func (o *CreateRuleRequestData) GetAttributes() RuleAttributes {
// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise
// and a boolean to check if the value has been set.
-func (o *CreateRuleRequestData) GetAttributesOk() (*RuleAttributes, bool) {
+func (o *CreateRuleRequestData) GetAttributesOk() (*RuleAttributesRequest, bool) {
if o == nil || o.Attributes == nil {
return nil, false
}
@@ -63,8 +63,8 @@ func (o *CreateRuleRequestData) HasAttributes() bool {
return o != nil && o.Attributes != nil
}
-// SetAttributes gets a reference to the given RuleAttributes and assigns it to the Attributes field.
-func (o *CreateRuleRequestData) SetAttributes(v RuleAttributes) {
+// SetAttributes gets a reference to the given RuleAttributesRequest and assigns it to the Attributes field.
+func (o *CreateRuleRequestData) SetAttributes(v RuleAttributesRequest) {
o.Attributes = &v
}
@@ -118,8 +118,8 @@ func (o CreateRuleRequestData) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *CreateRuleRequestData) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
- Attributes *RuleAttributes `json:"attributes,omitempty"`
- Type *RuleType `json:"type,omitempty"`
+ Attributes *RuleAttributesRequest `json:"attributes,omitempty"`
+ Type *RuleType `json:"type,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
diff --git a/api/datadogV2/model_list_campaigns_response.go b/api/datadogV2/model_list_campaigns_response.go
new file mode 100644
index 00000000000..6d978529615
--- /dev/null
+++ b/api/datadogV2/model_list_campaigns_response.go
@@ -0,0 +1,142 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// ListCampaignsResponse Response containing a list of campaigns.
+type ListCampaignsResponse struct {
+ // Array of campaigns.
+ Data []CampaignResponseData `json:"data"`
+ // Metadata for scores response.
+ Meta PaginatedResponseMeta `json:"meta"`
+ // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
+ UnparsedObject map[string]interface{} `json:"-"`
+ AdditionalProperties map[string]interface{} `json:"-"`
+}
+
+// NewListCampaignsResponse instantiates a new ListCampaignsResponse object.
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed.
+func NewListCampaignsResponse(data []CampaignResponseData, meta PaginatedResponseMeta) *ListCampaignsResponse {
+ this := ListCampaignsResponse{}
+ this.Data = data
+ this.Meta = meta
+ return &this
+}
+
+// NewListCampaignsResponseWithDefaults instantiates a new ListCampaignsResponse object.
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set.
+func NewListCampaignsResponseWithDefaults() *ListCampaignsResponse {
+ this := ListCampaignsResponse{}
+ return &this
+}
+
+// GetData returns the Data field value.
+func (o *ListCampaignsResponse) GetData() []CampaignResponseData {
+ if o == nil {
+ var ret []CampaignResponseData
+ return ret
+ }
+ return o.Data
+}
+
+// GetDataOk returns a tuple with the Data field value
+// and a boolean to check if the value has been set.
+func (o *ListCampaignsResponse) GetDataOk() (*[]CampaignResponseData, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Data, true
+}
+
+// SetData sets field value.
+func (o *ListCampaignsResponse) SetData(v []CampaignResponseData) {
+ o.Data = v
+}
+
+// GetMeta returns the Meta field value.
+func (o *ListCampaignsResponse) GetMeta() PaginatedResponseMeta {
+ if o == nil {
+ var ret PaginatedResponseMeta
+ return ret
+ }
+ return o.Meta
+}
+
+// GetMetaOk returns a tuple with the Meta field value
+// and a boolean to check if the value has been set.
+func (o *ListCampaignsResponse) GetMetaOk() (*PaginatedResponseMeta, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Meta, true
+}
+
+// SetMeta sets field value.
+func (o *ListCampaignsResponse) SetMeta(v PaginatedResponseMeta) {
+ o.Meta = v
+}
+
+// MarshalJSON serializes the struct using spec logic.
+func (o ListCampaignsResponse) MarshalJSON() ([]byte, error) {
+ toSerialize := map[string]interface{}{}
+ if o.UnparsedObject != nil {
+ return datadog.Marshal(o.UnparsedObject)
+ }
+ toSerialize["data"] = o.Data
+ toSerialize["meta"] = o.Meta
+
+ for key, value := range o.AdditionalProperties {
+ toSerialize[key] = value
+ }
+ return datadog.Marshal(toSerialize)
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (o *ListCampaignsResponse) UnmarshalJSON(bytes []byte) (err error) {
+ all := struct {
+ Data *[]CampaignResponseData `json:"data"`
+ Meta *PaginatedResponseMeta `json:"meta"`
+ }{}
+ if err = datadog.Unmarshal(bytes, &all); err != nil {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+ if all.Data == nil {
+ return fmt.Errorf("required field data missing")
+ }
+ if all.Meta == nil {
+ return fmt.Errorf("required field meta missing")
+ }
+ additionalProperties := make(map[string]interface{})
+ if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
+ datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"})
+ } else {
+ return err
+ }
+
+ hasInvalidField := false
+ o.Data = *all.Data
+ if all.Meta.UnparsedObject != nil && o.UnparsedObject == nil {
+ hasInvalidField = true
+ }
+ o.Meta = *all.Meta
+
+ if len(additionalProperties) > 0 {
+ o.AdditionalProperties = additionalProperties
+ }
+
+ if hasInvalidField {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+
+ return nil
+}
diff --git a/api/datadogV2/model_list_scorecards_response.go b/api/datadogV2/model_list_scorecards_response.go
new file mode 100644
index 00000000000..46c79bc3044
--- /dev/null
+++ b/api/datadogV2/model_list_scorecards_response.go
@@ -0,0 +1,101 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// ListScorecardsResponse Response containing a list of scorecards.
+type ListScorecardsResponse struct {
+ // Array of scorecards.
+ Data []ScorecardListResponseData `json:"data"`
+ // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
+ UnparsedObject map[string]interface{} `json:"-"`
+ AdditionalProperties map[string]interface{} `json:"-"`
+}
+
+// NewListScorecardsResponse instantiates a new ListScorecardsResponse object.
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed.
+func NewListScorecardsResponse(data []ScorecardListResponseData) *ListScorecardsResponse {
+ this := ListScorecardsResponse{}
+ this.Data = data
+ return &this
+}
+
+// NewListScorecardsResponseWithDefaults instantiates a new ListScorecardsResponse object.
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set.
+func NewListScorecardsResponseWithDefaults() *ListScorecardsResponse {
+ this := ListScorecardsResponse{}
+ return &this
+}
+
+// GetData returns the Data field value.
+func (o *ListScorecardsResponse) GetData() []ScorecardListResponseData {
+ if o == nil {
+ var ret []ScorecardListResponseData
+ return ret
+ }
+ return o.Data
+}
+
+// GetDataOk returns a tuple with the Data field value
+// and a boolean to check if the value has been set.
+func (o *ListScorecardsResponse) GetDataOk() (*[]ScorecardListResponseData, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Data, true
+}
+
+// SetData sets field value.
+func (o *ListScorecardsResponse) SetData(v []ScorecardListResponseData) {
+ o.Data = v
+}
+
+// MarshalJSON serializes the struct using spec logic.
+func (o ListScorecardsResponse) MarshalJSON() ([]byte, error) {
+ toSerialize := map[string]interface{}{}
+ if o.UnparsedObject != nil {
+ return datadog.Marshal(o.UnparsedObject)
+ }
+ toSerialize["data"] = o.Data
+
+ for key, value := range o.AdditionalProperties {
+ toSerialize[key] = value
+ }
+ return datadog.Marshal(toSerialize)
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (o *ListScorecardsResponse) UnmarshalJSON(bytes []byte) (err error) {
+ all := struct {
+ Data *[]ScorecardListResponseData `json:"data"`
+ }{}
+ if err = datadog.Unmarshal(bytes, &all); err != nil {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+ if all.Data == nil {
+ return fmt.Errorf("required field data missing")
+ }
+ additionalProperties := make(map[string]interface{})
+ if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
+ datadog.DeleteKeys(additionalProperties, &[]string{"data"})
+ } else {
+ return err
+ }
+ o.Data = *all.Data
+
+ if len(additionalProperties) > 0 {
+ o.AdditionalProperties = additionalProperties
+ }
+
+ return nil
+}
diff --git a/api/datadogV2/model_paginated_response_meta.go b/api/datadogV2/model_paginated_response_meta.go
new file mode 100644
index 00000000000..2c3269b008f
--- /dev/null
+++ b/api/datadogV2/model_paginated_response_meta.go
@@ -0,0 +1,197 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// PaginatedResponseMeta Metadata for scores response.
+type PaginatedResponseMeta struct {
+ // Number of entities in this response.
+ Count int64 `json:"count"`
+ // Pagination limit.
+ Limit int64 `json:"limit"`
+ // Pagination offset.
+ Offset int64 `json:"offset"`
+ // Total number of entities available.
+ Total int64 `json:"total"`
+ // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
+ UnparsedObject map[string]interface{} `json:"-"`
+ AdditionalProperties map[string]interface{} `json:"-"`
+}
+
+// NewPaginatedResponseMeta instantiates a new PaginatedResponseMeta object.
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed.
+func NewPaginatedResponseMeta(count int64, limit int64, offset int64, total int64) *PaginatedResponseMeta {
+ this := PaginatedResponseMeta{}
+ this.Count = count
+ this.Limit = limit
+ this.Offset = offset
+ this.Total = total
+ return &this
+}
+
+// NewPaginatedResponseMetaWithDefaults instantiates a new PaginatedResponseMeta object.
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set.
+func NewPaginatedResponseMetaWithDefaults() *PaginatedResponseMeta {
+ this := PaginatedResponseMeta{}
+ return &this
+}
+
+// GetCount returns the Count field value.
+func (o *PaginatedResponseMeta) GetCount() int64 {
+ if o == nil {
+ var ret int64
+ return ret
+ }
+ return o.Count
+}
+
+// GetCountOk returns a tuple with the Count field value
+// and a boolean to check if the value has been set.
+func (o *PaginatedResponseMeta) GetCountOk() (*int64, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Count, true
+}
+
+// SetCount sets field value.
+func (o *PaginatedResponseMeta) SetCount(v int64) {
+ o.Count = v
+}
+
+// GetLimit returns the Limit field value.
+func (o *PaginatedResponseMeta) GetLimit() int64 {
+ if o == nil {
+ var ret int64
+ return ret
+ }
+ return o.Limit
+}
+
+// GetLimitOk returns a tuple with the Limit field value
+// and a boolean to check if the value has been set.
+func (o *PaginatedResponseMeta) GetLimitOk() (*int64, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Limit, true
+}
+
+// SetLimit sets field value.
+func (o *PaginatedResponseMeta) SetLimit(v int64) {
+ o.Limit = v
+}
+
+// GetOffset returns the Offset field value.
+func (o *PaginatedResponseMeta) GetOffset() int64 {
+ if o == nil {
+ var ret int64
+ return ret
+ }
+ return o.Offset
+}
+
+// GetOffsetOk returns a tuple with the Offset field value
+// and a boolean to check if the value has been set.
+func (o *PaginatedResponseMeta) GetOffsetOk() (*int64, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Offset, true
+}
+
+// SetOffset sets field value.
+func (o *PaginatedResponseMeta) SetOffset(v int64) {
+ o.Offset = v
+}
+
+// GetTotal returns the Total field value.
+func (o *PaginatedResponseMeta) GetTotal() int64 {
+ if o == nil {
+ var ret int64
+ return ret
+ }
+ return o.Total
+}
+
+// GetTotalOk returns a tuple with the Total field value
+// and a boolean to check if the value has been set.
+func (o *PaginatedResponseMeta) GetTotalOk() (*int64, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Total, true
+}
+
+// SetTotal sets field value.
+func (o *PaginatedResponseMeta) SetTotal(v int64) {
+ o.Total = v
+}
+
+// MarshalJSON serializes the struct using spec logic.
+func (o PaginatedResponseMeta) MarshalJSON() ([]byte, error) {
+ toSerialize := map[string]interface{}{}
+ if o.UnparsedObject != nil {
+ return datadog.Marshal(o.UnparsedObject)
+ }
+ toSerialize["count"] = o.Count
+ toSerialize["limit"] = o.Limit
+ toSerialize["offset"] = o.Offset
+ toSerialize["total"] = o.Total
+
+ for key, value := range o.AdditionalProperties {
+ toSerialize[key] = value
+ }
+ return datadog.Marshal(toSerialize)
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (o *PaginatedResponseMeta) UnmarshalJSON(bytes []byte) (err error) {
+ all := struct {
+ Count *int64 `json:"count"`
+ Limit *int64 `json:"limit"`
+ Offset *int64 `json:"offset"`
+ Total *int64 `json:"total"`
+ }{}
+ if err = datadog.Unmarshal(bytes, &all); err != nil {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+ if all.Count == nil {
+ return fmt.Errorf("required field count missing")
+ }
+ if all.Limit == nil {
+ return fmt.Errorf("required field limit missing")
+ }
+ if all.Offset == nil {
+ return fmt.Errorf("required field offset missing")
+ }
+ if all.Total == nil {
+ return fmt.Errorf("required field total missing")
+ }
+ additionalProperties := make(map[string]interface{})
+ if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
+ datadog.DeleteKeys(additionalProperties, &[]string{"count", "limit", "offset", "total"})
+ } else {
+ return err
+ }
+ o.Count = *all.Count
+ o.Limit = *all.Limit
+ o.Offset = *all.Offset
+ o.Total = *all.Total
+
+ if len(additionalProperties) > 0 {
+ o.AdditionalProperties = additionalProperties
+ }
+
+ return nil
+}
diff --git a/api/datadogV2/model_rule_attributes.go b/api/datadogV2/model_rule_attributes.go
index 15ce5ca3f52..d53f7da190c 100644
--- a/api/datadogV2/model_rule_attributes.go
+++ b/api/datadogV2/model_rule_attributes.go
@@ -31,6 +31,8 @@ type RuleAttributes struct {
Name *string `json:"name,omitempty"`
// Owner of the rule.
Owner *string `json:"owner,omitempty"`
+ // A query to filter which entities this rule applies to.
+ ScopeQuery *string `json:"scope_query,omitempty"`
// The scorecard name to which this rule must belong.
ScorecardName *string `json:"scorecard_name,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
@@ -310,6 +312,34 @@ func (o *RuleAttributes) SetOwner(v string) {
o.Owner = &v
}
+// GetScopeQuery returns the ScopeQuery field value if set, zero value otherwise.
+func (o *RuleAttributes) GetScopeQuery() string {
+ if o == nil || o.ScopeQuery == nil {
+ var ret string
+ return ret
+ }
+ return *o.ScopeQuery
+}
+
+// GetScopeQueryOk returns a tuple with the ScopeQuery field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *RuleAttributes) GetScopeQueryOk() (*string, bool) {
+ if o == nil || o.ScopeQuery == nil {
+ return nil, false
+ }
+ return o.ScopeQuery, true
+}
+
+// HasScopeQuery returns a boolean if a field has been set.
+func (o *RuleAttributes) HasScopeQuery() bool {
+ return o != nil && o.ScopeQuery != nil
+}
+
+// SetScopeQuery gets a reference to the given string and assigns it to the ScopeQuery field.
+func (o *RuleAttributes) SetScopeQuery(v string) {
+ o.ScopeQuery = &v
+}
+
// GetScorecardName returns the ScorecardName field value if set, zero value otherwise.
func (o *RuleAttributes) GetScorecardName() string {
if o == nil || o.ScorecardName == nil {
@@ -379,6 +409,9 @@ func (o RuleAttributes) MarshalJSON() ([]byte, error) {
if o.Owner != nil {
toSerialize["owner"] = o.Owner
}
+ if o.ScopeQuery != nil {
+ toSerialize["scope_query"] = o.ScopeQuery
+ }
if o.ScorecardName != nil {
toSerialize["scorecard_name"] = o.ScorecardName
}
@@ -401,6 +434,7 @@ func (o *RuleAttributes) UnmarshalJSON(bytes []byte) (err error) {
ModifiedAt *time.Time `json:"modified_at,omitempty"`
Name *string `json:"name,omitempty"`
Owner *string `json:"owner,omitempty"`
+ ScopeQuery *string `json:"scope_query,omitempty"`
ScorecardName *string `json:"scorecard_name,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
@@ -408,7 +442,7 @@ func (o *RuleAttributes) UnmarshalJSON(bytes []byte) (err error) {
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
- datadog.DeleteKeys(additionalProperties, &[]string{"category", "created_at", "custom", "description", "enabled", "level", "modified_at", "name", "owner", "scorecard_name"})
+ datadog.DeleteKeys(additionalProperties, &[]string{"category", "created_at", "custom", "description", "enabled", "level", "modified_at", "name", "owner", "scope_query", "scorecard_name"})
} else {
return err
}
@@ -421,6 +455,7 @@ func (o *RuleAttributes) UnmarshalJSON(bytes []byte) (err error) {
o.ModifiedAt = all.ModifiedAt
o.Name = all.Name
o.Owner = all.Owner
+ o.ScopeQuery = all.ScopeQuery
o.ScorecardName = all.ScorecardName
if len(additionalProperties) > 0 {
diff --git a/api/datadogV2/model_rule_attributes_request.go b/api/datadogV2/model_rule_attributes_request.go
new file mode 100644
index 00000000000..c552dce3d61
--- /dev/null
+++ b/api/datadogV2/model_rule_attributes_request.go
@@ -0,0 +1,312 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// RuleAttributesRequest Attributes for creating or updating a rule. Server-managed fields (created_at, modified_at, custom) are excluded.
+type RuleAttributesRequest struct {
+ // Explanation of the rule.
+ Description *string `json:"description,omitempty"`
+ // If enabled, the rule is calculated as part of the score.
+ Enabled *bool `json:"enabled,omitempty"`
+ // The maturity level of the rule (1, 2, or 3).
+ Level *int32 `json:"level,omitempty"`
+ // Name of the rule.
+ Name *string `json:"name,omitempty"`
+ // Owner of the rule.
+ Owner *string `json:"owner,omitempty"`
+ // A query to filter which entities this rule applies to.
+ ScopeQuery *string `json:"scope_query,omitempty"`
+ // The scorecard name to which this rule must belong.
+ ScorecardName *string `json:"scorecard_name,omitempty"`
+ // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
+ UnparsedObject map[string]interface{} `json:"-"`
+ AdditionalProperties map[string]interface{} `json:"-"`
+}
+
+// NewRuleAttributesRequest instantiates a new RuleAttributesRequest object.
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed.
+func NewRuleAttributesRequest() *RuleAttributesRequest {
+ this := RuleAttributesRequest{}
+ return &this
+}
+
+// NewRuleAttributesRequestWithDefaults instantiates a new RuleAttributesRequest object.
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set.
+func NewRuleAttributesRequestWithDefaults() *RuleAttributesRequest {
+ this := RuleAttributesRequest{}
+ return &this
+}
+
+// GetDescription returns the Description field value if set, zero value otherwise.
+func (o *RuleAttributesRequest) GetDescription() string {
+ if o == nil || o.Description == nil {
+ var ret string
+ return ret
+ }
+ return *o.Description
+}
+
+// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *RuleAttributesRequest) GetDescriptionOk() (*string, bool) {
+ if o == nil || o.Description == nil {
+ return nil, false
+ }
+ return o.Description, true
+}
+
+// HasDescription returns a boolean if a field has been set.
+func (o *RuleAttributesRequest) HasDescription() bool {
+ return o != nil && o.Description != nil
+}
+
+// SetDescription gets a reference to the given string and assigns it to the Description field.
+func (o *RuleAttributesRequest) SetDescription(v string) {
+ o.Description = &v
+}
+
+// GetEnabled returns the Enabled field value if set, zero value otherwise.
+func (o *RuleAttributesRequest) GetEnabled() bool {
+ if o == nil || o.Enabled == nil {
+ var ret bool
+ return ret
+ }
+ return *o.Enabled
+}
+
+// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *RuleAttributesRequest) GetEnabledOk() (*bool, bool) {
+ if o == nil || o.Enabled == nil {
+ return nil, false
+ }
+ return o.Enabled, true
+}
+
+// HasEnabled returns a boolean if a field has been set.
+func (o *RuleAttributesRequest) HasEnabled() bool {
+ return o != nil && o.Enabled != nil
+}
+
+// SetEnabled gets a reference to the given bool and assigns it to the Enabled field.
+func (o *RuleAttributesRequest) SetEnabled(v bool) {
+ o.Enabled = &v
+}
+
+// GetLevel returns the Level field value if set, zero value otherwise.
+func (o *RuleAttributesRequest) GetLevel() int32 {
+ if o == nil || o.Level == nil {
+ var ret int32
+ return ret
+ }
+ return *o.Level
+}
+
+// GetLevelOk returns a tuple with the Level field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *RuleAttributesRequest) GetLevelOk() (*int32, bool) {
+ if o == nil || o.Level == nil {
+ return nil, false
+ }
+ return o.Level, true
+}
+
+// HasLevel returns a boolean if a field has been set.
+func (o *RuleAttributesRequest) HasLevel() bool {
+ return o != nil && o.Level != nil
+}
+
+// SetLevel gets a reference to the given int32 and assigns it to the Level field.
+func (o *RuleAttributesRequest) SetLevel(v int32) {
+ o.Level = &v
+}
+
+// GetName returns the Name field value if set, zero value otherwise.
+func (o *RuleAttributesRequest) GetName() string {
+ if o == nil || o.Name == nil {
+ var ret string
+ return ret
+ }
+ return *o.Name
+}
+
+// GetNameOk returns a tuple with the Name field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *RuleAttributesRequest) GetNameOk() (*string, bool) {
+ if o == nil || o.Name == nil {
+ return nil, false
+ }
+ return o.Name, true
+}
+
+// HasName returns a boolean if a field has been set.
+func (o *RuleAttributesRequest) HasName() bool {
+ return o != nil && o.Name != nil
+}
+
+// SetName gets a reference to the given string and assigns it to the Name field.
+func (o *RuleAttributesRequest) SetName(v string) {
+ o.Name = &v
+}
+
+// GetOwner returns the Owner field value if set, zero value otherwise.
+func (o *RuleAttributesRequest) GetOwner() string {
+ if o == nil || o.Owner == nil {
+ var ret string
+ return ret
+ }
+ return *o.Owner
+}
+
+// GetOwnerOk returns a tuple with the Owner field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *RuleAttributesRequest) GetOwnerOk() (*string, bool) {
+ if o == nil || o.Owner == nil {
+ return nil, false
+ }
+ return o.Owner, true
+}
+
+// HasOwner returns a boolean if a field has been set.
+func (o *RuleAttributesRequest) HasOwner() bool {
+ return o != nil && o.Owner != nil
+}
+
+// SetOwner gets a reference to the given string and assigns it to the Owner field.
+func (o *RuleAttributesRequest) SetOwner(v string) {
+ o.Owner = &v
+}
+
+// GetScopeQuery returns the ScopeQuery field value if set, zero value otherwise.
+func (o *RuleAttributesRequest) GetScopeQuery() string {
+ if o == nil || o.ScopeQuery == nil {
+ var ret string
+ return ret
+ }
+ return *o.ScopeQuery
+}
+
+// GetScopeQueryOk returns a tuple with the ScopeQuery field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *RuleAttributesRequest) GetScopeQueryOk() (*string, bool) {
+ if o == nil || o.ScopeQuery == nil {
+ return nil, false
+ }
+ return o.ScopeQuery, true
+}
+
+// HasScopeQuery returns a boolean if a field has been set.
+func (o *RuleAttributesRequest) HasScopeQuery() bool {
+ return o != nil && o.ScopeQuery != nil
+}
+
+// SetScopeQuery gets a reference to the given string and assigns it to the ScopeQuery field.
+func (o *RuleAttributesRequest) SetScopeQuery(v string) {
+ o.ScopeQuery = &v
+}
+
+// GetScorecardName returns the ScorecardName field value if set, zero value otherwise.
+func (o *RuleAttributesRequest) GetScorecardName() string {
+ if o == nil || o.ScorecardName == nil {
+ var ret string
+ return ret
+ }
+ return *o.ScorecardName
+}
+
+// GetScorecardNameOk returns a tuple with the ScorecardName field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *RuleAttributesRequest) GetScorecardNameOk() (*string, bool) {
+ if o == nil || o.ScorecardName == nil {
+ return nil, false
+ }
+ return o.ScorecardName, true
+}
+
+// HasScorecardName returns a boolean if a field has been set.
+func (o *RuleAttributesRequest) HasScorecardName() bool {
+ return o != nil && o.ScorecardName != nil
+}
+
+// SetScorecardName gets a reference to the given string and assigns it to the ScorecardName field.
+func (o *RuleAttributesRequest) SetScorecardName(v string) {
+ o.ScorecardName = &v
+}
+
+// MarshalJSON serializes the struct using spec logic.
+func (o RuleAttributesRequest) MarshalJSON() ([]byte, error) {
+ toSerialize := map[string]interface{}{}
+ if o.UnparsedObject != nil {
+ return datadog.Marshal(o.UnparsedObject)
+ }
+ if o.Description != nil {
+ toSerialize["description"] = o.Description
+ }
+ if o.Enabled != nil {
+ toSerialize["enabled"] = o.Enabled
+ }
+ if o.Level != nil {
+ toSerialize["level"] = o.Level
+ }
+ if o.Name != nil {
+ toSerialize["name"] = o.Name
+ }
+ if o.Owner != nil {
+ toSerialize["owner"] = o.Owner
+ }
+ if o.ScopeQuery != nil {
+ toSerialize["scope_query"] = o.ScopeQuery
+ }
+ if o.ScorecardName != nil {
+ toSerialize["scorecard_name"] = o.ScorecardName
+ }
+
+ for key, value := range o.AdditionalProperties {
+ toSerialize[key] = value
+ }
+ return datadog.Marshal(toSerialize)
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (o *RuleAttributesRequest) UnmarshalJSON(bytes []byte) (err error) {
+ all := struct {
+ Description *string `json:"description,omitempty"`
+ Enabled *bool `json:"enabled,omitempty"`
+ Level *int32 `json:"level,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Owner *string `json:"owner,omitempty"`
+ ScopeQuery *string `json:"scope_query,omitempty"`
+ ScorecardName *string `json:"scorecard_name,omitempty"`
+ }{}
+ if err = datadog.Unmarshal(bytes, &all); err != nil {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+ additionalProperties := make(map[string]interface{})
+ if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
+ datadog.DeleteKeys(additionalProperties, &[]string{"description", "enabled", "level", "name", "owner", "scope_query", "scorecard_name"})
+ } else {
+ return err
+ }
+ o.Description = all.Description
+ o.Enabled = all.Enabled
+ o.Level = all.Level
+ o.Name = all.Name
+ o.Owner = all.Owner
+ o.ScopeQuery = all.ScopeQuery
+ o.ScorecardName = all.ScorecardName
+
+ if len(additionalProperties) > 0 {
+ o.AdditionalProperties = additionalProperties
+ }
+
+ return nil
+}
diff --git a/api/datadogV2/model_scorecard_list_response_attributes.go b/api/datadogV2/model_scorecard_list_response_attributes.go
new file mode 100644
index 00000000000..a602b814d64
--- /dev/null
+++ b/api/datadogV2/model_scorecard_list_response_attributes.go
@@ -0,0 +1,209 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+ "time"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// ScorecardListResponseAttributes Scorecard attributes.
+type ScorecardListResponseAttributes struct {
+ // Creation time of the scorecard.
+ CreatedAt time.Time `json:"created_at"`
+ // The description of the scorecard.
+ Description *string `json:"description,omitempty"`
+ // Time of last scorecard modification.
+ ModifiedAt time.Time `json:"modified_at"`
+ // The name of the scorecard.
+ Name string `json:"name"`
+ // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
+ UnparsedObject map[string]interface{} `json:"-"`
+ AdditionalProperties map[string]interface{} `json:"-"`
+}
+
+// NewScorecardListResponseAttributes instantiates a new ScorecardListResponseAttributes object.
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed.
+func NewScorecardListResponseAttributes(createdAt time.Time, modifiedAt time.Time, name string) *ScorecardListResponseAttributes {
+ this := ScorecardListResponseAttributes{}
+ this.CreatedAt = createdAt
+ this.ModifiedAt = modifiedAt
+ this.Name = name
+ return &this
+}
+
+// NewScorecardListResponseAttributesWithDefaults instantiates a new ScorecardListResponseAttributes object.
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set.
+func NewScorecardListResponseAttributesWithDefaults() *ScorecardListResponseAttributes {
+ this := ScorecardListResponseAttributes{}
+ return &this
+}
+
+// GetCreatedAt returns the CreatedAt field value.
+func (o *ScorecardListResponseAttributes) GetCreatedAt() time.Time {
+ if o == nil {
+ var ret time.Time
+ return ret
+ }
+ return o.CreatedAt
+}
+
+// GetCreatedAtOk returns a tuple with the CreatedAt field value
+// and a boolean to check if the value has been set.
+func (o *ScorecardListResponseAttributes) GetCreatedAtOk() (*time.Time, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.CreatedAt, true
+}
+
+// SetCreatedAt sets field value.
+func (o *ScorecardListResponseAttributes) SetCreatedAt(v time.Time) {
+ o.CreatedAt = v
+}
+
+// GetDescription returns the Description field value if set, zero value otherwise.
+func (o *ScorecardListResponseAttributes) GetDescription() string {
+ if o == nil || o.Description == nil {
+ var ret string
+ return ret
+ }
+ return *o.Description
+}
+
+// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *ScorecardListResponseAttributes) GetDescriptionOk() (*string, bool) {
+ if o == nil || o.Description == nil {
+ return nil, false
+ }
+ return o.Description, true
+}
+
+// HasDescription returns a boolean if a field has been set.
+func (o *ScorecardListResponseAttributes) HasDescription() bool {
+ return o != nil && o.Description != nil
+}
+
+// SetDescription gets a reference to the given string and assigns it to the Description field.
+func (o *ScorecardListResponseAttributes) SetDescription(v string) {
+ o.Description = &v
+}
+
+// GetModifiedAt returns the ModifiedAt field value.
+func (o *ScorecardListResponseAttributes) GetModifiedAt() time.Time {
+ if o == nil {
+ var ret time.Time
+ return ret
+ }
+ return o.ModifiedAt
+}
+
+// GetModifiedAtOk returns a tuple with the ModifiedAt field value
+// and a boolean to check if the value has been set.
+func (o *ScorecardListResponseAttributes) GetModifiedAtOk() (*time.Time, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.ModifiedAt, true
+}
+
+// SetModifiedAt sets field value.
+func (o *ScorecardListResponseAttributes) SetModifiedAt(v time.Time) {
+ o.ModifiedAt = v
+}
+
+// GetName returns the Name field value.
+func (o *ScorecardListResponseAttributes) GetName() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+ return o.Name
+}
+
+// GetNameOk returns a tuple with the Name field value
+// and a boolean to check if the value has been set.
+func (o *ScorecardListResponseAttributes) GetNameOk() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Name, true
+}
+
+// SetName sets field value.
+func (o *ScorecardListResponseAttributes) SetName(v string) {
+ o.Name = v
+}
+
+// MarshalJSON serializes the struct using spec logic.
+func (o ScorecardListResponseAttributes) MarshalJSON() ([]byte, error) {
+ toSerialize := map[string]interface{}{}
+ if o.UnparsedObject != nil {
+ return datadog.Marshal(o.UnparsedObject)
+ }
+ if o.CreatedAt.Nanosecond() == 0 {
+ toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00")
+ } else {
+ toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00")
+ }
+ if o.Description != nil {
+ toSerialize["description"] = o.Description
+ }
+ if o.ModifiedAt.Nanosecond() == 0 {
+ toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00")
+ } else {
+ toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00")
+ }
+ toSerialize["name"] = o.Name
+
+ for key, value := range o.AdditionalProperties {
+ toSerialize[key] = value
+ }
+ return datadog.Marshal(toSerialize)
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (o *ScorecardListResponseAttributes) UnmarshalJSON(bytes []byte) (err error) {
+ all := struct {
+ CreatedAt *time.Time `json:"created_at"`
+ Description *string `json:"description,omitempty"`
+ ModifiedAt *time.Time `json:"modified_at"`
+ Name *string `json:"name"`
+ }{}
+ if err = datadog.Unmarshal(bytes, &all); err != nil {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+ if all.CreatedAt == nil {
+ return fmt.Errorf("required field created_at missing")
+ }
+ if all.ModifiedAt == nil {
+ return fmt.Errorf("required field modified_at missing")
+ }
+ if all.Name == nil {
+ return fmt.Errorf("required field name missing")
+ }
+ additionalProperties := make(map[string]interface{})
+ if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
+ datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "description", "modified_at", "name"})
+ } else {
+ return err
+ }
+ o.CreatedAt = *all.CreatedAt
+ o.Description = all.Description
+ o.ModifiedAt = *all.ModifiedAt
+ o.Name = *all.Name
+
+ if len(additionalProperties) > 0 {
+ o.AdditionalProperties = additionalProperties
+ }
+
+ return nil
+}
diff --git a/api/datadogV2/model_scorecard_list_response_data.go b/api/datadogV2/model_scorecard_list_response_data.go
new file mode 100644
index 00000000000..d7bc4a30a41
--- /dev/null
+++ b/api/datadogV2/model_scorecard_list_response_data.go
@@ -0,0 +1,178 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// ScorecardListResponseData Scorecard data.
+type ScorecardListResponseData struct {
+ // Scorecard attributes.
+ Attributes ScorecardListResponseAttributes `json:"attributes"`
+ // The unique ID of the scorecard.
+ Id string `json:"id"`
+ // The JSON:API type for scorecard list.
+ Type ScorecardListType `json:"type"`
+ // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
+ UnparsedObject map[string]interface{} `json:"-"`
+ AdditionalProperties map[string]interface{} `json:"-"`
+}
+
+// NewScorecardListResponseData instantiates a new ScorecardListResponseData object.
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed.
+func NewScorecardListResponseData(attributes ScorecardListResponseAttributes, id string, typeVar ScorecardListType) *ScorecardListResponseData {
+ this := ScorecardListResponseData{}
+ this.Attributes = attributes
+ this.Id = id
+ this.Type = typeVar
+ return &this
+}
+
+// NewScorecardListResponseDataWithDefaults instantiates a new ScorecardListResponseData object.
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set.
+func NewScorecardListResponseDataWithDefaults() *ScorecardListResponseData {
+ this := ScorecardListResponseData{}
+ return &this
+}
+
+// GetAttributes returns the Attributes field value.
+func (o *ScorecardListResponseData) GetAttributes() ScorecardListResponseAttributes {
+ if o == nil {
+ var ret ScorecardListResponseAttributes
+ return ret
+ }
+ return o.Attributes
+}
+
+// GetAttributesOk returns a tuple with the Attributes field value
+// and a boolean to check if the value has been set.
+func (o *ScorecardListResponseData) GetAttributesOk() (*ScorecardListResponseAttributes, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Attributes, true
+}
+
+// SetAttributes sets field value.
+func (o *ScorecardListResponseData) SetAttributes(v ScorecardListResponseAttributes) {
+ o.Attributes = v
+}
+
+// GetId returns the Id field value.
+func (o *ScorecardListResponseData) GetId() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+ return o.Id
+}
+
+// GetIdOk returns a tuple with the Id field value
+// and a boolean to check if the value has been set.
+func (o *ScorecardListResponseData) GetIdOk() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Id, true
+}
+
+// SetId sets field value.
+func (o *ScorecardListResponseData) SetId(v string) {
+ o.Id = v
+}
+
+// GetType returns the Type field value.
+func (o *ScorecardListResponseData) GetType() ScorecardListType {
+ if o == nil {
+ var ret ScorecardListType
+ return ret
+ }
+ return o.Type
+}
+
+// GetTypeOk returns a tuple with the Type field value
+// and a boolean to check if the value has been set.
+func (o *ScorecardListResponseData) GetTypeOk() (*ScorecardListType, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Type, true
+}
+
+// SetType sets field value.
+func (o *ScorecardListResponseData) SetType(v ScorecardListType) {
+ o.Type = v
+}
+
+// MarshalJSON serializes the struct using spec logic.
+func (o ScorecardListResponseData) MarshalJSON() ([]byte, error) {
+ toSerialize := map[string]interface{}{}
+ if o.UnparsedObject != nil {
+ return datadog.Marshal(o.UnparsedObject)
+ }
+ toSerialize["attributes"] = o.Attributes
+ toSerialize["id"] = o.Id
+ toSerialize["type"] = o.Type
+
+ for key, value := range o.AdditionalProperties {
+ toSerialize[key] = value
+ }
+ return datadog.Marshal(toSerialize)
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (o *ScorecardListResponseData) UnmarshalJSON(bytes []byte) (err error) {
+ all := struct {
+ Attributes *ScorecardListResponseAttributes `json:"attributes"`
+ Id *string `json:"id"`
+ Type *ScorecardListType `json:"type"`
+ }{}
+ if err = datadog.Unmarshal(bytes, &all); err != nil {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+ if all.Attributes == nil {
+ return fmt.Errorf("required field attributes missing")
+ }
+ if all.Id == nil {
+ return fmt.Errorf("required field id missing")
+ }
+ if all.Type == nil {
+ return fmt.Errorf("required field type missing")
+ }
+ additionalProperties := make(map[string]interface{})
+ if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
+ datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"})
+ } else {
+ return err
+ }
+
+ hasInvalidField := false
+ if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil {
+ hasInvalidField = true
+ }
+ o.Attributes = *all.Attributes
+ o.Id = *all.Id
+ if !all.Type.IsValid() {
+ hasInvalidField = true
+ } else {
+ o.Type = *all.Type
+ }
+
+ if len(additionalProperties) > 0 {
+ o.AdditionalProperties = additionalProperties
+ }
+
+ if hasInvalidField {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+
+ return nil
+}
diff --git a/api/datadogV2/model_scorecard_list_type.go b/api/datadogV2/model_scorecard_list_type.go
new file mode 100644
index 00000000000..0b34f17d514
--- /dev/null
+++ b/api/datadogV2/model_scorecard_list_type.go
@@ -0,0 +1,64 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// ScorecardListType The JSON:API type for scorecard list.
+type ScorecardListType string
+
+// List of ScorecardListType.
+const (
+ SCORECARDLISTTYPE_SCORECARD ScorecardListType = "scorecard"
+)
+
+var allowedScorecardListTypeEnumValues = []ScorecardListType{
+ SCORECARDLISTTYPE_SCORECARD,
+}
+
+// GetAllowedValues reeturns the list of possible values.
+func (v *ScorecardListType) GetAllowedValues() []ScorecardListType {
+ return allowedScorecardListTypeEnumValues
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (v *ScorecardListType) UnmarshalJSON(src []byte) error {
+ var value string
+ err := datadog.Unmarshal(src, &value)
+ if err != nil {
+ return err
+ }
+ *v = ScorecardListType(value)
+ return nil
+}
+
+// NewScorecardListTypeFromValue returns a pointer to a valid ScorecardListType
+// for the value passed as argument, or an error if the value passed is not allowed by the enum.
+func NewScorecardListTypeFromValue(v string) (*ScorecardListType, error) {
+ ev := ScorecardListType(v)
+ if ev.IsValid() {
+ return &ev, nil
+ }
+ return nil, fmt.Errorf("invalid value '%v' for ScorecardListType: valid values are %v", v, allowedScorecardListTypeEnumValues)
+}
+
+// IsValid return true if the value is valid for the enum, false otherwise.
+func (v ScorecardListType) IsValid() bool {
+ for _, existing := range allowedScorecardListTypeEnumValues {
+ if existing == v {
+ return true
+ }
+ }
+ return false
+}
+
+// Ptr returns reference to ScorecardListType value.
+func (v ScorecardListType) Ptr() *ScorecardListType {
+ return &v
+}
diff --git a/api/datadogV2/model_update_campaign_request.go b/api/datadogV2/model_update_campaign_request.go
new file mode 100644
index 00000000000..3e2ff30071a
--- /dev/null
+++ b/api/datadogV2/model_update_campaign_request.go
@@ -0,0 +1,110 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// UpdateCampaignRequest Request to update a campaign.
+type UpdateCampaignRequest struct {
+ // Data for updating a campaign.
+ Data UpdateCampaignRequestData `json:"data"`
+ // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
+ UnparsedObject map[string]interface{} `json:"-"`
+ AdditionalProperties map[string]interface{} `json:"-"`
+}
+
+// NewUpdateCampaignRequest instantiates a new UpdateCampaignRequest object.
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed.
+func NewUpdateCampaignRequest(data UpdateCampaignRequestData) *UpdateCampaignRequest {
+ this := UpdateCampaignRequest{}
+ this.Data = data
+ return &this
+}
+
+// NewUpdateCampaignRequestWithDefaults instantiates a new UpdateCampaignRequest object.
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set.
+func NewUpdateCampaignRequestWithDefaults() *UpdateCampaignRequest {
+ this := UpdateCampaignRequest{}
+ return &this
+}
+
+// GetData returns the Data field value.
+func (o *UpdateCampaignRequest) GetData() UpdateCampaignRequestData {
+ if o == nil {
+ var ret UpdateCampaignRequestData
+ return ret
+ }
+ return o.Data
+}
+
+// GetDataOk returns a tuple with the Data field value
+// and a boolean to check if the value has been set.
+func (o *UpdateCampaignRequest) GetDataOk() (*UpdateCampaignRequestData, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Data, true
+}
+
+// SetData sets field value.
+func (o *UpdateCampaignRequest) SetData(v UpdateCampaignRequestData) {
+ o.Data = v
+}
+
+// MarshalJSON serializes the struct using spec logic.
+func (o UpdateCampaignRequest) MarshalJSON() ([]byte, error) {
+ toSerialize := map[string]interface{}{}
+ if o.UnparsedObject != nil {
+ return datadog.Marshal(o.UnparsedObject)
+ }
+ toSerialize["data"] = o.Data
+
+ for key, value := range o.AdditionalProperties {
+ toSerialize[key] = value
+ }
+ return datadog.Marshal(toSerialize)
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (o *UpdateCampaignRequest) UnmarshalJSON(bytes []byte) (err error) {
+ all := struct {
+ Data *UpdateCampaignRequestData `json:"data"`
+ }{}
+ if err = datadog.Unmarshal(bytes, &all); err != nil {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+ if all.Data == nil {
+ return fmt.Errorf("required field data missing")
+ }
+ additionalProperties := make(map[string]interface{})
+ if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
+ datadog.DeleteKeys(additionalProperties, &[]string{"data"})
+ } else {
+ return err
+ }
+
+ hasInvalidField := false
+ if all.Data.UnparsedObject != nil && o.UnparsedObject == nil {
+ hasInvalidField = true
+ }
+ o.Data = *all.Data
+
+ if len(additionalProperties) > 0 {
+ o.AdditionalProperties = additionalProperties
+ }
+
+ if hasInvalidField {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+
+ return nil
+}
diff --git a/api/datadogV2/model_update_campaign_request_attributes.go b/api/datadogV2/model_update_campaign_request_attributes.go
new file mode 100644
index 00000000000..6994070932b
--- /dev/null
+++ b/api/datadogV2/model_update_campaign_request_attributes.go
@@ -0,0 +1,413 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+ "time"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// UpdateCampaignRequestAttributes Attributes for updating a campaign.
+type UpdateCampaignRequestAttributes struct {
+ // The description of the campaign.
+ Description *string `json:"description,omitempty"`
+ // The due date of the campaign.
+ DueDate *time.Time `json:"due_date,omitempty"`
+ // Entity scope query to filter entities for this campaign.
+ EntityScope *string `json:"entity_scope,omitempty"`
+ // Guidance for the campaign.
+ Guidance *string `json:"guidance,omitempty"`
+ // The unique key for the campaign.
+ Key *string `json:"key,omitempty"`
+ // The name of the campaign.
+ Name string `json:"name"`
+ // The UUID of the campaign owner.
+ OwnerId string `json:"owner_id"`
+ // Array of rule IDs associated with this campaign.
+ RuleIds []string `json:"rule_ids"`
+ // The start date of the campaign.
+ StartDate time.Time `json:"start_date"`
+ // The status of the campaign.
+ Status string `json:"status"`
+ // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
+ UnparsedObject map[string]interface{} `json:"-"`
+ AdditionalProperties map[string]interface{} `json:"-"`
+}
+
+// NewUpdateCampaignRequestAttributes instantiates a new UpdateCampaignRequestAttributes object.
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed.
+func NewUpdateCampaignRequestAttributes(name string, ownerId string, ruleIds []string, startDate time.Time, status string) *UpdateCampaignRequestAttributes {
+ this := UpdateCampaignRequestAttributes{}
+ this.Name = name
+ this.OwnerId = ownerId
+ this.RuleIds = ruleIds
+ this.StartDate = startDate
+ this.Status = status
+ return &this
+}
+
+// NewUpdateCampaignRequestAttributesWithDefaults instantiates a new UpdateCampaignRequestAttributes object.
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set.
+func NewUpdateCampaignRequestAttributesWithDefaults() *UpdateCampaignRequestAttributes {
+ this := UpdateCampaignRequestAttributes{}
+ return &this
+}
+
+// GetDescription returns the Description field value if set, zero value otherwise.
+func (o *UpdateCampaignRequestAttributes) GetDescription() string {
+ if o == nil || o.Description == nil {
+ var ret string
+ return ret
+ }
+ return *o.Description
+}
+
+// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *UpdateCampaignRequestAttributes) GetDescriptionOk() (*string, bool) {
+ if o == nil || o.Description == nil {
+ return nil, false
+ }
+ return o.Description, true
+}
+
+// HasDescription returns a boolean if a field has been set.
+func (o *UpdateCampaignRequestAttributes) HasDescription() bool {
+ return o != nil && o.Description != nil
+}
+
+// SetDescription gets a reference to the given string and assigns it to the Description field.
+func (o *UpdateCampaignRequestAttributes) SetDescription(v string) {
+ o.Description = &v
+}
+
+// GetDueDate returns the DueDate field value if set, zero value otherwise.
+func (o *UpdateCampaignRequestAttributes) GetDueDate() time.Time {
+ if o == nil || o.DueDate == nil {
+ var ret time.Time
+ return ret
+ }
+ return *o.DueDate
+}
+
+// GetDueDateOk returns a tuple with the DueDate field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *UpdateCampaignRequestAttributes) GetDueDateOk() (*time.Time, bool) {
+ if o == nil || o.DueDate == nil {
+ return nil, false
+ }
+ return o.DueDate, true
+}
+
+// HasDueDate returns a boolean if a field has been set.
+func (o *UpdateCampaignRequestAttributes) HasDueDate() bool {
+ return o != nil && o.DueDate != nil
+}
+
+// SetDueDate gets a reference to the given time.Time and assigns it to the DueDate field.
+func (o *UpdateCampaignRequestAttributes) SetDueDate(v time.Time) {
+ o.DueDate = &v
+}
+
+// GetEntityScope returns the EntityScope field value if set, zero value otherwise.
+func (o *UpdateCampaignRequestAttributes) GetEntityScope() string {
+ if o == nil || o.EntityScope == nil {
+ var ret string
+ return ret
+ }
+ return *o.EntityScope
+}
+
+// GetEntityScopeOk returns a tuple with the EntityScope field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *UpdateCampaignRequestAttributes) GetEntityScopeOk() (*string, bool) {
+ if o == nil || o.EntityScope == nil {
+ return nil, false
+ }
+ return o.EntityScope, true
+}
+
+// HasEntityScope returns a boolean if a field has been set.
+func (o *UpdateCampaignRequestAttributes) HasEntityScope() bool {
+ return o != nil && o.EntityScope != nil
+}
+
+// SetEntityScope gets a reference to the given string and assigns it to the EntityScope field.
+func (o *UpdateCampaignRequestAttributes) SetEntityScope(v string) {
+ o.EntityScope = &v
+}
+
+// GetGuidance returns the Guidance field value if set, zero value otherwise.
+func (o *UpdateCampaignRequestAttributes) GetGuidance() string {
+ if o == nil || o.Guidance == nil {
+ var ret string
+ return ret
+ }
+ return *o.Guidance
+}
+
+// GetGuidanceOk returns a tuple with the Guidance field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *UpdateCampaignRequestAttributes) GetGuidanceOk() (*string, bool) {
+ if o == nil || o.Guidance == nil {
+ return nil, false
+ }
+ return o.Guidance, true
+}
+
+// HasGuidance returns a boolean if a field has been set.
+func (o *UpdateCampaignRequestAttributes) HasGuidance() bool {
+ return o != nil && o.Guidance != nil
+}
+
+// SetGuidance gets a reference to the given string and assigns it to the Guidance field.
+func (o *UpdateCampaignRequestAttributes) SetGuidance(v string) {
+ o.Guidance = &v
+}
+
+// GetKey returns the Key field value if set, zero value otherwise.
+func (o *UpdateCampaignRequestAttributes) GetKey() string {
+ if o == nil || o.Key == nil {
+ var ret string
+ return ret
+ }
+ return *o.Key
+}
+
+// GetKeyOk returns a tuple with the Key field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *UpdateCampaignRequestAttributes) GetKeyOk() (*string, bool) {
+ if o == nil || o.Key == nil {
+ return nil, false
+ }
+ return o.Key, true
+}
+
+// HasKey returns a boolean if a field has been set.
+func (o *UpdateCampaignRequestAttributes) HasKey() bool {
+ return o != nil && o.Key != nil
+}
+
+// SetKey gets a reference to the given string and assigns it to the Key field.
+func (o *UpdateCampaignRequestAttributes) SetKey(v string) {
+ o.Key = &v
+}
+
+// GetName returns the Name field value.
+func (o *UpdateCampaignRequestAttributes) GetName() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+ return o.Name
+}
+
+// GetNameOk returns a tuple with the Name field value
+// and a boolean to check if the value has been set.
+func (o *UpdateCampaignRequestAttributes) GetNameOk() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Name, true
+}
+
+// SetName sets field value.
+func (o *UpdateCampaignRequestAttributes) SetName(v string) {
+ o.Name = v
+}
+
+// GetOwnerId returns the OwnerId field value.
+func (o *UpdateCampaignRequestAttributes) GetOwnerId() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+ return o.OwnerId
+}
+
+// GetOwnerIdOk returns a tuple with the OwnerId field value
+// and a boolean to check if the value has been set.
+func (o *UpdateCampaignRequestAttributes) GetOwnerIdOk() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.OwnerId, true
+}
+
+// SetOwnerId sets field value.
+func (o *UpdateCampaignRequestAttributes) SetOwnerId(v string) {
+ o.OwnerId = v
+}
+
+// GetRuleIds returns the RuleIds field value.
+func (o *UpdateCampaignRequestAttributes) GetRuleIds() []string {
+ if o == nil {
+ var ret []string
+ return ret
+ }
+ return o.RuleIds
+}
+
+// GetRuleIdsOk returns a tuple with the RuleIds field value
+// and a boolean to check if the value has been set.
+func (o *UpdateCampaignRequestAttributes) GetRuleIdsOk() (*[]string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.RuleIds, true
+}
+
+// SetRuleIds sets field value.
+func (o *UpdateCampaignRequestAttributes) SetRuleIds(v []string) {
+ o.RuleIds = v
+}
+
+// GetStartDate returns the StartDate field value.
+func (o *UpdateCampaignRequestAttributes) GetStartDate() time.Time {
+ if o == nil {
+ var ret time.Time
+ return ret
+ }
+ return o.StartDate
+}
+
+// GetStartDateOk returns a tuple with the StartDate field value
+// and a boolean to check if the value has been set.
+func (o *UpdateCampaignRequestAttributes) GetStartDateOk() (*time.Time, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.StartDate, true
+}
+
+// SetStartDate sets field value.
+func (o *UpdateCampaignRequestAttributes) SetStartDate(v time.Time) {
+ o.StartDate = v
+}
+
+// GetStatus returns the Status field value.
+func (o *UpdateCampaignRequestAttributes) GetStatus() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+ return o.Status
+}
+
+// GetStatusOk returns a tuple with the Status field value
+// and a boolean to check if the value has been set.
+func (o *UpdateCampaignRequestAttributes) GetStatusOk() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Status, true
+}
+
+// SetStatus sets field value.
+func (o *UpdateCampaignRequestAttributes) SetStatus(v string) {
+ o.Status = v
+}
+
+// MarshalJSON serializes the struct using spec logic.
+func (o UpdateCampaignRequestAttributes) MarshalJSON() ([]byte, error) {
+ toSerialize := map[string]interface{}{}
+ if o.UnparsedObject != nil {
+ return datadog.Marshal(o.UnparsedObject)
+ }
+ if o.Description != nil {
+ toSerialize["description"] = o.Description
+ }
+ if o.DueDate != nil {
+ if o.DueDate.Nanosecond() == 0 {
+ toSerialize["due_date"] = o.DueDate.Format("2006-01-02T15:04:05Z07:00")
+ } else {
+ toSerialize["due_date"] = o.DueDate.Format("2006-01-02T15:04:05.000Z07:00")
+ }
+ }
+ if o.EntityScope != nil {
+ toSerialize["entity_scope"] = o.EntityScope
+ }
+ if o.Guidance != nil {
+ toSerialize["guidance"] = o.Guidance
+ }
+ if o.Key != nil {
+ toSerialize["key"] = o.Key
+ }
+ toSerialize["name"] = o.Name
+ toSerialize["owner_id"] = o.OwnerId
+ toSerialize["rule_ids"] = o.RuleIds
+ if o.StartDate.Nanosecond() == 0 {
+ toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05Z07:00")
+ } else {
+ toSerialize["start_date"] = o.StartDate.Format("2006-01-02T15:04:05.000Z07:00")
+ }
+ toSerialize["status"] = o.Status
+
+ for key, value := range o.AdditionalProperties {
+ toSerialize[key] = value
+ }
+ return datadog.Marshal(toSerialize)
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (o *UpdateCampaignRequestAttributes) UnmarshalJSON(bytes []byte) (err error) {
+ all := struct {
+ Description *string `json:"description,omitempty"`
+ DueDate *time.Time `json:"due_date,omitempty"`
+ EntityScope *string `json:"entity_scope,omitempty"`
+ Guidance *string `json:"guidance,omitempty"`
+ Key *string `json:"key,omitempty"`
+ Name *string `json:"name"`
+ OwnerId *string `json:"owner_id"`
+ RuleIds *[]string `json:"rule_ids"`
+ StartDate *time.Time `json:"start_date"`
+ Status *string `json:"status"`
+ }{}
+ if err = datadog.Unmarshal(bytes, &all); err != nil {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+ if all.Name == nil {
+ return fmt.Errorf("required field name missing")
+ }
+ if all.OwnerId == nil {
+ return fmt.Errorf("required field owner_id missing")
+ }
+ if all.RuleIds == nil {
+ return fmt.Errorf("required field rule_ids missing")
+ }
+ if all.StartDate == nil {
+ return fmt.Errorf("required field start_date missing")
+ }
+ if all.Status == nil {
+ return fmt.Errorf("required field status missing")
+ }
+ additionalProperties := make(map[string]interface{})
+ if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
+ datadog.DeleteKeys(additionalProperties, &[]string{"description", "due_date", "entity_scope", "guidance", "key", "name", "owner_id", "rule_ids", "start_date", "status"})
+ } else {
+ return err
+ }
+ o.Description = all.Description
+ o.DueDate = all.DueDate
+ o.EntityScope = all.EntityScope
+ o.Guidance = all.Guidance
+ o.Key = all.Key
+ o.Name = *all.Name
+ o.OwnerId = *all.OwnerId
+ o.RuleIds = *all.RuleIds
+ o.StartDate = *all.StartDate
+ o.Status = *all.Status
+
+ if len(additionalProperties) > 0 {
+ o.AdditionalProperties = additionalProperties
+ }
+
+ return nil
+}
diff --git a/api/datadogV2/model_update_campaign_request_data.go b/api/datadogV2/model_update_campaign_request_data.go
new file mode 100644
index 00000000000..578967a43f6
--- /dev/null
+++ b/api/datadogV2/model_update_campaign_request_data.go
@@ -0,0 +1,146 @@
+// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
+// This product includes software developed at Datadog (https://www.datadoghq.com/).
+// Copyright 2019-Present Datadog, Inc.
+
+package datadogV2
+
+import (
+ "fmt"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+)
+
+// UpdateCampaignRequestData Data for updating a campaign.
+type UpdateCampaignRequestData struct {
+ // Attributes for updating a campaign.
+ Attributes UpdateCampaignRequestAttributes `json:"attributes"`
+ // The JSON:API type for campaigns.
+ Type CampaignType `json:"type"`
+ // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
+ UnparsedObject map[string]interface{} `json:"-"`
+ AdditionalProperties map[string]interface{} `json:"-"`
+}
+
+// NewUpdateCampaignRequestData instantiates a new UpdateCampaignRequestData object.
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed.
+func NewUpdateCampaignRequestData(attributes UpdateCampaignRequestAttributes, typeVar CampaignType) *UpdateCampaignRequestData {
+ this := UpdateCampaignRequestData{}
+ this.Attributes = attributes
+ this.Type = typeVar
+ return &this
+}
+
+// NewUpdateCampaignRequestDataWithDefaults instantiates a new UpdateCampaignRequestData object.
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set.
+func NewUpdateCampaignRequestDataWithDefaults() *UpdateCampaignRequestData {
+ this := UpdateCampaignRequestData{}
+ return &this
+}
+
+// GetAttributes returns the Attributes field value.
+func (o *UpdateCampaignRequestData) GetAttributes() UpdateCampaignRequestAttributes {
+ if o == nil {
+ var ret UpdateCampaignRequestAttributes
+ return ret
+ }
+ return o.Attributes
+}
+
+// GetAttributesOk returns a tuple with the Attributes field value
+// and a boolean to check if the value has been set.
+func (o *UpdateCampaignRequestData) GetAttributesOk() (*UpdateCampaignRequestAttributes, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Attributes, true
+}
+
+// SetAttributes sets field value.
+func (o *UpdateCampaignRequestData) SetAttributes(v UpdateCampaignRequestAttributes) {
+ o.Attributes = v
+}
+
+// GetType returns the Type field value.
+func (o *UpdateCampaignRequestData) GetType() CampaignType {
+ if o == nil {
+ var ret CampaignType
+ return ret
+ }
+ return o.Type
+}
+
+// GetTypeOk returns a tuple with the Type field value
+// and a boolean to check if the value has been set.
+func (o *UpdateCampaignRequestData) GetTypeOk() (*CampaignType, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Type, true
+}
+
+// SetType sets field value.
+func (o *UpdateCampaignRequestData) SetType(v CampaignType) {
+ o.Type = v
+}
+
+// MarshalJSON serializes the struct using spec logic.
+func (o UpdateCampaignRequestData) MarshalJSON() ([]byte, error) {
+ toSerialize := map[string]interface{}{}
+ if o.UnparsedObject != nil {
+ return datadog.Marshal(o.UnparsedObject)
+ }
+ toSerialize["attributes"] = o.Attributes
+ toSerialize["type"] = o.Type
+
+ for key, value := range o.AdditionalProperties {
+ toSerialize[key] = value
+ }
+ return datadog.Marshal(toSerialize)
+}
+
+// UnmarshalJSON deserializes the given payload.
+func (o *UpdateCampaignRequestData) UnmarshalJSON(bytes []byte) (err error) {
+ all := struct {
+ Attributes *UpdateCampaignRequestAttributes `json:"attributes"`
+ Type *CampaignType `json:"type"`
+ }{}
+ if err = datadog.Unmarshal(bytes, &all); err != nil {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+ if all.Attributes == nil {
+ return fmt.Errorf("required field attributes missing")
+ }
+ if all.Type == nil {
+ return fmt.Errorf("required field type missing")
+ }
+ additionalProperties := make(map[string]interface{})
+ if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
+ datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"})
+ } else {
+ return err
+ }
+
+ hasInvalidField := false
+ if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil {
+ hasInvalidField = true
+ }
+ o.Attributes = *all.Attributes
+ if !all.Type.IsValid() {
+ hasInvalidField = true
+ } else {
+ o.Type = *all.Type
+ }
+
+ if len(additionalProperties) > 0 {
+ o.AdditionalProperties = additionalProperties
+ }
+
+ if hasInvalidField {
+ return datadog.Unmarshal(bytes, &o.UnparsedObject)
+ }
+
+ return nil
+}
diff --git a/api/datadogV2/model_update_rule_request_data.go b/api/datadogV2/model_update_rule_request_data.go
index b98012f8da4..c6c067979a2 100644
--- a/api/datadogV2/model_update_rule_request_data.go
+++ b/api/datadogV2/model_update_rule_request_data.go
@@ -10,8 +10,8 @@ import (
// UpdateRuleRequestData Data for the request to update a scorecard rule.
type UpdateRuleRequestData struct {
- // Details of a rule.
- Attributes *RuleAttributes `json:"attributes,omitempty"`
+ // Attributes for creating or updating a rule. Server-managed fields (created_at, modified_at, custom) are excluded.
+ Attributes *RuleAttributesRequest `json:"attributes,omitempty"`
// The JSON:API type for scorecard rules.
Type *RuleType `json:"type,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
@@ -41,9 +41,9 @@ func NewUpdateRuleRequestDataWithDefaults() *UpdateRuleRequestData {
}
// GetAttributes returns the Attributes field value if set, zero value otherwise.
-func (o *UpdateRuleRequestData) GetAttributes() RuleAttributes {
+func (o *UpdateRuleRequestData) GetAttributes() RuleAttributesRequest {
if o == nil || o.Attributes == nil {
- var ret RuleAttributes
+ var ret RuleAttributesRequest
return ret
}
return *o.Attributes
@@ -51,7 +51,7 @@ func (o *UpdateRuleRequestData) GetAttributes() RuleAttributes {
// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise
// and a boolean to check if the value has been set.
-func (o *UpdateRuleRequestData) GetAttributesOk() (*RuleAttributes, bool) {
+func (o *UpdateRuleRequestData) GetAttributesOk() (*RuleAttributesRequest, bool) {
if o == nil || o.Attributes == nil {
return nil, false
}
@@ -63,8 +63,8 @@ func (o *UpdateRuleRequestData) HasAttributes() bool {
return o != nil && o.Attributes != nil
}
-// SetAttributes gets a reference to the given RuleAttributes and assigns it to the Attributes field.
-func (o *UpdateRuleRequestData) SetAttributes(v RuleAttributes) {
+// SetAttributes gets a reference to the given RuleAttributesRequest and assigns it to the Attributes field.
+func (o *UpdateRuleRequestData) SetAttributes(v RuleAttributesRequest) {
o.Attributes = &v
}
@@ -118,8 +118,8 @@ func (o UpdateRuleRequestData) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *UpdateRuleRequestData) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
- Attributes *RuleAttributes `json:"attributes,omitempty"`
- Type *RuleType `json:"type,omitempty"`
+ Attributes *RuleAttributesRequest `json:"attributes,omitempty"`
+ Type *RuleType `json:"type,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
diff --git a/examples/v2/scorecards/CreateScorecardCampaign.go b/examples/v2/scorecards/CreateScorecardCampaign.go
new file mode 100644
index 00000000000..8a7e5508d35
--- /dev/null
+++ b/examples/v2/scorecards/CreateScorecardCampaign.go
@@ -0,0 +1,50 @@
+// Create a new campaign returns "Created" response
+
+package main
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "os"
+ "time"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
+)
+
+func main() {
+ body := datadogV2.CreateCampaignRequest{
+ Data: datadogV2.CreateCampaignRequestData{
+ Attributes: datadogV2.CreateCampaignRequestAttributes{
+ Description: datadog.PtrString("Campaign to improve security posture for Q1 2024."),
+ DueDate: datadog.PtrTime(time.Date(2024, 3, 31, 23, 59, 59, 0, time.UTC)),
+ EntityScope: datadog.PtrString("kind:service AND team:platform"),
+ Guidance: datadog.PtrString("Please ensure all services pass the security requirements."),
+ Key: "q1-security-2024",
+ Name: "Q1 Security Campaign",
+ OwnerId: "550e8400-e29b-41d4-a716-446655440000",
+ RuleIds: []string{
+ "q8MQxk8TCqrHnWkx",
+ "r9NRyl9UDrsIoXly",
+ },
+ StartDate: time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC),
+ Status: datadogV2.CAMPAIGNSTATUS_IN_PROGRESS.Ptr(),
+ },
+ Type: datadogV2.CAMPAIGNTYPE_CAMPAIGN,
+ },
+ }
+ ctx := datadog.NewDefaultContext(context.Background())
+ configuration := datadog.NewConfiguration()
+ apiClient := datadog.NewAPIClient(configuration)
+ api := datadogV2.NewScorecardsApi(apiClient)
+ resp, r, err := api.CreateScorecardCampaign(ctx, body)
+
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.CreateScorecardCampaign`: %v\n", err)
+ fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
+ }
+
+ responseContent, _ := json.MarshalIndent(resp, "", " ")
+ fmt.Fprintf(os.Stdout, "Response from `ScorecardsApi.CreateScorecardCampaign`:\n%s\n", responseContent)
+}
diff --git a/examples/v2/service-scorecards/CreateScorecardOutcomesBatch.go b/examples/v2/scorecards/CreateScorecardOutcomesBatch.go
similarity index 82%
rename from examples/v2/service-scorecards/CreateScorecardOutcomesBatch.go
rename to examples/v2/scorecards/CreateScorecardOutcomesBatch.go
index 33dc45c2545..855cf588cee 100644
--- a/examples/v2/service-scorecards/CreateScorecardOutcomesBatch.go
+++ b/examples/v2/scorecards/CreateScorecardOutcomesBatch.go
@@ -35,14 +35,14 @@ func main() {
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("v2.CreateScorecardOutcomesBatch", true)
apiClient := datadog.NewAPIClient(configuration)
- api := datadogV2.NewServiceScorecardsApi(apiClient)
+ api := datadogV2.NewScorecardsApi(apiClient)
resp, r, err := api.CreateScorecardOutcomesBatch(ctx, body)
if err != nil {
- fmt.Fprintf(os.Stderr, "Error when calling `ServiceScorecardsApi.CreateScorecardOutcomesBatch`: %v\n", err)
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.CreateScorecardOutcomesBatch`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
- fmt.Fprintf(os.Stdout, "Response from `ServiceScorecardsApi.CreateScorecardOutcomesBatch`:\n%s\n", responseContent)
+ fmt.Fprintf(os.Stdout, "Response from `ScorecardsApi.CreateScorecardOutcomesBatch`:\n%s\n", responseContent)
}
diff --git a/examples/v2/service-scorecards/CreateScorecardRule.go b/examples/v2/scorecards/CreateScorecardRule.go
similarity index 65%
rename from examples/v2/service-scorecards/CreateScorecardRule.go
rename to examples/v2/scorecards/CreateScorecardRule.go
index f7fa4a62f40..1bab7d19dd7 100644
--- a/examples/v2/service-scorecards/CreateScorecardRule.go
+++ b/examples/v2/scorecards/CreateScorecardRule.go
@@ -15,9 +15,9 @@ import (
func main() {
body := datadogV2.CreateRuleRequest{
Data: &datadogV2.CreateRuleRequestData{
- Attributes: &datadogV2.RuleAttributes{
+ Attributes: &datadogV2.RuleAttributesRequest{
Enabled: datadog.PtrBool(true),
- Name: datadog.PtrString("Example-Service-Scorecard"),
+ Name: datadog.PtrString("Example-Scorecard"),
ScorecardName: datadog.PtrString("Observability Best Practices"),
},
Type: datadogV2.RULETYPE_RULE.Ptr(),
@@ -25,16 +25,15 @@ func main() {
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
- configuration.SetUnstableOperationEnabled("v2.CreateScorecardRule", true)
apiClient := datadog.NewAPIClient(configuration)
- api := datadogV2.NewServiceScorecardsApi(apiClient)
+ api := datadogV2.NewScorecardsApi(apiClient)
resp, r, err := api.CreateScorecardRule(ctx, body)
if err != nil {
- fmt.Fprintf(os.Stderr, "Error when calling `ServiceScorecardsApi.CreateScorecardRule`: %v\n", err)
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.CreateScorecardRule`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
- fmt.Fprintf(os.Stdout, "Response from `ServiceScorecardsApi.CreateScorecardRule`:\n%s\n", responseContent)
+ fmt.Fprintf(os.Stdout, "Response from `ScorecardsApi.CreateScorecardRule`:\n%s\n", responseContent)
}
diff --git a/examples/v2/scorecards/DeleteScorecardCampaign.go b/examples/v2/scorecards/DeleteScorecardCampaign.go
new file mode 100644
index 00000000000..76029c7b16f
--- /dev/null
+++ b/examples/v2/scorecards/DeleteScorecardCampaign.go
@@ -0,0 +1,25 @@
+// Delete a campaign returns "No Content" response
+
+package main
+
+import (
+ "context"
+ "fmt"
+ "os"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
+)
+
+func main() {
+ ctx := datadog.NewDefaultContext(context.Background())
+ configuration := datadog.NewConfiguration()
+ apiClient := datadog.NewAPIClient(configuration)
+ api := datadogV2.NewScorecardsApi(apiClient)
+ r, err := api.DeleteScorecardCampaign(ctx, "c10ODp0VCrrIpXmz")
+
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.DeleteScorecardCampaign`: %v\n", err)
+ fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
+ }
+}
diff --git a/examples/v2/service-scorecards/DeleteScorecardRule.go b/examples/v2/scorecards/DeleteScorecardRule.go
similarity index 74%
rename from examples/v2/service-scorecards/DeleteScorecardRule.go
rename to examples/v2/scorecards/DeleteScorecardRule.go
index 7646cec928c..a8a5d845ca3 100644
--- a/examples/v2/service-scorecards/DeleteScorecardRule.go
+++ b/examples/v2/scorecards/DeleteScorecardRule.go
@@ -17,13 +17,12 @@ func main() {
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
- configuration.SetUnstableOperationEnabled("v2.DeleteScorecardRule", true)
apiClient := datadog.NewAPIClient(configuration)
- api := datadogV2.NewServiceScorecardsApi(apiClient)
+ api := datadogV2.NewScorecardsApi(apiClient)
r, err := api.DeleteScorecardRule(ctx, CreateScorecardRuleDataID)
if err != nil {
- fmt.Fprintf(os.Stderr, "Error when calling `ServiceScorecardsApi.DeleteScorecardRule`: %v\n", err)
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.DeleteScorecardRule`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
diff --git a/examples/v2/scorecards/GetScorecardCampaign.go b/examples/v2/scorecards/GetScorecardCampaign.go
new file mode 100644
index 00000000000..13aceb508b7
--- /dev/null
+++ b/examples/v2/scorecards/GetScorecardCampaign.go
@@ -0,0 +1,29 @@
+// Get a campaign returns "OK" response
+
+package main
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "os"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
+)
+
+func main() {
+ ctx := datadog.NewDefaultContext(context.Background())
+ configuration := datadog.NewConfiguration()
+ apiClient := datadog.NewAPIClient(configuration)
+ api := datadogV2.NewScorecardsApi(apiClient)
+ resp, r, err := api.GetScorecardCampaign(ctx, "c10ODp0VCrrIpXmz", *datadogV2.NewGetScorecardCampaignOptionalParameters())
+
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.GetScorecardCampaign`: %v\n", err)
+ fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
+ }
+
+ responseContent, _ := json.MarshalIndent(resp, "", " ")
+ fmt.Fprintf(os.Stdout, "Response from `ScorecardsApi.GetScorecardCampaign`:\n%s\n", responseContent)
+}
diff --git a/examples/v2/scorecards/ListScorecardCampaigns.go b/examples/v2/scorecards/ListScorecardCampaigns.go
new file mode 100644
index 00000000000..3adbd41279c
--- /dev/null
+++ b/examples/v2/scorecards/ListScorecardCampaigns.go
@@ -0,0 +1,29 @@
+// List all campaigns returns "OK" response
+
+package main
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "os"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
+)
+
+func main() {
+ ctx := datadog.NewDefaultContext(context.Background())
+ configuration := datadog.NewConfiguration()
+ apiClient := datadog.NewAPIClient(configuration)
+ api := datadogV2.NewScorecardsApi(apiClient)
+ resp, r, err := api.ListScorecardCampaigns(ctx, *datadogV2.NewListScorecardCampaignsOptionalParameters())
+
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.ListScorecardCampaigns`: %v\n", err)
+ fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
+ }
+
+ responseContent, _ := json.MarshalIndent(resp, "", " ")
+ fmt.Fprintf(os.Stdout, "Response from `ScorecardsApi.ListScorecardCampaigns`:\n%s\n", responseContent)
+}
diff --git a/examples/v2/service-scorecards/ListScorecardOutcomes.go b/examples/v2/scorecards/ListScorecardOutcomes.go
similarity index 65%
rename from examples/v2/service-scorecards/ListScorecardOutcomes.go
rename to examples/v2/scorecards/ListScorecardOutcomes.go
index b7259fa3072..bfb4e27cd64 100644
--- a/examples/v2/service-scorecards/ListScorecardOutcomes.go
+++ b/examples/v2/scorecards/ListScorecardOutcomes.go
@@ -15,16 +15,15 @@ import (
func main() {
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
- configuration.SetUnstableOperationEnabled("v2.ListScorecardOutcomes", true)
apiClient := datadog.NewAPIClient(configuration)
- api := datadogV2.NewServiceScorecardsApi(apiClient)
+ api := datadogV2.NewScorecardsApi(apiClient)
resp, r, err := api.ListScorecardOutcomes(ctx, *datadogV2.NewListScorecardOutcomesOptionalParameters())
if err != nil {
- fmt.Fprintf(os.Stderr, "Error when calling `ServiceScorecardsApi.ListScorecardOutcomes`: %v\n", err)
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.ListScorecardOutcomes`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
- fmt.Fprintf(os.Stdout, "Response from `ServiceScorecardsApi.ListScorecardOutcomes`:\n%s\n", responseContent)
+ fmt.Fprintf(os.Stdout, "Response from `ScorecardsApi.ListScorecardOutcomes`:\n%s\n", responseContent)
}
diff --git a/examples/v2/service-scorecards/ListScorecardOutcomes_2663454275.go b/examples/v2/scorecards/ListScorecardOutcomes_2663454275.go
similarity index 76%
rename from examples/v2/service-scorecards/ListScorecardOutcomes_2663454275.go
rename to examples/v2/scorecards/ListScorecardOutcomes_2663454275.go
index 873d681bce2..d3cc80e3166 100644
--- a/examples/v2/service-scorecards/ListScorecardOutcomes_2663454275.go
+++ b/examples/v2/scorecards/ListScorecardOutcomes_2663454275.go
@@ -15,14 +15,13 @@ import (
func main() {
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
- configuration.SetUnstableOperationEnabled("v2.ListScorecardOutcomes", true)
apiClient := datadog.NewAPIClient(configuration)
- api := datadogV2.NewServiceScorecardsApi(apiClient)
+ api := datadogV2.NewScorecardsApi(apiClient)
resp, _ := api.ListScorecardOutcomesWithPagination(ctx, *datadogV2.NewListScorecardOutcomesOptionalParameters().WithPageSize(2).WithFieldsOutcome("state").WithFilterOutcomeServiceName("my-service"))
for paginationResult := range resp {
if paginationResult.Error != nil {
- fmt.Fprintf(os.Stderr, "Error when calling `ServiceScorecardsApi.ListScorecardOutcomes`: %v\n", paginationResult.Error)
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.ListScorecardOutcomes`: %v\n", paginationResult.Error)
}
responseContent, _ := json.MarshalIndent(paginationResult.Item, "", " ")
fmt.Fprintf(os.Stdout, "%s\n", responseContent)
diff --git a/examples/v2/service-scorecards/ListScorecardRules.go b/examples/v2/scorecards/ListScorecardRules.go
similarity index 65%
rename from examples/v2/service-scorecards/ListScorecardRules.go
rename to examples/v2/scorecards/ListScorecardRules.go
index 40b282e8396..79ab5a9eac7 100644
--- a/examples/v2/service-scorecards/ListScorecardRules.go
+++ b/examples/v2/scorecards/ListScorecardRules.go
@@ -15,16 +15,15 @@ import (
func main() {
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
- configuration.SetUnstableOperationEnabled("v2.ListScorecardRules", true)
apiClient := datadog.NewAPIClient(configuration)
- api := datadogV2.NewServiceScorecardsApi(apiClient)
+ api := datadogV2.NewScorecardsApi(apiClient)
resp, r, err := api.ListScorecardRules(ctx, *datadogV2.NewListScorecardRulesOptionalParameters())
if err != nil {
- fmt.Fprintf(os.Stderr, "Error when calling `ServiceScorecardsApi.ListScorecardRules`: %v\n", err)
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.ListScorecardRules`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
- fmt.Fprintf(os.Stdout, "Response from `ServiceScorecardsApi.ListScorecardRules`:\n%s\n", responseContent)
+ fmt.Fprintf(os.Stdout, "Response from `ScorecardsApi.ListScorecardRules`:\n%s\n", responseContent)
}
diff --git a/examples/v2/service-scorecards/ListScorecardRules_4057666343.go b/examples/v2/scorecards/ListScorecardRules_4057666343.go
similarity index 76%
rename from examples/v2/service-scorecards/ListScorecardRules_4057666343.go
rename to examples/v2/scorecards/ListScorecardRules_4057666343.go
index ec2f69debc0..0c58b8a8d82 100644
--- a/examples/v2/service-scorecards/ListScorecardRules_4057666343.go
+++ b/examples/v2/scorecards/ListScorecardRules_4057666343.go
@@ -15,14 +15,13 @@ import (
func main() {
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
- configuration.SetUnstableOperationEnabled("v2.ListScorecardRules", true)
apiClient := datadog.NewAPIClient(configuration)
- api := datadogV2.NewServiceScorecardsApi(apiClient)
+ api := datadogV2.NewScorecardsApi(apiClient)
resp, _ := api.ListScorecardRulesWithPagination(ctx, *datadogV2.NewListScorecardRulesOptionalParameters().WithPageSize(2).WithFieldsRule("name").WithFilterRuleCustom(true))
for paginationResult := range resp {
if paginationResult.Error != nil {
- fmt.Fprintf(os.Stderr, "Error when calling `ServiceScorecardsApi.ListScorecardRules`: %v\n", paginationResult.Error)
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.ListScorecardRules`: %v\n", paginationResult.Error)
}
responseContent, _ := json.MarshalIndent(paginationResult.Item, "", " ")
fmt.Fprintf(os.Stdout, "%s\n", responseContent)
diff --git a/examples/v2/scorecards/ListScorecards.go b/examples/v2/scorecards/ListScorecards.go
new file mode 100644
index 00000000000..968e24ee26a
--- /dev/null
+++ b/examples/v2/scorecards/ListScorecards.go
@@ -0,0 +1,29 @@
+// List all scorecards returns "OK" response
+
+package main
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "os"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
+)
+
+func main() {
+ ctx := datadog.NewDefaultContext(context.Background())
+ configuration := datadog.NewConfiguration()
+ apiClient := datadog.NewAPIClient(configuration)
+ api := datadogV2.NewScorecardsApi(apiClient)
+ resp, r, err := api.ListScorecards(ctx, *datadogV2.NewListScorecardsOptionalParameters())
+
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.ListScorecards`: %v\n", err)
+ fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
+ }
+
+ responseContent, _ := json.MarshalIndent(resp, "", " ")
+ fmt.Fprintf(os.Stdout, "Response from `ScorecardsApi.ListScorecards`:\n%s\n", responseContent)
+}
diff --git a/examples/v2/scorecards/UpdateScorecardCampaign.go b/examples/v2/scorecards/UpdateScorecardCampaign.go
new file mode 100644
index 00000000000..ad5660d629b
--- /dev/null
+++ b/examples/v2/scorecards/UpdateScorecardCampaign.go
@@ -0,0 +1,50 @@
+// Update a campaign returns "OK" response
+
+package main
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "os"
+ "time"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
+)
+
+func main() {
+ body := datadogV2.UpdateCampaignRequest{
+ Data: datadogV2.UpdateCampaignRequestData{
+ Attributes: datadogV2.UpdateCampaignRequestAttributes{
+ Description: datadog.PtrString("Campaign to improve security posture for Q1 2024."),
+ DueDate: datadog.PtrTime(time.Date(2024, 3, 31, 23, 59, 59, 0, time.UTC)),
+ EntityScope: datadog.PtrString("kind:service AND team:platform"),
+ Guidance: datadog.PtrString("Please ensure all services pass the security requirements."),
+ Key: datadog.PtrString("q1-security-2024"),
+ Name: "Q1 Security Campaign",
+ OwnerId: "550e8400-e29b-41d4-a716-446655440000",
+ RuleIds: []string{
+ "q8MQxk8TCqrHnWkx",
+ "r9NRyl9UDrsIoXly",
+ },
+ StartDate: time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC),
+ Status: "in_progress",
+ },
+ Type: datadogV2.CAMPAIGNTYPE_CAMPAIGN,
+ },
+ }
+ ctx := datadog.NewDefaultContext(context.Background())
+ configuration := datadog.NewConfiguration()
+ apiClient := datadog.NewAPIClient(configuration)
+ api := datadogV2.NewScorecardsApi(apiClient)
+ resp, r, err := api.UpdateScorecardCampaign(ctx, "c10ODp0VCrrIpXmz", body)
+
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.UpdateScorecardCampaign`: %v\n", err)
+ fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
+ }
+
+ responseContent, _ := json.MarshalIndent(resp, "", " ")
+ fmt.Fprintf(os.Stdout, "Response from `ScorecardsApi.UpdateScorecardCampaign`:\n%s\n", responseContent)
+}
diff --git a/examples/v2/scorecards/UpdateScorecardOutcomes.go b/examples/v2/scorecards/UpdateScorecardOutcomes.go
new file mode 100644
index 00000000000..4bd03ed0d58
--- /dev/null
+++ b/examples/v2/scorecards/UpdateScorecardOutcomes.go
@@ -0,0 +1,40 @@
+// Update Scorecard outcomes returns "Accepted" response
+
+package main
+
+import (
+ "context"
+ "fmt"
+ "os"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
+)
+
+func main() {
+ body := datadogV2.UpdateOutcomesAsyncRequest{
+ Data: &datadogV2.UpdateOutcomesAsyncRequestData{
+ Attributes: &datadogV2.UpdateOutcomesAsyncAttributes{
+ Results: []datadogV2.UpdateOutcomesAsyncRequestItem{
+ {
+ EntityReference: "service:my-service",
+ Remarks: datadog.PtrString(`See: Services`),
+ RuleId: "q8MQxk8TCqrHnWkx",
+ State: datadogV2.STATE_PASS,
+ },
+ },
+ },
+ Type: datadogV2.UPDATEOUTCOMESASYNCTYPE_BATCHED_OUTCOME.Ptr(),
+ },
+ }
+ ctx := datadog.NewDefaultContext(context.Background())
+ configuration := datadog.NewConfiguration()
+ apiClient := datadog.NewAPIClient(configuration)
+ api := datadogV2.NewScorecardsApi(apiClient)
+ r, err := api.UpdateScorecardOutcomes(ctx, body)
+
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.UpdateScorecardOutcomes`: %v\n", err)
+ fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
+ }
+}
diff --git a/examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.go b/examples/v2/scorecards/UpdateScorecardOutcomes_2262047257.go
similarity index 79%
rename from examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.go
rename to examples/v2/scorecards/UpdateScorecardOutcomes_2262047257.go
index e2e713856ea..6b568238bcf 100644
--- a/examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.go
+++ b/examples/v2/scorecards/UpdateScorecardOutcomes_2262047257.go
@@ -32,13 +32,12 @@ func main() {
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
- configuration.SetUnstableOperationEnabled("v2.UpdateScorecardOutcomesAsync", true)
apiClient := datadog.NewAPIClient(configuration)
- api := datadogV2.NewServiceScorecardsApi(apiClient)
- r, err := api.UpdateScorecardOutcomesAsync(ctx, body)
+ api := datadogV2.NewScorecardsApi(apiClient)
+ r, err := api.UpdateScorecardOutcomes(ctx, body)
if err != nil {
- fmt.Fprintf(os.Stderr, "Error when calling `ServiceScorecardsApi.UpdateScorecardOutcomesAsync`: %v\n", err)
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.UpdateScorecardOutcomes`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
diff --git a/examples/v2/scorecards/UpdateScorecardRule.go b/examples/v2/scorecards/UpdateScorecardRule.go
new file mode 100644
index 00000000000..aa58c3a72e6
--- /dev/null
+++ b/examples/v2/scorecards/UpdateScorecardRule.go
@@ -0,0 +1,41 @@
+// Update an existing scorecard rule returns "Rule updated successfully" response
+
+package main
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "os"
+
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadog"
+ "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
+)
+
+func main() {
+ body := datadogV2.UpdateRuleRequest{
+ Data: &datadogV2.UpdateRuleRequestData{
+ Attributes: &datadogV2.RuleAttributesRequest{
+ Enabled: datadog.PtrBool(true),
+ Level: datadog.PtrInt32(2),
+ Name: datadog.PtrString("Team Defined"),
+ ScopeQuery: datadog.PtrString("kind:service"),
+ ScorecardName: datadog.PtrString("Deployments automated via Deployment Trains"),
+ },
+ Type: datadogV2.RULETYPE_RULE.Ptr(),
+ },
+ }
+ ctx := datadog.NewDefaultContext(context.Background())
+ configuration := datadog.NewConfiguration()
+ apiClient := datadog.NewAPIClient(configuration)
+ api := datadogV2.NewScorecardsApi(apiClient)
+ resp, r, err := api.UpdateScorecardRule(ctx, "rule_id", body)
+
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.UpdateScorecardRule`: %v\n", err)
+ fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
+ }
+
+ responseContent, _ := json.MarshalIndent(resp, "", " ")
+ fmt.Fprintf(os.Stdout, "Response from `ScorecardsApi.UpdateScorecardRule`:\n%s\n", responseContent)
+}
diff --git a/examples/v2/service-scorecards/UpdateScorecardRule.go b/examples/v2/scorecards/UpdateScorecardRule_1831541184.go
similarity index 78%
rename from examples/v2/service-scorecards/UpdateScorecardRule.go
rename to examples/v2/scorecards/UpdateScorecardRule_1831541184.go
index a05fd9b8fec..3af5b40ab03 100644
--- a/examples/v2/service-scorecards/UpdateScorecardRule.go
+++ b/examples/v2/scorecards/UpdateScorecardRule_1831541184.go
@@ -20,7 +20,8 @@ func main() {
body := datadogV2.UpdateRuleRequest{
Data: &datadogV2.UpdateRuleRequestData{
- Attributes: &datadogV2.RuleAttributes{
+ Type: datadogV2.RULETYPE_RULE.Ptr(),
+ Attributes: &datadogV2.RuleAttributesRequest{
Enabled: datadog.PtrBool(true),
Name: datadog.PtrString(CreateScorecardRuleDataAttributesName),
ScorecardName: datadog.PtrString(CreateScorecardRuleDataAttributesScorecardName),
@@ -30,16 +31,15 @@ func main() {
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
- configuration.SetUnstableOperationEnabled("v2.UpdateScorecardRule", true)
apiClient := datadog.NewAPIClient(configuration)
- api := datadogV2.NewServiceScorecardsApi(apiClient)
+ api := datadogV2.NewScorecardsApi(apiClient)
resp, r, err := api.UpdateScorecardRule(ctx, CreateScorecardRuleDataID, body)
if err != nil {
- fmt.Fprintf(os.Stderr, "Error when calling `ServiceScorecardsApi.UpdateScorecardRule`: %v\n", err)
+ fmt.Fprintf(os.Stderr, "Error when calling `ScorecardsApi.UpdateScorecardRule`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
- fmt.Fprintf(os.Stdout, "Response from `ServiceScorecardsApi.UpdateScorecardRule`:\n%s\n", responseContent)
+ fmt.Fprintf(os.Stdout, "Response from `ScorecardsApi.UpdateScorecardRule`:\n%s\n", responseContent)
}
diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go
index d81c086a845..a9dafc100af 100644
--- a/tests/scenarios/api_mappings.go
+++ b/tests/scenarios/api_mappings.go
@@ -131,7 +131,7 @@ var apiMappings = map[string]map[string]reflect.Value{
"RumReplayPlaylistsApi": reflect.ValueOf(datadogV2.NewRumReplayPlaylistsApi),
"RumReplaySessionsApi": reflect.ValueOf(datadogV2.NewRumReplaySessionsApi),
"RumReplayViewershipApi": reflect.ValueOf(datadogV2.NewRumReplayViewershipApi),
- "ServiceScorecardsApi": reflect.ValueOf(datadogV2.NewServiceScorecardsApi),
+ "ScorecardsApi": reflect.ValueOf(datadogV2.NewScorecardsApi),
"SeatsApi": reflect.ValueOf(datadogV2.NewSeatsApi),
"EntityRiskScoresApi": reflect.ValueOf(datadogV2.NewEntityRiskScoresApi),
"SensitiveDataScannerApi": reflect.ValueOf(datadogV2.NewSensitiveDataScannerApi),
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Create_a_new_rule_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Create_a_new_rule_returns_Bad_Request_response.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Create_a_new_rule_returns_Bad_Request_response.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Create_a_new_rule_returns_Bad_Request_response.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Create_a_new_rule_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Create_a_new_rule_returns_Bad_Request_response.yaml
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Create_a_new_rule_returns_Bad_Request_response.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Create_a_new_rule_returns_Bad_Request_response.yaml
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Create_a_new_rule_returns_Created_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Create_a_new_rule_returns_Created_response.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Create_a_new_rule_returns_Created_response.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Create_a_new_rule_returns_Created_response.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Create_a_new_rule_returns_Created_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Create_a_new_rule_returns_Created_response.yaml
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Create_a_new_rule_returns_Created_response.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Create_a_new_rule_returns_Created_response.yaml
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Create_outcomes_batch_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Create_outcomes_batch_returns_Bad_Request_response.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Create_outcomes_batch_returns_Bad_Request_response.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Create_outcomes_batch_returns_Bad_Request_response.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Create_outcomes_batch_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Create_outcomes_batch_returns_Bad_Request_response.yaml
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Create_outcomes_batch_returns_Bad_Request_response.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Create_outcomes_batch_returns_Bad_Request_response.yaml
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Create_outcomes_batch_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Create_outcomes_batch_returns_OK_response.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Create_outcomes_batch_returns_OK_response.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Create_outcomes_batch_returns_OK_response.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Create_outcomes_batch_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Create_outcomes_batch_returns_OK_response.yaml
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Create_outcomes_batch_returns_OK_response.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Create_outcomes_batch_returns_OK_response.yaml
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Delete_a_rule_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Delete_a_rule_returns_Not_Found_response.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Delete_a_rule_returns_Not_Found_response.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Delete_a_rule_returns_Not_Found_response.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Delete_a_rule_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Delete_a_rule_returns_Not_Found_response.yaml
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Delete_a_rule_returns_Not_Found_response.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Delete_a_rule_returns_Not_Found_response.yaml
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Delete_a_rule_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Delete_a_rule_returns_OK_response.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Delete_a_rule_returns_OK_response.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Delete_a_rule_returns_OK_response.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Delete_a_rule_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Delete_a_rule_returns_OK_response.yaml
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Delete_a_rule_returns_OK_response.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Delete_a_rule_returns_OK_response.yaml
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Get_all_rules_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Get_all_rules_returns_OK_response.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Get_all_rules_returns_OK_response.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Get_all_rules_returns_OK_response.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Get_all_rules_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Get_all_rules_returns_OK_response.yaml
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Get_all_rules_returns_OK_response.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Get_all_rules_returns_OK_response.yaml
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_List_all_rule_outcomes_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_List_all_rule_outcomes_returns_OK_response.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_List_all_rule_outcomes_returns_OK_response.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_List_all_rule_outcomes_returns_OK_response.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_List_all_rule_outcomes_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_List_all_rule_outcomes_returns_OK_response.yaml
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_List_all_rule_outcomes_returns_OK_response.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_List_all_rule_outcomes_returns_OK_response.yaml
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_List_all_rule_outcomes_returns_OK_response_with_pagination.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_List_all_rule_outcomes_returns_OK_response_with_pagination.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_List_all_rule_outcomes_returns_OK_response_with_pagination.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_List_all_rule_outcomes_returns_OK_response_with_pagination.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_List_all_rule_outcomes_returns_OK_response_with_pagination.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_List_all_rule_outcomes_returns_OK_response_with_pagination.yaml
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_List_all_rule_outcomes_returns_OK_response_with_pagination.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_List_all_rule_outcomes_returns_OK_response_with_pagination.yaml
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_List_all_rules_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_List_all_rules_returns_OK_response.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_List_all_rules_returns_OK_response.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_List_all_rules_returns_OK_response.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_List_all_rules_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_List_all_rules_returns_OK_response.yaml
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_List_all_rules_returns_OK_response.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_List_all_rules_returns_OK_response.yaml
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_List_all_rules_returns_OK_response_with_pagination.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_List_all_rules_returns_OK_response_with_pagination.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_List_all_rules_returns_OK_response_with_pagination.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_List_all_rules_returns_OK_response_with_pagination.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_List_all_rules_returns_OK_response_with_pagination.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_List_all_rules_returns_OK_response_with_pagination.yaml
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_List_all_rules_returns_OK_response_with_pagination.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_List_all_rules_returns_OK_response_with_pagination.yaml
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Accepted_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Accepted_response.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Accepted_response.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Accepted_response.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Accepted_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Accepted_response.yaml
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Accepted_response.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Accepted_response.yaml
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Bad_Request_response.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Bad_Request_response.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Bad_Request_response.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Bad_Request_response.yaml
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Bad_Request_response.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Bad_Request_response.yaml
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Conflict_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Conflict_response.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Conflict_response.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Conflict_response.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Conflict_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Conflict_response.yaml
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Conflict_response.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_Scorecard_outcomes_asynchronously_returns_Conflict_response.yaml
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_an_existing_rule_returns_Rule_updated_successfully_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_an_existing_rule_returns_Rule_updated_successfully_response.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_an_existing_rule_returns_Rule_updated_successfully_response.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_an_existing_rule_returns_Rule_updated_successfully_response.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_an_existing_rule_returns_Rule_updated_successfully_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_an_existing_rule_returns_Rule_updated_successfully_response.yaml
similarity index 97%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_an_existing_rule_returns_Rule_updated_successfully_response.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_an_existing_rule_returns_Rule_updated_successfully_response.yaml
index 12baefc4294..c744516ed1a 100644
--- a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_an_existing_rule_returns_Rule_updated_successfully_response.yaml
+++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_an_existing_rule_returns_Rule_updated_successfully_response.yaml
@@ -23,7 +23,7 @@ interactions:
status: 201 Created
- request:
body: |
- {"data":{"attributes":{"description":"Updated description via test","enabled":true,"name":"Test-Update_an_existing_rule_returns_Rule_updated_successfully_response-1722307632","scorecard_name":"OpenAPI Spec Test Best Practices"}}}
+ {"data":{"attributes":{"description":"Updated description via test","enabled":true,"name":"Test-Update_an_existing_rule_returns_Rule_updated_successfully_response-1722307632","scorecard_name":"OpenAPI Spec Test Best Practices"},"type":"rule"}}
form: {}
headers:
Accept:
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_an_existing_scorecard_rule_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_an_existing_scorecard_rule_returns_Bad_Request_response.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_an_existing_scorecard_rule_returns_Bad_Request_response.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_an_existing_scorecard_rule_returns_Bad_Request_response.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_an_existing_scorecard_rule_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_an_existing_scorecard_rule_returns_Bad_Request_response.yaml
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_an_existing_scorecard_rule_returns_Bad_Request_response.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_an_existing_scorecard_rule_returns_Bad_Request_response.yaml
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_an_existing_scorecard_rule_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_an_existing_scorecard_rule_returns_Not_Found_response.freeze
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_an_existing_scorecard_rule_returns_Not_Found_response.freeze
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_an_existing_scorecard_rule_returns_Not_Found_response.freeze
diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_an_existing_scorecard_rule_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_an_existing_scorecard_rule_returns_Not_Found_response.yaml
similarity index 100%
rename from tests/scenarios/cassettes/TestScenarios/v2/Feature_Service_Scorecards/Scenario_Update_an_existing_scorecard_rule_returns_Not_Found_response.yaml
rename to tests/scenarios/cassettes/TestScenarios/v2/Feature_Scorecards/Scenario_Update_an_existing_scorecard_rule_returns_Not_Found_response.yaml
diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json
index 12e386bd8f7..e4a5d881716 100644
--- a/tests/scenarios/features/v2/given.json
+++ b/tests/scenarios/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/tests/scenarios/features/v2/scorecards.feature b/tests/scenarios/features/v2/scorecards.feature
new file mode 100644
index 00000000000..750948d8991
--- /dev/null
+++ b/tests/scenarios/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/tests/scenarios/features/v2/service_scorecards.feature b/tests/scenarios/features/v2/service_scorecards.feature
deleted file mode 100644
index 387f04cf711..00000000000
--- a/tests/scenarios/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/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json
index 1f11ffb7e77..124d2e60cb4 100644
--- a/tests/scenarios/features/v2/undo.json
+++ b/tests/scenarios/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": {