diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index f45d9a1cc95..586cc615249 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -9396,6 +9396,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: @@ -14378,6 +14482,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: @@ -15324,6 +15500,41 @@ components: id: $ref: "#/components/schemas/ApiID" type: object + CreateOrUpdateWidgetRequest: + description: Request body for creating or updating a widget. + properties: + data: + $ref: "#/components/schemas/CreateOrUpdateWidgetRequestData" + required: + - data + type: object + CreateOrUpdateWidgetRequestAttributes: + description: Attributes for creating or updating a widget. + properties: + definition: + $ref: "#/components/schemas/WidgetDefinition" + tags: + description: User-defined tags for organizing the widget. + items: + type: string + nullable: true + type: array + required: + - definition + type: object + CreateOrUpdateWidgetRequestData: + description: Data for creating or updating a widget. + properties: + attributes: + $ref: "#/components/schemas/CreateOrUpdateWidgetRequestAttributes" + type: + description: Widgets resource type. + example: widgets + type: string + required: + - type + - attributes + type: object CreatePageRequest: description: Full request to trigger an On-Call Page. example: @@ -15447,7 +15658,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 @@ -36309,6 +36520,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: @@ -36772,6 +36999,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: @@ -47404,6 +47644,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: @@ -53274,6 +53543,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 @@ -55779,6 +56080,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. @@ -69014,6 +69365,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: @@ -69595,7 +70020,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 @@ -71675,6 +72100,136 @@ components: - FRIDAY - SATURDAY - SUNDAY + WidgetAttributes: + description: Attributes of a widget resource. + properties: + created_at: + description: ISO 8601 timestamp of when the widget was created. + example: "2024-01-15T00:00:00.000Z" + type: string + definition: + $ref: "#/components/schemas/WidgetDefinition" + is_favorited: + description: "Will be implemented soon. Currently always returns false." + example: false + type: boolean + modified_at: + description: ISO 8601 timestamp of when the widget was last modified. + example: "2024-01-15T00:00:00.000Z" + type: string + tags: + description: User-defined tags for organizing widgets. + example: + - "team:my-team" + items: + type: string + nullable: true + type: array + required: + - definition + - tags + - is_favorited + - created_at + - modified_at + type: object + WidgetData: + description: A widget resource object. + properties: + attributes: + $ref: "#/components/schemas/WidgetAttributes" + id: + description: The unique identifier of the widget. + example: "a1b2c3d4-e5f6-7890-abcd-ef1234567890" + type: string + relationships: + $ref: "#/components/schemas/WidgetRelationships" + type: + description: Widgets resource type. + example: widgets + type: string + required: + - id + - type + - attributes + type: object + WidgetDefinition: + additionalProperties: {} + description: The definition of a widget, including its type and configuration. + properties: + title: + description: The display title of the widget. + example: My Widget + maxLength: 100 + minLength: 1 + type: string + type: + $ref: "#/components/schemas/WidgetType" + required: + - type + - title + type: object + WidgetExperienceType: + description: Widget experience types that differentiate between the products using the specific widget. + enum: + - ccm_reports + - logs_reports + - csv_reports + - product_analytics + example: ccm_reports + type: string + x-enum-varnames: + - CCM_REPORTS + - LOGS_REPORTS + - CSV_REPORTS + - PRODUCT_ANALYTICS + WidgetIncludedUser: + description: A user resource included in the response. + properties: + attributes: + $ref: "#/components/schemas/WidgetIncludedUserAttributes" + id: + description: The unique identifier of the user. + example: "a1b2c3d4-e5f6-7890-abcd-ef1234567890" + type: string + type: + description: Users resource type. + example: users + type: string + required: + - id + - type + type: object + WidgetIncludedUserAttributes: + description: Attributes of an included user resource. + properties: + handle: + description: The email handle of the user. + example: "john.doe@example.com" + type: string + name: + description: The display name of the user. + example: "John Doe" + nullable: true + type: string + type: object + WidgetListResponse: + description: Response containing a list of widgets. + properties: + data: + description: List of widget resources. + items: + $ref: "#/components/schemas/WidgetData" + type: array + included: + description: Array of user resources related to the widgets. + items: + $ref: "#/components/schemas/WidgetIncludedUser" + type: array + meta: + $ref: "#/components/schemas/WidgetSearchMeta" + required: + - data + type: object WidgetLiveSpan: description: The available timeframes depend on the widget you are using. enum: @@ -71711,6 +72266,108 @@ components: - PAST_SIX_MONTHS - PAST_ONE_YEAR - ALERT + WidgetRelationshipData: + description: Relationship data referencing a user resource. + properties: + id: + description: The unique identifier of the user. + example: "a1b2c3d4-e5f6-7890-abcd-ef1234567890" + type: string + type: + description: Users resource type. + example: users + type: string + required: + - id + - type + type: object + WidgetRelationshipItem: + description: A JSON:API relationship to a user. + properties: + data: + $ref: "#/components/schemas/WidgetRelationshipData" + type: object + WidgetRelationships: + description: Relationships of the widget resource. + properties: + created_by: + $ref: "#/components/schemas/WidgetRelationshipItem" + description: The user who created the widget. + modified_by: + $ref: "#/components/schemas/WidgetRelationshipItem" + description: The user who last modified the widget. + type: object + WidgetResponse: + description: Response containing a single widget. + properties: + data: + $ref: "#/components/schemas/WidgetData" + included: + description: Array of user resources related to the widget. + items: + $ref: "#/components/schemas/WidgetIncludedUser" + type: array + required: + - data + type: object + WidgetSearchMeta: + description: Metadata about the search results. + properties: + created_by_anyone_total: + description: Total number of widgets created by anyone. + format: int64 + type: integer + created_by_you_total: + description: Total number of widgets created by the current user. + format: int64 + type: integer + favorited_by_you_total: + description: Total number of widgets favorited by the current user. + format: int64 + type: integer + filtered_total: + description: Total number of widgets matching the current filter criteria. + format: int64 + type: integer + type: object + WidgetType: + description: |- + Widget types that are allowed to be stored as individual records. + This is not a complete list of dashboard and notebook widget types. + enum: + - bar_chart + - change + - cloud_cost_summary + - cohort + - funnel + - geomap + - list_stream + - query_table + - query_value + - retention_curve + - sankey + - sunburst + - timeseries + - toplist + - treemap + example: bar_chart + type: string + x-enum-varnames: + - BAR_CHART + - CHANGE + - CLOUD_COST_SUMMARY + - COHORT + - FUNNEL + - GEOMAP + - LIST_STREAM + - QUERY_TABLE + - QUERY_VALUE + - RETENTION_CURVE + - SANKEY + - SUNBURST + - TIMESERIES + - TOPLIST + - TREEMAP WorkflowData: description: Data related to the workflow. properties: @@ -99006,6 +99663,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. @@ -99034,21 +100074,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 @@ -99073,6 +100113,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 @@ -99089,17 +100148,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: @@ -99123,15 +100179,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: @@ -99145,6 +100199,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 @@ -99161,10 +100234,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: @@ -99233,6 +100307,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 @@ -99249,20 +100351,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. @@ -99271,6 +100380,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 @@ -99287,11 +100416,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. @@ -99316,10 +100442,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 @@ -99328,6 +100451,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. @@ -99336,6 +100471,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 @@ -99350,13 +100512,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: |- @@ -109866,6 +111103,328 @@ paths: operator: OR permissions: - teams_read + /api/v2/widgets/{experience_type}: + get: + description: Search and list widgets for a given experience type. Supports filtering by widget type, creator, title, and tags, as well as sorting and pagination. + operationId: SearchWidgets + parameters: + - description: The experience type for the widget. + in: path + name: experience_type + required: true + schema: + $ref: "#/components/schemas/WidgetExperienceType" + - description: Filter widgets by widget type. + in: query + name: filter[widgetType] + schema: + $ref: "#/components/schemas/WidgetType" + - description: Filter widgets by the email handle of the creator. + in: query + name: filter[creatorHandle] + schema: + example: "john.doe@example.com" + type: string + - description: Filter to only widgets favorited by the current user. + in: query + name: filter[isFavorited] + schema: + type: boolean + - description: Filter widgets by title (substring match). + in: query + name: filter[title] + schema: + type: string + - description: Filter widgets by tags. Format as bracket-delimited CSV, e.g. `[tag1,tag2]`. + in: query + name: filter[tags] + schema: + type: string + - description: |- + Sort field for the results. Prefix with `-` for descending order. + Allowed values: `title`, `created_at`, `modified_at`. + in: query + name: sort + schema: + default: "-modified_at" + example: "-modified_at" + type: string + - description: Page number for pagination (0-indexed). + in: query + name: page[number] + schema: + default: 0 + minimum: 0 + type: integer + - description: Number of widgets per page. + in: query + name: page[size] + schema: + default: 50 + maximum: 100 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/WidgetListResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Search widgets + tags: + - Widgets + x-permission: + operator: OR + permissions: + - cloud_cost_management_read + - generate_log_reports + - manage_log_reports + - product_analytics_saved_widgets_read + post: + description: Create a new widget for a given experience type. + operationId: CreateWidget + parameters: + - description: The experience type for the widget. + in: path + name: experience_type + required: true + schema: + $ref: "#/components/schemas/WidgetExperienceType" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/CreateOrUpdateWidgetRequest" + description: Widget request body. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/WidgetResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create a widget + tags: + - Widgets + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - cloud_cost_management_write + - generate_log_reports + - manage_log_reports + - product_analytics_saved_widgets_write + /api/v2/widgets/{experience_type}/{uuid}: + delete: + description: Soft-delete a widget by its UUID for a given experience type. + operationId: DeleteWidget + parameters: + - description: The experience type for the widget. + in: path + name: experience_type + required: true + schema: + $ref: "#/components/schemas/WidgetExperienceType" + - description: The UUID of the widget. + in: path + name: uuid + required: true + schema: + format: uuid + type: string + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete a widget + tags: + - Widgets + x-permission: + operator: OR + permissions: + - cloud_cost_management_write + - generate_log_reports + - manage_log_reports + - product_analytics_saved_widgets_write + get: + description: Retrieve a widget by its UUID for a given experience type. + operationId: GetWidget + parameters: + - description: The experience type for the widget. + in: path + name: experience_type + required: true + schema: + $ref: "#/components/schemas/WidgetExperienceType" + - description: The UUID of the widget. + in: path + name: uuid + required: true + schema: + format: uuid + type: string + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/WidgetResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get a widget + tags: + - Widgets + x-permission: + operator: OR + permissions: + - cloud_cost_management_read + - generate_log_reports + - manage_log_reports + - product_analytics_saved_widgets_read + put: + description: Update a widget by its UUID for a given experience type. This performs a full replacement of the widget definition. + operationId: UpdateWidget + parameters: + - description: The experience type for the widget. + in: path + name: experience_type + required: true + schema: + $ref: "#/components/schemas/WidgetExperienceType" + - description: The UUID of the widget. + in: path + name: uuid + required: true + schema: + format: uuid + type: string + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/CreateOrUpdateWidgetRequest" + description: Widget request body. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/WidgetResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update a widget + tags: + - Widgets + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - cloud_cost_management_write + - generate_log_reports + - manage_log_reports + - product_analytics_saved_widgets_write /api/v2/workflows: post: description: Create a new workflow, returning the workflow ID. This API requires a [registered application key](https://docs.datadoghq.com/api/latest/action-connection/#register-a-new-app-key). Alternatively, you can configure these permissions [in the UI](https://docs.datadoghq.com/account_management/api-app-keys/#actions-api-access). @@ -110632,6 +112191,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 @@ -110656,11 +112218,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: |- @@ -110716,6 +112273,11 @@ tags: externalDocs: url: https://docs.datadoghq.com/account_management/users name: Users + - description: |- + Create, read, update, and delete saved widgets. Widgets are reusable + visualization components stored independently from any dashboard or notebook, + partitioned by experience type and identified by a UUID. + name: Widgets - description: |- Datadog Workflow Automation allows you to automate your end-to-end processes by connecting Datadog with the rest of your tech stack. Build workflows to auto-remediate your alerts, streamline your incident and security processes, and reduce manual toil. Workflow Automation supports over 1,000+ OOTB actions, including AWS, JIRA, ServiceNow, GitHub, and OpenAI. Learn more in our Workflow Automation docs [here](https://docs.datadoghq.com/service_management/workflows/). externalDocs: diff --git a/examples/v2/scorecards/CreateScorecardCampaign.java b/examples/v2/scorecards/CreateScorecardCampaign.java new file mode 100644 index 00000000000..64d9d9e8b4a --- /dev/null +++ b/examples/v2/scorecards/CreateScorecardCampaign.java @@ -0,0 +1,49 @@ +// Create a new campaign returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ScorecardsApi; +import com.datadog.api.client.v2.model.CampaignResponse; +import com.datadog.api.client.v2.model.CampaignStatus; +import com.datadog.api.client.v2.model.CampaignType; +import com.datadog.api.client.v2.model.CreateCampaignRequest; +import com.datadog.api.client.v2.model.CreateCampaignRequestAttributes; +import com.datadog.api.client.v2.model.CreateCampaignRequestData; +import java.time.OffsetDateTime; +import java.util.Arrays; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); + + CreateCampaignRequest body = + new CreateCampaignRequest() + .data( + new CreateCampaignRequestData() + .attributes( + new CreateCampaignRequestAttributes() + .description("Campaign to improve security posture for Q1 2024.") + .dueDate(OffsetDateTime.parse("2024-03-31T23:59:59Z")) + .entityScope("kind:service AND team:platform") + .guidance("Please ensure all services pass the security requirements.") + .key("q1-security-2024") + .name("Q1 Security Campaign") + .ownerId("550e8400-e29b-41d4-a716-446655440000") + .ruleIds(Arrays.asList("q8MQxk8TCqrHnWkx", "r9NRyl9UDrsIoXly")) + .startDate(OffsetDateTime.parse("2024-01-01T00:00:00Z")) + .status(CampaignStatus.IN_PROGRESS)) + .type(CampaignType.CAMPAIGN)); + + try { + CampaignResponse result = apiInstance.createScorecardCampaign(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ScorecardsApi#createScorecardCampaign"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/service-scorecards/CreateScorecardOutcomesBatch.java b/examples/v2/scorecards/CreateScorecardOutcomesBatch.java similarity index 89% rename from examples/v2/service-scorecards/CreateScorecardOutcomesBatch.java rename to examples/v2/scorecards/CreateScorecardOutcomesBatch.java index 2dd877ba0de..d23378230e7 100644 --- a/examples/v2/service-scorecards/CreateScorecardOutcomesBatch.java +++ b/examples/v2/scorecards/CreateScorecardOutcomesBatch.java @@ -2,7 +2,7 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.ServiceScorecardsApi; +import com.datadog.api.client.v2.api.ScorecardsApi; import com.datadog.api.client.v2.model.OutcomesBatchAttributes; import com.datadog.api.client.v2.model.OutcomesBatchRequest; import com.datadog.api.client.v2.model.OutcomesBatchRequestData; @@ -16,7 +16,7 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); defaultClient.setUnstableOperationEnabled("v2.createScorecardOutcomesBatch", true); - ServiceScorecardsApi apiInstance = new ServiceScorecardsApi(defaultClient); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); // there is a valid "create_scorecard_rule" in the system String CREATE_SCORECARD_RULE_DATA_ID = System.getenv("CREATE_SCORECARD_RULE_DATA_ID"); @@ -43,8 +43,7 @@ public static void main(String[] args) { OutcomesBatchResponse result = apiInstance.createScorecardOutcomesBatch(body); System.out.println(result); } catch (ApiException e) { - System.err.println( - "Exception when calling ServiceScorecardsApi#createScorecardOutcomesBatch"); + System.err.println("Exception when calling ScorecardsApi#createScorecardOutcomesBatch"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/examples/v2/service-scorecards/CreateScorecardRule.java b/examples/v2/scorecards/CreateScorecardRule.java similarity index 71% rename from examples/v2/service-scorecards/CreateScorecardRule.java rename to examples/v2/scorecards/CreateScorecardRule.java index 07f55ad8258..c19c518e350 100644 --- a/examples/v2/service-scorecards/CreateScorecardRule.java +++ b/examples/v2/scorecards/CreateScorecardRule.java @@ -2,27 +2,26 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.ServiceScorecardsApi; +import com.datadog.api.client.v2.api.ScorecardsApi; import com.datadog.api.client.v2.model.CreateRuleRequest; import com.datadog.api.client.v2.model.CreateRuleRequestData; import com.datadog.api.client.v2.model.CreateRuleResponse; -import com.datadog.api.client.v2.model.RuleAttributes; +import com.datadog.api.client.v2.model.RuleAttributesRequest; import com.datadog.api.client.v2.model.RuleType; public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); - defaultClient.setUnstableOperationEnabled("v2.createScorecardRule", true); - ServiceScorecardsApi apiInstance = new ServiceScorecardsApi(defaultClient); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); CreateRuleRequest body = new CreateRuleRequest() .data( new CreateRuleRequestData() .attributes( - new RuleAttributes() + new RuleAttributesRequest() .enabled(true) - .name("Example-Service-Scorecard") + .name("Example-Scorecard") .scorecardName("Observability Best Practices")) .type(RuleType.RULE)); @@ -30,7 +29,7 @@ public static void main(String[] args) { CreateRuleResponse result = apiInstance.createScorecardRule(body); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling ServiceScorecardsApi#createScorecardRule"); + System.err.println("Exception when calling ScorecardsApi#createScorecardRule"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/examples/v2/scorecards/DeleteScorecardCampaign.java b/examples/v2/scorecards/DeleteScorecardCampaign.java new file mode 100644 index 00000000000..48a3c8ad5db --- /dev/null +++ b/examples/v2/scorecards/DeleteScorecardCampaign.java @@ -0,0 +1,22 @@ +// Delete a campaign returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ScorecardsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); + + try { + apiInstance.deleteScorecardCampaign("c10ODp0VCrrIpXmz"); + } catch (ApiException e) { + System.err.println("Exception when calling ScorecardsApi#deleteScorecardCampaign"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/service-scorecards/DeleteScorecardRule.java b/examples/v2/scorecards/DeleteScorecardRule.java similarity index 70% rename from examples/v2/service-scorecards/DeleteScorecardRule.java rename to examples/v2/scorecards/DeleteScorecardRule.java index 010cb22ee6f..87f1fd8322d 100644 --- a/examples/v2/service-scorecards/DeleteScorecardRule.java +++ b/examples/v2/scorecards/DeleteScorecardRule.java @@ -2,13 +2,12 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.ServiceScorecardsApi; +import com.datadog.api.client.v2.api.ScorecardsApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); - defaultClient.setUnstableOperationEnabled("v2.deleteScorecardRule", true); - ServiceScorecardsApi apiInstance = new ServiceScorecardsApi(defaultClient); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); // there is a valid "create_scorecard_rule" in the system String CREATE_SCORECARD_RULE_DATA_ID = System.getenv("CREATE_SCORECARD_RULE_DATA_ID"); @@ -16,7 +15,7 @@ public static void main(String[] args) { try { apiInstance.deleteScorecardRule(CREATE_SCORECARD_RULE_DATA_ID); } catch (ApiException e) { - System.err.println("Exception when calling ServiceScorecardsApi#deleteScorecardRule"); + System.err.println("Exception when calling ScorecardsApi#deleteScorecardRule"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/examples/v2/scorecards/GetScorecardCampaign.java b/examples/v2/scorecards/GetScorecardCampaign.java new file mode 100644 index 00000000000..e7c8a1f3473 --- /dev/null +++ b/examples/v2/scorecards/GetScorecardCampaign.java @@ -0,0 +1,24 @@ +// Get a campaign returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ScorecardsApi; +import com.datadog.api.client.v2.model.CampaignResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); + + try { + CampaignResponse result = apiInstance.getScorecardCampaign("c10ODp0VCrrIpXmz"); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ScorecardsApi#getScorecardCampaign"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/scorecards/ListScorecardCampaigns.java b/examples/v2/scorecards/ListScorecardCampaigns.java new file mode 100644 index 00000000000..58a610de7d8 --- /dev/null +++ b/examples/v2/scorecards/ListScorecardCampaigns.java @@ -0,0 +1,24 @@ +// List all campaigns returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ScorecardsApi; +import com.datadog.api.client.v2.model.ListCampaignsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); + + try { + ListCampaignsResponse result = apiInstance.listScorecardCampaigns(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ScorecardsApi#listScorecardCampaigns"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/service-scorecards/ListScorecardOutcomes.java b/examples/v2/scorecards/ListScorecardOutcomes.java similarity index 68% rename from examples/v2/service-scorecards/ListScorecardOutcomes.java rename to examples/v2/scorecards/ListScorecardOutcomes.java index 6e8815c135b..a49de4bb442 100644 --- a/examples/v2/service-scorecards/ListScorecardOutcomes.java +++ b/examples/v2/scorecards/ListScorecardOutcomes.java @@ -2,20 +2,19 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.ServiceScorecardsApi; +import com.datadog.api.client.v2.api.ScorecardsApi; import com.datadog.api.client.v2.model.OutcomesResponse; public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); - defaultClient.setUnstableOperationEnabled("v2.listScorecardOutcomes", true); - ServiceScorecardsApi apiInstance = new ServiceScorecardsApi(defaultClient); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); try { OutcomesResponse result = apiInstance.listScorecardOutcomes(); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling ServiceScorecardsApi#listScorecardOutcomes"); + System.err.println("Exception when calling ScorecardsApi#listScorecardOutcomes"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/examples/v2/service-scorecards/ListScorecardOutcomes_2663454275.java b/examples/v2/scorecards/ListScorecardOutcomes_2663454275.java similarity index 69% rename from examples/v2/service-scorecards/ListScorecardOutcomes_2663454275.java rename to examples/v2/scorecards/ListScorecardOutcomes_2663454275.java index b3a8c5b1510..cdc361eec0a 100644 --- a/examples/v2/service-scorecards/ListScorecardOutcomes_2663454275.java +++ b/examples/v2/scorecards/ListScorecardOutcomes_2663454275.java @@ -2,15 +2,14 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.PaginationIterable; -import com.datadog.api.client.v2.api.ServiceScorecardsApi; -import com.datadog.api.client.v2.api.ServiceScorecardsApi.ListScorecardOutcomesOptionalParameters; +import com.datadog.api.client.v2.api.ScorecardsApi; +import com.datadog.api.client.v2.api.ScorecardsApi.ListScorecardOutcomesOptionalParameters; import com.datadog.api.client.v2.model.OutcomesResponseDataItem; public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); - defaultClient.setUnstableOperationEnabled("v2.listScorecardOutcomes", true); - ServiceScorecardsApi apiInstance = new ServiceScorecardsApi(defaultClient); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); try { PaginationIterable iterable = @@ -25,7 +24,7 @@ public static void main(String[] args) { } } catch (RuntimeException e) { System.err.println( - "Exception when calling ServiceScorecardsApi#listScorecardOutcomesWithPagination"); + "Exception when calling ScorecardsApi#listScorecardOutcomesWithPagination"); System.err.println("Reason: " + e.getMessage()); e.printStackTrace(); } diff --git a/examples/v2/service-scorecards/ListScorecardRules.java b/examples/v2/scorecards/ListScorecardRules.java similarity index 68% rename from examples/v2/service-scorecards/ListScorecardRules.java rename to examples/v2/scorecards/ListScorecardRules.java index 0f13c0307c5..92dc0aa7478 100644 --- a/examples/v2/service-scorecards/ListScorecardRules.java +++ b/examples/v2/scorecards/ListScorecardRules.java @@ -2,20 +2,19 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.ServiceScorecardsApi; +import com.datadog.api.client.v2.api.ScorecardsApi; import com.datadog.api.client.v2.model.ListRulesResponse; public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); - defaultClient.setUnstableOperationEnabled("v2.listScorecardRules", true); - ServiceScorecardsApi apiInstance = new ServiceScorecardsApi(defaultClient); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); try { ListRulesResponse result = apiInstance.listScorecardRules(); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling ServiceScorecardsApi#listScorecardRules"); + System.err.println("Exception when calling ScorecardsApi#listScorecardRules"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/examples/v2/service-scorecards/ListScorecardRules_4057666343.java b/examples/v2/scorecards/ListScorecardRules_4057666343.java similarity index 66% rename from examples/v2/service-scorecards/ListScorecardRules_4057666343.java rename to examples/v2/scorecards/ListScorecardRules_4057666343.java index 41df709abfc..309b23b1bdf 100644 --- a/examples/v2/service-scorecards/ListScorecardRules_4057666343.java +++ b/examples/v2/scorecards/ListScorecardRules_4057666343.java @@ -2,15 +2,14 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.PaginationIterable; -import com.datadog.api.client.v2.api.ServiceScorecardsApi; -import com.datadog.api.client.v2.api.ServiceScorecardsApi.ListScorecardRulesOptionalParameters; +import com.datadog.api.client.v2.api.ScorecardsApi; +import com.datadog.api.client.v2.api.ScorecardsApi.ListScorecardRulesOptionalParameters; import com.datadog.api.client.v2.model.ListRulesResponseDataItem; public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); - defaultClient.setUnstableOperationEnabled("v2.listScorecardRules", true); - ServiceScorecardsApi apiInstance = new ServiceScorecardsApi(defaultClient); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); try { PaginationIterable iterable = @@ -24,8 +23,7 @@ public static void main(String[] args) { System.out.println(item); } } catch (RuntimeException e) { - System.err.println( - "Exception when calling ServiceScorecardsApi#listScorecardRulesWithPagination"); + System.err.println("Exception when calling ScorecardsApi#listScorecardRulesWithPagination"); System.err.println("Reason: " + e.getMessage()); e.printStackTrace(); } diff --git a/examples/v2/scorecards/ListScorecards.java b/examples/v2/scorecards/ListScorecards.java new file mode 100644 index 00000000000..72cf6294af6 --- /dev/null +++ b/examples/v2/scorecards/ListScorecards.java @@ -0,0 +1,24 @@ +// List all scorecards returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ScorecardsApi; +import com.datadog.api.client.v2.model.ListScorecardsResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); + + try { + ListScorecardsResponse result = apiInstance.listScorecards(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ScorecardsApi#listScorecards"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/scorecards/UpdateScorecardCampaign.java b/examples/v2/scorecards/UpdateScorecardCampaign.java new file mode 100644 index 00000000000..544eee589a6 --- /dev/null +++ b/examples/v2/scorecards/UpdateScorecardCampaign.java @@ -0,0 +1,48 @@ +// Update a campaign returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ScorecardsApi; +import com.datadog.api.client.v2.model.CampaignResponse; +import com.datadog.api.client.v2.model.CampaignType; +import com.datadog.api.client.v2.model.UpdateCampaignRequest; +import com.datadog.api.client.v2.model.UpdateCampaignRequestAttributes; +import com.datadog.api.client.v2.model.UpdateCampaignRequestData; +import java.time.OffsetDateTime; +import java.util.Arrays; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); + + UpdateCampaignRequest body = + new UpdateCampaignRequest() + .data( + new UpdateCampaignRequestData() + .attributes( + new UpdateCampaignRequestAttributes() + .description("Campaign to improve security posture for Q1 2024.") + .dueDate(OffsetDateTime.parse("2024-03-31T23:59:59Z")) + .entityScope("kind:service AND team:platform") + .guidance("Please ensure all services pass the security requirements.") + .key("q1-security-2024") + .name("Q1 Security Campaign") + .ownerId("550e8400-e29b-41d4-a716-446655440000") + .ruleIds(Arrays.asList("q8MQxk8TCqrHnWkx", "r9NRyl9UDrsIoXly")) + .startDate(OffsetDateTime.parse("2024-01-01T00:00:00Z")) + .status("in_progress")) + .type(CampaignType.CAMPAIGN)); + + try { + CampaignResponse result = apiInstance.updateScorecardCampaign("c10ODp0VCrrIpXmz", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ScorecardsApi#updateScorecardCampaign"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/scorecards/UpdateScorecardOutcomes.java b/examples/v2/scorecards/UpdateScorecardOutcomes.java new file mode 100644 index 00000000000..206a51a32c5 --- /dev/null +++ b/examples/v2/scorecards/UpdateScorecardOutcomes.java @@ -0,0 +1,47 @@ +// Update Scorecard outcomes returns "Accepted" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ScorecardsApi; +import com.datadog.api.client.v2.model.State; +import com.datadog.api.client.v2.model.UpdateOutcomesAsyncAttributes; +import com.datadog.api.client.v2.model.UpdateOutcomesAsyncRequest; +import com.datadog.api.client.v2.model.UpdateOutcomesAsyncRequestData; +import com.datadog.api.client.v2.model.UpdateOutcomesAsyncRequestItem; +import com.datadog.api.client.v2.model.UpdateOutcomesAsyncType; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); + + UpdateOutcomesAsyncRequest body = + new UpdateOutcomesAsyncRequest() + .data( + new UpdateOutcomesAsyncRequestData() + .attributes( + new UpdateOutcomesAsyncAttributes() + .results( + Collections.singletonList( + new UpdateOutcomesAsyncRequestItem() + .entityReference("service:my-service") + .remarks( + """ +See: Services +""") + .ruleId("q8MQxk8TCqrHnWkx") + .state(State.PASS)))) + .type(UpdateOutcomesAsyncType.BATCHED_OUTCOME)); + + try { + apiInstance.updateScorecardOutcomes(body); + } catch (ApiException e) { + System.err.println("Exception when calling ScorecardsApi#updateScorecardOutcomes"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.java b/examples/v2/scorecards/UpdateScorecardOutcomes_2262047257.java similarity index 83% rename from examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.java rename to examples/v2/scorecards/UpdateScorecardOutcomes_2262047257.java index 1ccbda1ef3d..1007525d385 100644 --- a/examples/v2/service-scorecards/UpdateScorecardOutcomesAsync.java +++ b/examples/v2/scorecards/UpdateScorecardOutcomes_2262047257.java @@ -2,7 +2,7 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.ServiceScorecardsApi; +import com.datadog.api.client.v2.api.ScorecardsApi; import com.datadog.api.client.v2.model.State; import com.datadog.api.client.v2.model.UpdateOutcomesAsyncAttributes; import com.datadog.api.client.v2.model.UpdateOutcomesAsyncRequest; @@ -14,8 +14,7 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); - defaultClient.setUnstableOperationEnabled("v2.updateScorecardOutcomesAsync", true); - ServiceScorecardsApi apiInstance = new ServiceScorecardsApi(defaultClient); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); // there is a valid "create_scorecard_rule" in the system String CREATE_SCORECARD_RULE_DATA_ID = System.getenv("CREATE_SCORECARD_RULE_DATA_ID"); @@ -39,10 +38,9 @@ public static void main(String[] args) { .type(UpdateOutcomesAsyncType.BATCHED_OUTCOME)); try { - apiInstance.updateScorecardOutcomesAsync(body); + apiInstance.updateScorecardOutcomes(body); } catch (ApiException e) { - System.err.println( - "Exception when calling ServiceScorecardsApi#updateScorecardOutcomesAsync"); + System.err.println("Exception when calling ScorecardsApi#updateScorecardOutcomes"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/examples/v2/scorecards/UpdateScorecardRule.java b/examples/v2/scorecards/UpdateScorecardRule.java new file mode 100644 index 00000000000..3c29f88cda4 --- /dev/null +++ b/examples/v2/scorecards/UpdateScorecardRule.java @@ -0,0 +1,41 @@ +// Update an existing scorecard rule returns "Rule updated successfully" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ScorecardsApi; +import com.datadog.api.client.v2.model.RuleAttributesRequest; +import com.datadog.api.client.v2.model.RuleType; +import com.datadog.api.client.v2.model.UpdateRuleRequest; +import com.datadog.api.client.v2.model.UpdateRuleRequestData; +import com.datadog.api.client.v2.model.UpdateRuleResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); + + UpdateRuleRequest body = + new UpdateRuleRequest() + .data( + new UpdateRuleRequestData() + .attributes( + new RuleAttributesRequest() + .enabled(true) + .level(2) + .name("Team Defined") + .scopeQuery("kind:service") + .scorecardName("Deployments automated via Deployment Trains")) + .type(RuleType.RULE)); + + try { + UpdateRuleResponse result = apiInstance.updateScorecardRule("rule_id", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ScorecardsApi#updateScorecardRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/service-scorecards/UpdateScorecardRule.java b/examples/v2/scorecards/UpdateScorecardRule_1831541184.java similarity index 81% rename from examples/v2/service-scorecards/UpdateScorecardRule.java rename to examples/v2/scorecards/UpdateScorecardRule_1831541184.java index 83edb2b9aee..bed07a1a3ec 100644 --- a/examples/v2/service-scorecards/UpdateScorecardRule.java +++ b/examples/v2/scorecards/UpdateScorecardRule_1831541184.java @@ -2,8 +2,9 @@ import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; -import com.datadog.api.client.v2.api.ServiceScorecardsApi; -import com.datadog.api.client.v2.model.RuleAttributes; +import com.datadog.api.client.v2.api.ScorecardsApi; +import com.datadog.api.client.v2.model.RuleAttributesRequest; +import com.datadog.api.client.v2.model.RuleType; import com.datadog.api.client.v2.model.UpdateRuleRequest; import com.datadog.api.client.v2.model.UpdateRuleRequestData; import com.datadog.api.client.v2.model.UpdateRuleResponse; @@ -11,8 +12,7 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); - defaultClient.setUnstableOperationEnabled("v2.updateScorecardRule", true); - ServiceScorecardsApi apiInstance = new ServiceScorecardsApi(defaultClient); + ScorecardsApi apiInstance = new ScorecardsApi(defaultClient); // there is a valid "create_scorecard_rule" in the system String CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME = @@ -25,8 +25,9 @@ public static void main(String[] args) { new UpdateRuleRequest() .data( new UpdateRuleRequestData() + .type(RuleType.RULE) .attributes( - new RuleAttributes() + new RuleAttributesRequest() .enabled(true) .name(CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME) .scorecardName(CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME) @@ -37,7 +38,7 @@ public static void main(String[] args) { apiInstance.updateScorecardRule(CREATE_SCORECARD_RULE_DATA_ID, body); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling ServiceScorecardsApi#updateScorecardRule"); + System.err.println("Exception when calling ScorecardsApi#updateScorecardRule"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); diff --git a/examples/v2/widgets/CreateWidget.java b/examples/v2/widgets/CreateWidget.java new file mode 100644 index 00000000000..fcda8927285 --- /dev/null +++ b/examples/v2/widgets/CreateWidget.java @@ -0,0 +1,42 @@ +// Create a widget returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.WidgetsApi; +import com.datadog.api.client.v2.model.CreateOrUpdateWidgetRequest; +import com.datadog.api.client.v2.model.CreateOrUpdateWidgetRequestAttributes; +import com.datadog.api.client.v2.model.CreateOrUpdateWidgetRequestData; +import com.datadog.api.client.v2.model.WidgetDefinition; +import com.datadog.api.client.v2.model.WidgetExperienceType; +import com.datadog.api.client.v2.model.WidgetResponse; +import com.datadog.api.client.v2.model.WidgetType; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + WidgetsApi apiInstance = new WidgetsApi(defaultClient); + + CreateOrUpdateWidgetRequest body = + new CreateOrUpdateWidgetRequest() + .data( + new CreateOrUpdateWidgetRequestData() + .attributes( + new CreateOrUpdateWidgetRequestAttributes() + .definition( + new WidgetDefinition() + .title("My Widget") + .type(WidgetType.BAR_CHART))) + .type("widgets")); + + try { + WidgetResponse result = apiInstance.createWidget(WidgetExperienceType.CCM_REPORTS, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WidgetsApi#createWidget"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/widgets/DeleteWidget.java b/examples/v2/widgets/DeleteWidget.java new file mode 100644 index 00000000000..cf76c095eec --- /dev/null +++ b/examples/v2/widgets/DeleteWidget.java @@ -0,0 +1,26 @@ +// Delete a widget returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.WidgetsApi; +import com.datadog.api.client.v2.model.WidgetExperienceType; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + WidgetsApi apiInstance = new WidgetsApi(defaultClient); + + try { + apiInstance.deleteWidget( + WidgetExperienceType.CCM_REPORTS, + UUID.fromString("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d")); + } catch (ApiException e) { + System.err.println("Exception when calling WidgetsApi#deleteWidget"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/widgets/GetWidget.java b/examples/v2/widgets/GetWidget.java new file mode 100644 index 00000000000..ded31dfd389 --- /dev/null +++ b/examples/v2/widgets/GetWidget.java @@ -0,0 +1,29 @@ +// Get a widget returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.WidgetsApi; +import com.datadog.api.client.v2.model.WidgetExperienceType; +import com.datadog.api.client.v2.model.WidgetResponse; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + WidgetsApi apiInstance = new WidgetsApi(defaultClient); + + try { + WidgetResponse result = + apiInstance.getWidget( + WidgetExperienceType.CCM_REPORTS, + UUID.fromString("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WidgetsApi#getWidget"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/widgets/SearchWidgets.java b/examples/v2/widgets/SearchWidgets.java new file mode 100644 index 00000000000..9d0020e199d --- /dev/null +++ b/examples/v2/widgets/SearchWidgets.java @@ -0,0 +1,25 @@ +// Search widgets returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.WidgetsApi; +import com.datadog.api.client.v2.model.WidgetExperienceType; +import com.datadog.api.client.v2.model.WidgetListResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + WidgetsApi apiInstance = new WidgetsApi(defaultClient); + + try { + WidgetListResponse result = apiInstance.searchWidgets(WidgetExperienceType.CCM_REPORTS); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WidgetsApi#searchWidgets"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/widgets/UpdateWidget.java b/examples/v2/widgets/UpdateWidget.java new file mode 100644 index 00000000000..d9c7a92ecc9 --- /dev/null +++ b/examples/v2/widgets/UpdateWidget.java @@ -0,0 +1,47 @@ +// Update a widget returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.WidgetsApi; +import com.datadog.api.client.v2.model.CreateOrUpdateWidgetRequest; +import com.datadog.api.client.v2.model.CreateOrUpdateWidgetRequestAttributes; +import com.datadog.api.client.v2.model.CreateOrUpdateWidgetRequestData; +import com.datadog.api.client.v2.model.WidgetDefinition; +import com.datadog.api.client.v2.model.WidgetExperienceType; +import com.datadog.api.client.v2.model.WidgetResponse; +import com.datadog.api.client.v2.model.WidgetType; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + WidgetsApi apiInstance = new WidgetsApi(defaultClient); + + CreateOrUpdateWidgetRequest body = + new CreateOrUpdateWidgetRequest() + .data( + new CreateOrUpdateWidgetRequestData() + .attributes( + new CreateOrUpdateWidgetRequestAttributes() + .definition( + new WidgetDefinition() + .title("My Widget") + .type(WidgetType.BAR_CHART))) + .type("widgets")); + + try { + WidgetResponse result = + apiInstance.updateWidget( + WidgetExperienceType.CCM_REPORTS, + UUID.fromString("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), + body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling WidgetsApi#updateWidget"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 03d15246b69..e471ec74a02 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -945,12 +945,6 @@ public class ApiClient { put("v2.queryUsers", false); put("v2.updateConnection", false); put("v2.createScorecardOutcomesBatch", false); - put("v2.createScorecardRule", false); - put("v2.deleteScorecardRule", false); - put("v2.listScorecardOutcomes", false); - put("v2.listScorecardRules", false); - put("v2.updateScorecardOutcomesAsync", false); - put("v2.updateScorecardRule", false); put("v2.listEntityRiskScores", false); put("v2.createIncidentService", false); put("v2.deleteIncidentService", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/ServiceScorecardsApi.java b/src/main/java/com/datadog/api/client/v2/api/ScorecardsApi.java similarity index 55% rename from src/main/java/com/datadog/api/client/v2/api/ServiceScorecardsApi.java rename to src/main/java/com/datadog/api/client/v2/api/ScorecardsApi.java index 58e809fb751..9b8654019e2 100644 --- a/src/main/java/com/datadog/api/client/v2/api/ServiceScorecardsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/ScorecardsApi.java @@ -5,14 +5,19 @@ import com.datadog.api.client.ApiResponse; import com.datadog.api.client.PaginationIterable; import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.CampaignResponse; +import com.datadog.api.client.v2.model.CreateCampaignRequest; import com.datadog.api.client.v2.model.CreateRuleRequest; import com.datadog.api.client.v2.model.CreateRuleResponse; +import com.datadog.api.client.v2.model.ListCampaignsResponse; import com.datadog.api.client.v2.model.ListRulesResponse; import com.datadog.api.client.v2.model.ListRulesResponseDataItem; +import com.datadog.api.client.v2.model.ListScorecardsResponse; import com.datadog.api.client.v2.model.OutcomesBatchRequest; import com.datadog.api.client.v2.model.OutcomesBatchResponse; import com.datadog.api.client.v2.model.OutcomesResponse; import com.datadog.api.client.v2.model.OutcomesResponseDataItem; +import com.datadog.api.client.v2.model.UpdateCampaignRequest; import com.datadog.api.client.v2.model.UpdateOutcomesAsyncRequest; import com.datadog.api.client.v2.model.UpdateRuleRequest; import com.datadog.api.client.v2.model.UpdateRuleResponse; @@ -27,14 +32,14 @@ @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class ServiceScorecardsApi { +public class ScorecardsApi { private ApiClient apiClient; - public ServiceScorecardsApi() { + public ScorecardsApi() { this(ApiClient.getDefaultApiClient()); } - public ServiceScorecardsApi(ApiClient apiClient) { + public ScorecardsApi(ApiClient apiClient) { this.apiClient = apiClient; } @@ -56,6 +61,138 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * Create a new campaign. + * + *

See {@link #createScorecardCampaignWithHttpInfo}. + * + * @param body Campaign data. (required) + * @return CampaignResponse + * @throws ApiException if fails to make API call + */ + public CampaignResponse createScorecardCampaign(CreateCampaignRequest body) throws ApiException { + return createScorecardCampaignWithHttpInfo(body).getData(); + } + + /** + * Create a new campaign. + * + *

See {@link #createScorecardCampaignWithHttpInfoAsync}. + * + * @param body Campaign data. (required) + * @return CompletableFuture<CampaignResponse> + */ + public CompletableFuture createScorecardCampaignAsync( + CreateCampaignRequest body) { + return createScorecardCampaignWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Creates a new scorecard campaign. + * + * @param body Campaign data. (required) + * @return ApiResponse<CampaignResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse createScorecardCampaignWithHttpInfo( + CreateCampaignRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createScorecardCampaign"); + } + // create path and map variables + String localVarPath = "/api/v2/scorecard/campaigns"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ScorecardsApi.createScorecardCampaign", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a new campaign. + * + *

See {@link #createScorecardCampaignWithHttpInfo}. + * + * @param body Campaign data. (required) + * @return CompletableFuture<ApiResponse<CampaignResponse>> + */ + public CompletableFuture> createScorecardCampaignWithHttpInfoAsync( + CreateCampaignRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createScorecardCampaign")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/scorecard/campaigns"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ScorecardsApi.createScorecardCampaign", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Create outcomes batch. * @@ -64,7 +201,9 @@ public void setApiClient(ApiClient apiClient) { * @param body Set of scorecard outcomes. (required) * @return OutcomesBatchResponse * @throws ApiException if fails to make API call + * @deprecated */ + @Deprecated public OutcomesBatchResponse createScorecardOutcomesBatch(OutcomesBatchRequest body) throws ApiException { return createScorecardOutcomesBatchWithHttpInfo(body).getData(); @@ -77,7 +216,9 @@ public OutcomesBatchResponse createScorecardOutcomesBatch(OutcomesBatchRequest b * * @param body Set of scorecard outcomes. (required) * @return CompletableFuture<OutcomesBatchResponse> + * @deprecated */ + @Deprecated public CompletableFuture createScorecardOutcomesBatchAsync( OutcomesBatchRequest body) { return createScorecardOutcomesBatchWithHttpInfoAsync(body) @@ -102,7 +243,10 @@ public CompletableFuture createScorecardOutcomesBatchAsyn * 403 Forbidden - * 429 Too many requests - * + * + * @deprecated */ + @Deprecated public ApiResponse createScorecardOutcomesBatchWithHttpInfo( OutcomesBatchRequest body) throws ApiException { // Check if unstable operation is enabled @@ -126,7 +270,7 @@ public ApiResponse createScorecardOutcomesBatchWithHttpIn Invocation.Builder builder = apiClient.createBuilder( - "v2.ServiceScorecardsApi.createScorecardOutcomesBatch", + "v2.ScorecardsApi.createScorecardOutcomesBatch", localVarPath, new ArrayList(), localVarHeaderParams, @@ -151,7 +295,9 @@ public ApiResponse createScorecardOutcomesBatchWithHttpIn * * @param body Set of scorecard outcomes. (required) * @return CompletableFuture<ApiResponse<OutcomesBatchResponse>> + * @deprecated */ + @Deprecated public CompletableFuture> createScorecardOutcomesBatchWithHttpInfoAsync(OutcomesBatchRequest body) { // Check if unstable operation is enabled @@ -184,7 +330,7 @@ public ApiResponse createScorecardOutcomesBatchWithHttpIn try { builder = apiClient.createBuilder( - "v2.ServiceScorecardsApi.createScorecardOutcomesBatch", + "v2.ScorecardsApi.createScorecardOutcomesBatch", localVarPath, new ArrayList(), localVarHeaderParams, @@ -254,13 +400,6 @@ public CompletableFuture createScorecardRuleAsync(CreateRule */ public ApiResponse createScorecardRuleWithHttpInfo(CreateRuleRequest body) throws ApiException { - // Check if unstable operation is enabled - String operationId = "createScorecardRule"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); - } Object localVarPostBody = body; // verify the required parameter 'body' is set @@ -275,7 +414,7 @@ public ApiResponse createScorecardRuleWithHttpInfo(CreateRul Invocation.Builder builder = apiClient.createBuilder( - "v2.ServiceScorecardsApi.createScorecardRule", + "v2.ScorecardsApi.createScorecardRule", localVarPath, new ArrayList(), localVarHeaderParams, @@ -303,16 +442,6 @@ public ApiResponse createScorecardRuleWithHttpInfo(CreateRul */ public CompletableFuture> createScorecardRuleWithHttpInfoAsync( CreateRuleRequest body) { - // Check if unstable operation is enabled - String operationId = "createScorecardRule"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); - return result; - } Object localVarPostBody = body; // verify the required parameter 'body' is set @@ -332,7 +461,7 @@ public CompletableFuture> createScorecardRuleWit try { builder = apiClient.createBuilder( - "v2.ServiceScorecardsApi.createScorecardRule", + "v2.ScorecardsApi.createScorecardRule", localVarPath, new ArrayList(), localVarHeaderParams, @@ -355,6 +484,144 @@ public CompletableFuture> createScorecardRuleWit new GenericType() {}); } + /** + * Delete a campaign. + * + *

See {@link #deleteScorecardCampaignWithHttpInfo}. + * + * @param campaignId Campaign ID or key. (required) + * @throws ApiException if fails to make API call + */ + public void deleteScorecardCampaign(String campaignId) throws ApiException { + deleteScorecardCampaignWithHttpInfo(campaignId); + } + + /** + * Delete a campaign. + * + *

See {@link #deleteScorecardCampaignWithHttpInfoAsync}. + * + * @param campaignId Campaign ID or key. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteScorecardCampaignAsync(String campaignId) { + return deleteScorecardCampaignWithHttpInfoAsync(campaignId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Deletes a single campaign by ID or key. + * + * @param campaignId Campaign ID or key. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteScorecardCampaignWithHttpInfo(String campaignId) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'campaignId' is set + if (campaignId == null) { + throw new ApiException( + 400, "Missing the required parameter 'campaignId' when calling deleteScorecardCampaign"); + } + // create path and map variables + String localVarPath = + "/api/v2/scorecard/campaigns/{campaign_id}" + .replaceAll( + "\\{" + "campaign_id" + "\\}", apiClient.escapeString(campaignId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ScorecardsApi.deleteScorecardCampaign", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete a campaign. + * + *

See {@link #deleteScorecardCampaignWithHttpInfo}. + * + * @param campaignId Campaign ID or key. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteScorecardCampaignWithHttpInfoAsync( + String campaignId) { + Object localVarPostBody = null; + + // verify the required parameter 'campaignId' is set + if (campaignId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'campaignId' when calling deleteScorecardCampaign")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/scorecard/campaigns/{campaign_id}" + .replaceAll( + "\\{" + "campaign_id" + "\\}", apiClient.escapeString(campaignId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ScorecardsApi.deleteScorecardCampaign", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + /** * Delete a rule. * @@ -401,13 +668,6 @@ public CompletableFuture deleteScorecardRuleAsync(String ruleId) { * */ public ApiResponse deleteScorecardRuleWithHttpInfo(String ruleId) throws ApiException { - // Check if unstable operation is enabled - String operationId = "deleteScorecardRule"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); - } Object localVarPostBody = null; // verify the required parameter 'ruleId' is set @@ -424,7 +684,7 @@ public ApiResponse deleteScorecardRuleWithHttpInfo(String ruleId) throws A Invocation.Builder builder = apiClient.createBuilder( - "v2.ServiceScorecardsApi.deleteScorecardRule", + "v2.ScorecardsApi.deleteScorecardRule", localVarPath, new ArrayList(), localVarHeaderParams, @@ -451,16 +711,6 @@ public ApiResponse deleteScorecardRuleWithHttpInfo(String ruleId) throws A * @return CompletableFuture<ApiResponse<Void>> */ public CompletableFuture> deleteScorecardRuleWithHttpInfoAsync(String ruleId) { - // Check if unstable operation is enabled - String operationId = "deleteScorecardRule"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); - return result; - } Object localVarPostBody = null; // verify the required parameter 'ruleId' is set @@ -482,7 +732,7 @@ public CompletableFuture> deleteScorecardRuleWithHttpInfoAsync try { builder = apiClient.createBuilder( - "v2.ServiceScorecardsApi.deleteScorecardRule", + "v2.ScorecardsApi.deleteScorecardRule", localVarPath, new ArrayList(), localVarHeaderParams, @@ -505,36 +755,495 @@ public CompletableFuture> deleteScorecardRuleWithHttpInfoAsync null); } - /** Manage optional parameters to listScorecardOutcomes. */ - public static class ListScorecardOutcomesOptionalParameters { - private Long pageSize; - private Long pageOffset; + /** Manage optional parameters to getScorecardCampaign. */ + public static class GetScorecardCampaignOptionalParameters { private String include; - private String fieldsOutcome; - private String fieldsRule; - private String filterOutcomeServiceName; - private String filterOutcomeState; - private Boolean filterRuleEnabled; - private String filterRuleId; - private String filterRuleName; + private Boolean includeMeta; /** - * Set pageSize. + * Set include. * - * @param pageSize Size for a given page. The maximum allowed value is 100. (optional, default - * to 10) - * @return ListScorecardOutcomesOptionalParameters + * @param include Include related data (for example, scores). (optional) + * @return GetScorecardCampaignOptionalParameters */ - public ListScorecardOutcomesOptionalParameters pageSize(Long pageSize) { - this.pageSize = pageSize; + public GetScorecardCampaignOptionalParameters include(String include) { + this.include = include; return this; } /** - * Set pageOffset. + * Set includeMeta. * - * @param pageOffset Specific offset to use as the beginning of the returned page. (optional, - * default to 0) + * @param includeMeta Include metadata (entity and rule counts). (optional) + * @return GetScorecardCampaignOptionalParameters + */ + public GetScorecardCampaignOptionalParameters includeMeta(Boolean includeMeta) { + this.includeMeta = includeMeta; + return this; + } + } + + /** + * Get a campaign. + * + *

See {@link #getScorecardCampaignWithHttpInfo}. + * + * @param campaignId Campaign ID or key. (required) + * @return CampaignResponse + * @throws ApiException if fails to make API call + */ + public CampaignResponse getScorecardCampaign(String campaignId) throws ApiException { + return getScorecardCampaignWithHttpInfo( + campaignId, new GetScorecardCampaignOptionalParameters()) + .getData(); + } + + /** + * Get a campaign. + * + *

See {@link #getScorecardCampaignWithHttpInfoAsync}. + * + * @param campaignId Campaign ID or key. (required) + * @return CompletableFuture<CampaignResponse> + */ + public CompletableFuture getScorecardCampaignAsync(String campaignId) { + return getScorecardCampaignWithHttpInfoAsync( + campaignId, new GetScorecardCampaignOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get a campaign. + * + *

See {@link #getScorecardCampaignWithHttpInfo}. + * + * @param campaignId Campaign ID or key. (required) + * @param parameters Optional parameters for the request. + * @return CampaignResponse + * @throws ApiException if fails to make API call + */ + public CampaignResponse getScorecardCampaign( + String campaignId, GetScorecardCampaignOptionalParameters parameters) throws ApiException { + return getScorecardCampaignWithHttpInfo(campaignId, parameters).getData(); + } + + /** + * Get a campaign. + * + *

See {@link #getScorecardCampaignWithHttpInfoAsync}. + * + * @param campaignId Campaign ID or key. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<CampaignResponse> + */ + public CompletableFuture getScorecardCampaignAsync( + String campaignId, GetScorecardCampaignOptionalParameters parameters) { + return getScorecardCampaignWithHttpInfoAsync(campaignId, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Fetches a single campaign by ID or key. + * + * @param campaignId Campaign ID or key. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<CampaignResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getScorecardCampaignWithHttpInfo( + String campaignId, GetScorecardCampaignOptionalParameters parameters) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'campaignId' is set + if (campaignId == null) { + throw new ApiException( + 400, "Missing the required parameter 'campaignId' when calling getScorecardCampaign"); + } + String include = parameters.include; + Boolean includeMeta = parameters.includeMeta; + // create path and map variables + String localVarPath = + "/api/v2/scorecard/campaigns/{campaign_id}" + .replaceAll( + "\\{" + "campaign_id" + "\\}", apiClient.escapeString(campaignId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_meta", includeMeta)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ScorecardsApi.getScorecardCampaign", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a campaign. + * + *

See {@link #getScorecardCampaignWithHttpInfo}. + * + * @param campaignId Campaign ID or key. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<CampaignResponse>> + */ + public CompletableFuture> getScorecardCampaignWithHttpInfoAsync( + String campaignId, GetScorecardCampaignOptionalParameters parameters) { + Object localVarPostBody = null; + + // verify the required parameter 'campaignId' is set + if (campaignId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'campaignId' when calling getScorecardCampaign")); + return result; + } + String include = parameters.include; + Boolean includeMeta = parameters.includeMeta; + // create path and map variables + String localVarPath = + "/api/v2/scorecard/campaigns/{campaign_id}" + .replaceAll( + "\\{" + "campaign_id" + "\\}", apiClient.escapeString(campaignId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_meta", includeMeta)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ScorecardsApi.getScorecardCampaign", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to listScorecardCampaigns. */ + public static class ListScorecardCampaignsOptionalParameters { + private Long pageLimit; + private Long pageOffset; + private String filterCampaignName; + private String filterCampaignStatus; + private String filterCampaignOwner; + + /** + * Set pageLimit. + * + * @param pageLimit Maximum number of campaigns to return. (optional, default to 10) + * @return ListScorecardCampaignsOptionalParameters + */ + public ListScorecardCampaignsOptionalParameters pageLimit(Long pageLimit) { + this.pageLimit = pageLimit; + return this; + } + + /** + * Set pageOffset. + * + * @param pageOffset Offset for pagination. (optional, default to 0) + * @return ListScorecardCampaignsOptionalParameters + */ + public ListScorecardCampaignsOptionalParameters pageOffset(Long pageOffset) { + this.pageOffset = pageOffset; + return this; + } + + /** + * Set filterCampaignName. + * + * @param filterCampaignName Filter campaigns by name (full-text search). (optional) + * @return ListScorecardCampaignsOptionalParameters + */ + public ListScorecardCampaignsOptionalParameters filterCampaignName(String filterCampaignName) { + this.filterCampaignName = filterCampaignName; + return this; + } + + /** + * Set filterCampaignStatus. + * + * @param filterCampaignStatus Filter campaigns by status. (optional) + * @return ListScorecardCampaignsOptionalParameters + */ + public ListScorecardCampaignsOptionalParameters filterCampaignStatus( + String filterCampaignStatus) { + this.filterCampaignStatus = filterCampaignStatus; + return this; + } + + /** + * Set filterCampaignOwner. + * + * @param filterCampaignOwner Filter campaigns by owner UUID. (optional) + * @return ListScorecardCampaignsOptionalParameters + */ + public ListScorecardCampaignsOptionalParameters filterCampaignOwner( + String filterCampaignOwner) { + this.filterCampaignOwner = filterCampaignOwner; + return this; + } + } + + /** + * List all campaigns. + * + *

See {@link #listScorecardCampaignsWithHttpInfo}. + * + * @return ListCampaignsResponse + * @throws ApiException if fails to make API call + */ + public ListCampaignsResponse listScorecardCampaigns() throws ApiException { + return listScorecardCampaignsWithHttpInfo(new ListScorecardCampaignsOptionalParameters()) + .getData(); + } + + /** + * List all campaigns. + * + *

See {@link #listScorecardCampaignsWithHttpInfoAsync}. + * + * @return CompletableFuture<ListCampaignsResponse> + */ + public CompletableFuture listScorecardCampaignsAsync() { + return listScorecardCampaignsWithHttpInfoAsync(new ListScorecardCampaignsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List all campaigns. + * + *

See {@link #listScorecardCampaignsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return ListCampaignsResponse + * @throws ApiException if fails to make API call + */ + public ListCampaignsResponse listScorecardCampaigns( + ListScorecardCampaignsOptionalParameters parameters) throws ApiException { + return listScorecardCampaignsWithHttpInfo(parameters).getData(); + } + + /** + * List all campaigns. + * + *

See {@link #listScorecardCampaignsWithHttpInfoAsync}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ListCampaignsResponse> + */ + public CompletableFuture listScorecardCampaignsAsync( + ListScorecardCampaignsOptionalParameters parameters) { + return listScorecardCampaignsWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Fetches all scorecard campaigns. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<ListCampaignsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listScorecardCampaignsWithHttpInfo( + ListScorecardCampaignsOptionalParameters parameters) throws ApiException { + Object localVarPostBody = null; + Long pageLimit = parameters.pageLimit; + Long pageOffset = parameters.pageOffset; + String filterCampaignName = parameters.filterCampaignName; + String filterCampaignStatus = parameters.filterCampaignStatus; + String filterCampaignOwner = parameters.filterCampaignOwner; + // create path and map variables + String localVarPath = "/api/v2/scorecard/campaigns"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[campaign][name]", filterCampaignName)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[campaign][status]", filterCampaignStatus)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[campaign][owner]", filterCampaignOwner)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ScorecardsApi.listScorecardCampaigns", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List all campaigns. + * + *

See {@link #listScorecardCampaignsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<ListCampaignsResponse>> + */ + public CompletableFuture> + listScorecardCampaignsWithHttpInfoAsync(ListScorecardCampaignsOptionalParameters parameters) { + Object localVarPostBody = null; + Long pageLimit = parameters.pageLimit; + Long pageOffset = parameters.pageOffset; + String filterCampaignName = parameters.filterCampaignName; + String filterCampaignStatus = parameters.filterCampaignStatus; + String filterCampaignOwner = parameters.filterCampaignOwner; + // create path and map variables + String localVarPath = "/api/v2/scorecard/campaigns"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[limit]", pageLimit)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[campaign][name]", filterCampaignName)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[campaign][status]", filterCampaignStatus)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[campaign][owner]", filterCampaignOwner)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ScorecardsApi.listScorecardCampaigns", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to listScorecardOutcomes. */ + public static class ListScorecardOutcomesOptionalParameters { + private Long pageSize; + private Long pageOffset; + private String include; + private String fieldsOutcome; + private String fieldsRule; + private String filterOutcomeServiceName; + private String filterOutcomeState; + private Boolean filterRuleEnabled; + private String filterRuleId; + private String filterRuleName; + + /** + * Set pageSize. + * + * @param pageSize Size for a given page. The maximum allowed value is 100. (optional, default + * to 10) + * @return ListScorecardOutcomesOptionalParameters + */ + public ListScorecardOutcomesOptionalParameters pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Set pageOffset. + * + * @param pageOffset Specific offset to use as the beginning of the returned page. (optional, + * default to 0) * @return ListScorecardOutcomesOptionalParameters */ public ListScorecardOutcomesOptionalParameters pageOffset(Long pageOffset) { @@ -578,7 +1287,7 @@ public ListScorecardOutcomesOptionalParameters fieldsRule(String fieldsRule) { /** * Set filterOutcomeServiceName. * - * @param filterOutcomeServiceName Filter the outcomes on a specific service name. (optional) + * @param filterOutcomeServiceName Filter outcomes on a specific service name. (optional) * @return ListScorecardOutcomesOptionalParameters */ public ListScorecardOutcomesOptionalParameters filterOutcomeServiceName( @@ -590,7 +1299,7 @@ public ListScorecardOutcomesOptionalParameters filterOutcomeServiceName( /** * Set filterOutcomeState. * - * @param filterOutcomeState Filter the outcomes by a specific state. (optional) + * @param filterOutcomeState Filter outcomes by a specific state. (optional) * @return ListScorecardOutcomesOptionalParameters */ public ListScorecardOutcomesOptionalParameters filterOutcomeState(String filterOutcomeState) { @@ -601,7 +1310,8 @@ public ListScorecardOutcomesOptionalParameters filterOutcomeState(String filterO /** * Set filterRuleEnabled. * - * @param filterRuleEnabled Filter outcomes on whether a rule is enabled/disabled. (optional) + * @param filterRuleEnabled Filter outcomes based on whether a rule is enabled or disabled. + * (optional) * @return ListScorecardOutcomesOptionalParameters */ public ListScorecardOutcomesOptionalParameters filterRuleEnabled(Boolean filterRuleEnabled) { @@ -759,17 +1469,10 @@ public PaginationIterable listScorecardOutcomesWithPag * 400 Bad Request - * 403 Forbidden - * 429 Too many requests - - * - */ - public ApiResponse listScorecardOutcomesWithHttpInfo( - ListScorecardOutcomesOptionalParameters parameters) throws ApiException { - // Check if unstable operation is enabled - String operationId = "listScorecardOutcomes"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); - } + * + */ + public ApiResponse listScorecardOutcomesWithHttpInfo( + ListScorecardOutcomesOptionalParameters parameters) throws ApiException { Object localVarPostBody = null; Long pageSize = parameters.pageSize; Long pageOffset = parameters.pageOffset; @@ -804,7 +1507,7 @@ public ApiResponse listScorecardOutcomesWithHttpInfo( Invocation.Builder builder = apiClient.createBuilder( - "v2.ServiceScorecardsApi.listScorecardOutcomes", + "v2.ScorecardsApi.listScorecardOutcomes", localVarPath, localVarQueryParams, localVarHeaderParams, @@ -832,16 +1535,6 @@ public ApiResponse listScorecardOutcomesWithHttpInfo( */ public CompletableFuture> listScorecardOutcomesWithHttpInfoAsync( ListScorecardOutcomesOptionalParameters parameters) { - // Check if unstable operation is enabled - String operationId = "listScorecardOutcomes"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); - return result; - } Object localVarPostBody = null; Long pageSize = parameters.pageSize; Long pageOffset = parameters.pageOffset; @@ -878,7 +1571,7 @@ public CompletableFuture> listScorecardOutcomesWit try { builder = apiClient.createBuilder( - "v2.ServiceScorecardsApi.listScorecardOutcomes", + "v2.ScorecardsApi.listScorecardOutcomes", localVarPath, localVarQueryParams, localVarHeaderParams, @@ -1102,105 +1795,350 @@ public PaginationIterable listScorecardRulesWithPagin /** * List all rules. * - *

See {@link #listScorecardRulesWithHttpInfo}. + *

See {@link #listScorecardRulesWithHttpInfo}. + * + * @return ListRulesResponse + */ + public PaginationIterable listScorecardRulesWithPagination( + ListScorecardRulesOptionalParameters parameters) { + String resultsPath = "getData"; + String valueGetterPath = ""; + String valueSetterPath = "pageOffset"; + Boolean valueSetterParamOptional = true; + Long limit; + + if (parameters.pageSize == null) { + limit = 10l; + parameters.pageSize(limit); + } else { + limit = parameters.pageSize; + } + + LinkedHashMap args = new LinkedHashMap(); + args.put("optionalParams", parameters); + + PaginationIterable iterator = + new PaginationIterable( + this, + "listScorecardRules", + resultsPath, + valueGetterPath, + valueSetterPath, + valueSetterParamOptional, + true, + limit, + args, + 0); + + return iterator; + } + + /** + * Fetch all rules. + * + * @param parameters Optional parameters for the request. + * @return ApiResponse<ListRulesResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse listScorecardRulesWithHttpInfo( + ListScorecardRulesOptionalParameters parameters) throws ApiException { + Object localVarPostBody = null; + Long pageSize = parameters.pageSize; + Long pageOffset = parameters.pageOffset; + String include = parameters.include; + String filterRuleId = parameters.filterRuleId; + Boolean filterRuleEnabled = parameters.filterRuleEnabled; + Boolean filterRuleCustom = parameters.filterRuleCustom; + String filterRuleName = parameters.filterRuleName; + String filterRuleDescription = parameters.filterRuleDescription; + String fieldsRule = parameters.fieldsRule; + String fieldsScorecard = parameters.fieldsScorecard; + // create path and map variables + String localVarPath = "/api/v2/scorecard/rules"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[rule][id]", filterRuleId)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][enabled]", filterRuleEnabled)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][custom]", filterRuleCustom)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][name]", filterRuleName)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][description]", filterRuleDescription)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "fields[rule]", fieldsRule)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "fields[scorecard]", fieldsScorecard)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ScorecardsApi.listScorecardRules", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * List all rules. + * + *

See {@link #listScorecardRulesWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<ListRulesResponse>> + */ + public CompletableFuture> listScorecardRulesWithHttpInfoAsync( + ListScorecardRulesOptionalParameters parameters) { + Object localVarPostBody = null; + Long pageSize = parameters.pageSize; + Long pageOffset = parameters.pageOffset; + String include = parameters.include; + String filterRuleId = parameters.filterRuleId; + Boolean filterRuleEnabled = parameters.filterRuleEnabled; + Boolean filterRuleCustom = parameters.filterRuleCustom; + String filterRuleName = parameters.filterRuleName; + String filterRuleDescription = parameters.filterRuleDescription; + String fieldsRule = parameters.fieldsRule; + String fieldsScorecard = parameters.fieldsScorecard; + // create path and map variables + String localVarPath = "/api/v2/scorecard/rules"; + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[rule][id]", filterRuleId)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][enabled]", filterRuleEnabled)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][custom]", filterRuleCustom)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][name]", filterRuleName)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[rule][description]", filterRuleDescription)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "fields[rule]", fieldsRule)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "fields[scorecard]", fieldsScorecard)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ScorecardsApi.listScorecardRules", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to listScorecards. */ + public static class ListScorecardsOptionalParameters { + private Long pageOffset; + private Long pageSize; + private String filterScorecardId; + private String filterScorecardName; + private String filterScorecardDescription; + + /** + * Set pageOffset. + * + * @param pageOffset Offset for pagination. (optional, default to 0) + * @return ListScorecardsOptionalParameters + */ + public ListScorecardsOptionalParameters pageOffset(Long pageOffset) { + this.pageOffset = pageOffset; + return this; + } + + /** + * Set pageSize. + * + * @param pageSize Maximum number of scorecards to return. (optional, default to 100) + * @return ListScorecardsOptionalParameters + */ + public ListScorecardsOptionalParameters pageSize(Long pageSize) { + this.pageSize = pageSize; + return this; + } + + /** + * Set filterScorecardId. + * + * @param filterScorecardId Filter by scorecard ID. (optional) + * @return ListScorecardsOptionalParameters + */ + public ListScorecardsOptionalParameters filterScorecardId(String filterScorecardId) { + this.filterScorecardId = filterScorecardId; + return this; + } + + /** + * Set filterScorecardName. + * + * @param filterScorecardName Filter by scorecard name (partial match). (optional) + * @return ListScorecardsOptionalParameters + */ + public ListScorecardsOptionalParameters filterScorecardName(String filterScorecardName) { + this.filterScorecardName = filterScorecardName; + return this; + } + + /** + * Set filterScorecardDescription. + * + * @param filterScorecardDescription Filter by scorecard description (partial match). (optional) + * @return ListScorecardsOptionalParameters + */ + public ListScorecardsOptionalParameters filterScorecardDescription( + String filterScorecardDescription) { + this.filterScorecardDescription = filterScorecardDescription; + return this; + } + } + + /** + * List all scorecards. + * + *

See {@link #listScorecardsWithHttpInfo}. + * + * @return ListScorecardsResponse + * @throws ApiException if fails to make API call + */ + public ListScorecardsResponse listScorecards() throws ApiException { + return listScorecardsWithHttpInfo(new ListScorecardsOptionalParameters()).getData(); + } + + /** + * List all scorecards. + * + *

See {@link #listScorecardsWithHttpInfoAsync}. + * + * @return CompletableFuture<ListScorecardsResponse> + */ + public CompletableFuture listScorecardsAsync() { + return listScorecardsWithHttpInfoAsync(new ListScorecardsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List all scorecards. + * + *

See {@link #listScorecardsWithHttpInfo}. + * + * @param parameters Optional parameters for the request. + * @return ListScorecardsResponse + * @throws ApiException if fails to make API call + */ + public ListScorecardsResponse listScorecards(ListScorecardsOptionalParameters parameters) + throws ApiException { + return listScorecardsWithHttpInfo(parameters).getData(); + } + + /** + * List all scorecards. + * + *

See {@link #listScorecardsWithHttpInfoAsync}. * - * @return ListRulesResponse + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ListScorecardsResponse> */ - public PaginationIterable listScorecardRulesWithPagination( - ListScorecardRulesOptionalParameters parameters) { - String resultsPath = "getData"; - String valueGetterPath = ""; - String valueSetterPath = "pageOffset"; - Boolean valueSetterParamOptional = true; - Long limit; - - if (parameters.pageSize == null) { - limit = 10l; - parameters.pageSize(limit); - } else { - limit = parameters.pageSize; - } - - LinkedHashMap args = new LinkedHashMap(); - args.put("optionalParams", parameters); - - PaginationIterable iterator = - new PaginationIterable( - this, - "listScorecardRules", - resultsPath, - valueGetterPath, - valueSetterPath, - valueSetterParamOptional, - true, - limit, - args, - 0); - - return iterator; + public CompletableFuture listScorecardsAsync( + ListScorecardsOptionalParameters parameters) { + return listScorecardsWithHttpInfoAsync(parameters) + .thenApply( + response -> { + return response.getData(); + }); } /** - * Fetch all rules. + * Fetches all scorecards. * * @param parameters Optional parameters for the request. - * @return ApiResponse<ListRulesResponse> + * @return ApiResponse<ListScorecardsResponse> * @throws ApiException if fails to make API call * @http.response.details * * * * - * * * *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
*/ - public ApiResponse listScorecardRulesWithHttpInfo( - ListScorecardRulesOptionalParameters parameters) throws ApiException { - // Check if unstable operation is enabled - String operationId = "listScorecardRules"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); - } + public ApiResponse listScorecardsWithHttpInfo( + ListScorecardsOptionalParameters parameters) throws ApiException { Object localVarPostBody = null; - Long pageSize = parameters.pageSize; Long pageOffset = parameters.pageOffset; - String include = parameters.include; - String filterRuleId = parameters.filterRuleId; - Boolean filterRuleEnabled = parameters.filterRuleEnabled; - Boolean filterRuleCustom = parameters.filterRuleCustom; - String filterRuleName = parameters.filterRuleName; - String filterRuleDescription = parameters.filterRuleDescription; - String fieldsRule = parameters.fieldsRule; - String fieldsScorecard = parameters.fieldsScorecard; + Long pageSize = parameters.pageSize; + String filterScorecardId = parameters.filterScorecardId; + String filterScorecardName = parameters.filterScorecardName; + String filterScorecardDescription = parameters.filterScorecardDescription; // create path and map variables - String localVarPath = "/api/v2/scorecard/rules"; + String localVarPath = "/api/v2/scorecard/scorecards"; List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[rule][id]", filterRuleId)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[rule][enabled]", filterRuleEnabled)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[rule][custom]", filterRuleCustom)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[rule][name]", filterRuleName)); + apiClient.parameterToPairs("", "filter[scorecard][id]", filterScorecardId)); localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[rule][description]", filterRuleDescription)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "fields[rule]", fieldsRule)); + apiClient.parameterToPairs("", "filter[scorecard][name]", filterScorecardName)); localVarQueryParams.addAll( - apiClient.parameterToPairs("", "fields[scorecard]", fieldsScorecard)); + apiClient.parameterToPairs( + "", "filter[scorecard][description]", filterScorecardDescription)); Invocation.Builder builder = apiClient.createBuilder( - "v2.ServiceScorecardsApi.listScorecardRules", + "v2.ScorecardsApi.listScorecards", localVarPath, localVarQueryParams, localVarHeaderParams, @@ -1215,67 +2153,46 @@ public ApiResponse listScorecardRulesWithHttpInfo( localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * List all rules. + * List all scorecards. * - *

See {@link #listScorecardRulesWithHttpInfo}. + *

See {@link #listScorecardsWithHttpInfo}. * * @param parameters Optional parameters for the request. - * @return CompletableFuture<ApiResponse<ListRulesResponse>> + * @return CompletableFuture<ApiResponse<ListScorecardsResponse>> */ - public CompletableFuture> listScorecardRulesWithHttpInfoAsync( - ListScorecardRulesOptionalParameters parameters) { - // Check if unstable operation is enabled - String operationId = "listScorecardRules"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); - return result; - } + public CompletableFuture> listScorecardsWithHttpInfoAsync( + ListScorecardsOptionalParameters parameters) { Object localVarPostBody = null; - Long pageSize = parameters.pageSize; Long pageOffset = parameters.pageOffset; - String include = parameters.include; - String filterRuleId = parameters.filterRuleId; - Boolean filterRuleEnabled = parameters.filterRuleEnabled; - Boolean filterRuleCustom = parameters.filterRuleCustom; - String filterRuleName = parameters.filterRuleName; - String filterRuleDescription = parameters.filterRuleDescription; - String fieldsRule = parameters.fieldsRule; - String fieldsScorecard = parameters.fieldsScorecard; + Long pageSize = parameters.pageSize; + String filterScorecardId = parameters.filterScorecardId; + String filterScorecardName = parameters.filterScorecardName; + String filterScorecardDescription = parameters.filterScorecardDescription; // create path and map variables - String localVarPath = "/api/v2/scorecard/rules"; + String localVarPath = "/api/v2/scorecard/scorecards"; List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[offset]", pageOffset)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[rule][id]", filterRuleId)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[rule][enabled]", filterRuleEnabled)); - localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[rule][custom]", filterRuleCustom)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[rule][name]", filterRuleName)); + apiClient.parameterToPairs("", "filter[scorecard][id]", filterScorecardId)); localVarQueryParams.addAll( - apiClient.parameterToPairs("", "filter[rule][description]", filterRuleDescription)); - localVarQueryParams.addAll(apiClient.parameterToPairs("", "fields[rule]", fieldsRule)); + apiClient.parameterToPairs("", "filter[scorecard][name]", filterScorecardName)); localVarQueryParams.addAll( - apiClient.parameterToPairs("", "fields[scorecard]", fieldsScorecard)); + apiClient.parameterToPairs( + "", "filter[scorecard][description]", filterScorecardDescription)); Invocation.Builder builder; try { builder = apiClient.createBuilder( - "v2.ServiceScorecardsApi.listScorecardRules", + "v2.ScorecardsApi.listScorecards", localVarPath, localVarQueryParams, localVarHeaderParams, @@ -1283,7 +2200,7 @@ public CompletableFuture> listScorecardRulesWithH new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -1295,32 +2212,191 @@ public CompletableFuture> listScorecardRulesWithH localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); + } + + /** + * Update a campaign. + * + *

See {@link #updateScorecardCampaignWithHttpInfo}. + * + * @param campaignId Campaign ID or key. (required) + * @param body Campaign data. (required) + * @return CampaignResponse + * @throws ApiException if fails to make API call + */ + public CampaignResponse updateScorecardCampaign(String campaignId, UpdateCampaignRequest body) + throws ApiException { + return updateScorecardCampaignWithHttpInfo(campaignId, body).getData(); + } + + /** + * Update a campaign. + * + *

See {@link #updateScorecardCampaignWithHttpInfoAsync}. + * + * @param campaignId Campaign ID or key. (required) + * @param body Campaign data. (required) + * @return CompletableFuture<CampaignResponse> + */ + public CompletableFuture updateScorecardCampaignAsync( + String campaignId, UpdateCampaignRequest body) { + return updateScorecardCampaignWithHttpInfoAsync(campaignId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Updates an existing campaign. + * + * @param campaignId Campaign ID or key. (required) + * @param body Campaign data. (required) + * @return ApiResponse<CampaignResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updateScorecardCampaignWithHttpInfo( + String campaignId, UpdateCampaignRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'campaignId' is set + if (campaignId == null) { + throw new ApiException( + 400, "Missing the required parameter 'campaignId' when calling updateScorecardCampaign"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateScorecardCampaign"); + } + // create path and map variables + String localVarPath = + "/api/v2/scorecard/campaigns/{campaign_id}" + .replaceAll( + "\\{" + "campaign_id" + "\\}", apiClient.escapeString(campaignId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ScorecardsApi.updateScorecardCampaign", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update a campaign. + * + *

See {@link #updateScorecardCampaignWithHttpInfo}. + * + * @param campaignId Campaign ID or key. (required) + * @param body Campaign data. (required) + * @return CompletableFuture<ApiResponse<CampaignResponse>> + */ + public CompletableFuture> updateScorecardCampaignWithHttpInfoAsync( + String campaignId, UpdateCampaignRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'campaignId' is set + if (campaignId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'campaignId' when calling updateScorecardCampaign")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling updateScorecardCampaign")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/scorecard/campaigns/{campaign_id}" + .replaceAll( + "\\{" + "campaign_id" + "\\}", apiClient.escapeString(campaignId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ScorecardsApi.updateScorecardCampaign", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); } /** - * Update Scorecard outcomes asynchronously. + * Update Scorecard outcomes. * - *

See {@link #updateScorecardOutcomesAsyncWithHttpInfo}. + *

See {@link #updateScorecardOutcomesWithHttpInfo}. * * @param body Set of scorecard outcomes. (required) * @throws ApiException if fails to make API call */ - public void updateScorecardOutcomesAsync(UpdateOutcomesAsyncRequest body) throws ApiException { - updateScorecardOutcomesAsyncWithHttpInfo(body); + public void updateScorecardOutcomes(UpdateOutcomesAsyncRequest body) throws ApiException { + updateScorecardOutcomesWithHttpInfo(body); } /** - * Update Scorecard outcomes asynchronously. + * Update Scorecard outcomes. * - *

See {@link #updateScorecardOutcomesAsyncWithHttpInfoAsync}. + *

See {@link #updateScorecardOutcomesWithHttpInfoAsync}. * * @param body Set of scorecard outcomes. (required) * @return CompletableFuture */ - public CompletableFuture updateScorecardOutcomesAsyncAsync( - UpdateOutcomesAsyncRequest body) { - return updateScorecardOutcomesAsyncWithHttpInfoAsync(body) + public CompletableFuture updateScorecardOutcomesAsync(UpdateOutcomesAsyncRequest body) { + return updateScorecardOutcomesWithHttpInfoAsync(body) .thenApply( response -> { return response.getData(); @@ -1344,21 +2420,14 @@ public CompletableFuture updateScorecardOutcomesAsyncAsync( * 429 Too many requests - * */ - public ApiResponse updateScorecardOutcomesAsyncWithHttpInfo(UpdateOutcomesAsyncRequest body) + public ApiResponse updateScorecardOutcomesWithHttpInfo(UpdateOutcomesAsyncRequest body) throws ApiException { - // Check if unstable operation is enabled - String operationId = "updateScorecardOutcomesAsync"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); - } Object localVarPostBody = body; // verify the required parameter 'body' is set if (body == null) { throw new ApiException( - 400, "Missing the required parameter 'body' when calling updateScorecardOutcomesAsync"); + 400, "Missing the required parameter 'body' when calling updateScorecardOutcomes"); } // create path and map variables String localVarPath = "/api/v2/scorecard/outcomes"; @@ -1367,7 +2436,7 @@ public ApiResponse updateScorecardOutcomesAsyncWithHttpInfo(UpdateOutcomes Invocation.Builder builder = apiClient.createBuilder( - "v2.ServiceScorecardsApi.updateScorecardOutcomesAsync", + "v2.ScorecardsApi.updateScorecardOutcomes", localVarPath, new ArrayList(), localVarHeaderParams, @@ -1386,25 +2455,15 @@ public ApiResponse updateScorecardOutcomesAsyncWithHttpInfo(UpdateOutcomes } /** - * Update Scorecard outcomes asynchronously. + * Update Scorecard outcomes. * - *

See {@link #updateScorecardOutcomesAsyncWithHttpInfo}. + *

See {@link #updateScorecardOutcomesWithHttpInfo}. * * @param body Set of scorecard outcomes. (required) * @return CompletableFuture<ApiResponse<Void>> */ - public CompletableFuture> updateScorecardOutcomesAsyncWithHttpInfoAsync( + public CompletableFuture> updateScorecardOutcomesWithHttpInfoAsync( UpdateOutcomesAsyncRequest body) { - // Check if unstable operation is enabled - String operationId = "updateScorecardOutcomesAsync"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); - return result; - } Object localVarPostBody = body; // verify the required parameter 'body' is set @@ -1412,8 +2471,7 @@ public CompletableFuture> updateScorecardOutcomesAsyncWithHttp CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( - 400, - "Missing the required parameter 'body' when calling updateScorecardOutcomesAsync")); + 400, "Missing the required parameter 'body' when calling updateScorecardOutcomes")); return result; } // create path and map variables @@ -1425,7 +2483,7 @@ public CompletableFuture> updateScorecardOutcomesAsyncWithHttp try { builder = apiClient.createBuilder( - "v2.ServiceScorecardsApi.updateScorecardOutcomesAsync", + "v2.ScorecardsApi.updateScorecardOutcomes", localVarPath, new ArrayList(), localVarHeaderParams, @@ -1449,7 +2507,7 @@ public CompletableFuture> updateScorecardOutcomesAsyncWithHttp } /** - * Update an existing rule. + * Update an existing scorecard rule. * *

See {@link #updateScorecardRuleWithHttpInfo}. * @@ -1464,7 +2522,7 @@ public UpdateRuleResponse updateScorecardRule(String ruleId, UpdateRuleRequest b } /** - * Update an existing rule. + * Update an existing scorecard rule. * *

See {@link #updateScorecardRuleWithHttpInfoAsync}. * @@ -1500,13 +2558,6 @@ public CompletableFuture updateScorecardRuleAsync( */ public ApiResponse updateScorecardRuleWithHttpInfo( String ruleId, UpdateRuleRequest body) throws ApiException { - // Check if unstable operation is enabled - String operationId = "updateScorecardRule"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); - } Object localVarPostBody = body; // verify the required parameter 'ruleId' is set @@ -1529,7 +2580,7 @@ public ApiResponse updateScorecardRuleWithHttpInfo( Invocation.Builder builder = apiClient.createBuilder( - "v2.ServiceScorecardsApi.updateScorecardRule", + "v2.ScorecardsApi.updateScorecardRule", localVarPath, new ArrayList(), localVarHeaderParams, @@ -1548,7 +2599,7 @@ public ApiResponse updateScorecardRuleWithHttpInfo( } /** - * Update an existing rule. + * Update an existing scorecard rule. * *

See {@link #updateScorecardRuleWithHttpInfo}. * @@ -1558,16 +2609,6 @@ public ApiResponse updateScorecardRuleWithHttpInfo( */ public CompletableFuture> updateScorecardRuleWithHttpInfoAsync( String ruleId, UpdateRuleRequest body) { - // Check if unstable operation is enabled - String operationId = "updateScorecardRule"; - if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { - apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); - } else { - CompletableFuture> result = new CompletableFuture<>(); - result.completeExceptionally( - new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); - return result; - } Object localVarPostBody = body; // verify the required parameter 'ruleId' is set @@ -1598,7 +2639,7 @@ public CompletableFuture> updateScorecardRuleWit try { builder = apiClient.createBuilder( - "v2.ServiceScorecardsApi.updateScorecardRule", + "v2.ScorecardsApi.updateScorecardRule", localVarPath, new ArrayList(), localVarHeaderParams, diff --git a/src/main/java/com/datadog/api/client/v2/api/WidgetsApi.java b/src/main/java/com/datadog/api/client/v2/api/WidgetsApi.java new file mode 100644 index 00000000000..dc28ab77bf1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/WidgetsApi.java @@ -0,0 +1,1037 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.CreateOrUpdateWidgetRequest; +import com.datadog.api.client.v2.model.WidgetExperienceType; +import com.datadog.api.client.v2.model.WidgetListResponse; +import com.datadog.api.client.v2.model.WidgetResponse; +import com.datadog.api.client.v2.model.WidgetType; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WidgetsApi { + private ApiClient apiClient; + + public WidgetsApi() { + this(ApiClient.getDefaultApiClient()); + } + + public WidgetsApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create a widget. + * + *

See {@link #createWidgetWithHttpInfo}. + * + * @param experienceType The experience type for the widget. (required) + * @param body Widget request body. (required) + * @return WidgetResponse + * @throws ApiException if fails to make API call + */ + public WidgetResponse createWidget( + WidgetExperienceType experienceType, CreateOrUpdateWidgetRequest body) throws ApiException { + return createWidgetWithHttpInfo(experienceType, body).getData(); + } + + /** + * Create a widget. + * + *

See {@link #createWidgetWithHttpInfoAsync}. + * + * @param experienceType The experience type for the widget. (required) + * @param body Widget request body. (required) + * @return CompletableFuture<WidgetResponse> + */ + public CompletableFuture createWidgetAsync( + WidgetExperienceType experienceType, CreateOrUpdateWidgetRequest body) { + return createWidgetWithHttpInfoAsync(experienceType, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a new widget for a given experience type. + * + * @param experienceType The experience type for the widget. (required) + * @param body Widget request body. (required) + * @return ApiResponse<WidgetResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse createWidgetWithHttpInfo( + WidgetExperienceType experienceType, CreateOrUpdateWidgetRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'experienceType' is set + if (experienceType == null) { + throw new ApiException( + 400, "Missing the required parameter 'experienceType' when calling createWidget"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createWidget"); + } + // create path and map variables + String localVarPath = + "/api/v2/widgets/{experience_type}" + .replaceAll( + "\\{" + "experience_type" + "\\}", + apiClient.escapeString(experienceType.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.WidgetsApi.createWidget", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a widget. + * + *

See {@link #createWidgetWithHttpInfo}. + * + * @param experienceType The experience type for the widget. (required) + * @param body Widget request body. (required) + * @return CompletableFuture<ApiResponse<WidgetResponse>> + */ + public CompletableFuture> createWidgetWithHttpInfoAsync( + WidgetExperienceType experienceType, CreateOrUpdateWidgetRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'experienceType' is set + if (experienceType == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'experienceType' when calling createWidget")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(400, "Missing the required parameter 'body' when calling createWidget")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/widgets/{experience_type}" + .replaceAll( + "\\{" + "experience_type" + "\\}", + apiClient.escapeString(experienceType.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.WidgetsApi.createWidget", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Delete a widget. + * + *

See {@link #deleteWidgetWithHttpInfo}. + * + * @param experienceType The experience type for the widget. (required) + * @param uuid The UUID of the widget. (required) + * @throws ApiException if fails to make API call + */ + public void deleteWidget(WidgetExperienceType experienceType, UUID uuid) throws ApiException { + deleteWidgetWithHttpInfo(experienceType, uuid); + } + + /** + * Delete a widget. + * + *

See {@link #deleteWidgetWithHttpInfoAsync}. + * + * @param experienceType The experience type for the widget. (required) + * @param uuid The UUID of the widget. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteWidgetAsync(WidgetExperienceType experienceType, UUID uuid) { + return deleteWidgetWithHttpInfoAsync(experienceType, uuid) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Soft-delete a widget by its UUID for a given experience type. + * + * @param experienceType The experience type for the widget. (required) + * @param uuid The UUID of the widget. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 No Content -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteWidgetWithHttpInfo(WidgetExperienceType experienceType, UUID uuid) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'experienceType' is set + if (experienceType == null) { + throw new ApiException( + 400, "Missing the required parameter 'experienceType' when calling deleteWidget"); + } + + // verify the required parameter 'uuid' is set + if (uuid == null) { + throw new ApiException( + 400, "Missing the required parameter 'uuid' when calling deleteWidget"); + } + // create path and map variables + String localVarPath = + "/api/v2/widgets/{experience_type}/{uuid}" + .replaceAll( + "\\{" + "experience_type" + "\\}", + apiClient.escapeString(experienceType.toString())) + .replaceAll("\\{" + "uuid" + "\\}", apiClient.escapeString(uuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.WidgetsApi.deleteWidget", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete a widget. + * + *

See {@link #deleteWidgetWithHttpInfo}. + * + * @param experienceType The experience type for the widget. (required) + * @param uuid The UUID of the widget. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteWidgetWithHttpInfoAsync( + WidgetExperienceType experienceType, UUID uuid) { + Object localVarPostBody = null; + + // verify the required parameter 'experienceType' is set + if (experienceType == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'experienceType' when calling deleteWidget")); + return result; + } + + // verify the required parameter 'uuid' is set + if (uuid == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(400, "Missing the required parameter 'uuid' when calling deleteWidget")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/widgets/{experience_type}/{uuid}" + .replaceAll( + "\\{" + "experience_type" + "\\}", + apiClient.escapeString(experienceType.toString())) + .replaceAll("\\{" + "uuid" + "\\}", apiClient.escapeString(uuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.WidgetsApi.deleteWidget", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Get a widget. + * + *

See {@link #getWidgetWithHttpInfo}. + * + * @param experienceType The experience type for the widget. (required) + * @param uuid The UUID of the widget. (required) + * @return WidgetResponse + * @throws ApiException if fails to make API call + */ + public WidgetResponse getWidget(WidgetExperienceType experienceType, UUID uuid) + throws ApiException { + return getWidgetWithHttpInfo(experienceType, uuid).getData(); + } + + /** + * Get a widget. + * + *

See {@link #getWidgetWithHttpInfoAsync}. + * + * @param experienceType The experience type for the widget. (required) + * @param uuid The UUID of the widget. (required) + * @return CompletableFuture<WidgetResponse> + */ + public CompletableFuture getWidgetAsync( + WidgetExperienceType experienceType, UUID uuid) { + return getWidgetWithHttpInfoAsync(experienceType, uuid) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve a widget by its UUID for a given experience type. + * + * @param experienceType The experience type for the widget. (required) + * @param uuid The UUID of the widget. (required) + * @return ApiResponse<WidgetResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getWidgetWithHttpInfo( + WidgetExperienceType experienceType, UUID uuid) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'experienceType' is set + if (experienceType == null) { + throw new ApiException( + 400, "Missing the required parameter 'experienceType' when calling getWidget"); + } + + // verify the required parameter 'uuid' is set + if (uuid == null) { + throw new ApiException(400, "Missing the required parameter 'uuid' when calling getWidget"); + } + // create path and map variables + String localVarPath = + "/api/v2/widgets/{experience_type}/{uuid}" + .replaceAll( + "\\{" + "experience_type" + "\\}", + apiClient.escapeString(experienceType.toString())) + .replaceAll("\\{" + "uuid" + "\\}", apiClient.escapeString(uuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.WidgetsApi.getWidget", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a widget. + * + *

See {@link #getWidgetWithHttpInfo}. + * + * @param experienceType The experience type for the widget. (required) + * @param uuid The UUID of the widget. (required) + * @return CompletableFuture<ApiResponse<WidgetResponse>> + */ + public CompletableFuture> getWidgetWithHttpInfoAsync( + WidgetExperienceType experienceType, UUID uuid) { + Object localVarPostBody = null; + + // verify the required parameter 'experienceType' is set + if (experienceType == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'experienceType' when calling getWidget")); + return result; + } + + // verify the required parameter 'uuid' is set + if (uuid == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(400, "Missing the required parameter 'uuid' when calling getWidget")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/widgets/{experience_type}/{uuid}" + .replaceAll( + "\\{" + "experience_type" + "\\}", + apiClient.escapeString(experienceType.toString())) + .replaceAll("\\{" + "uuid" + "\\}", apiClient.escapeString(uuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.WidgetsApi.getWidget", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to searchWidgets. */ + public static class SearchWidgetsOptionalParameters { + private WidgetType filterWidgetType; + private String filterCreatorHandle; + private Boolean filterIsFavorited; + private String filterTitle; + private String filterTags; + private String sort; + private Integer pageNumber; + private Integer pageSize; + + /** + * Set filterWidgetType. + * + * @param filterWidgetType Filter widgets by widget type. (optional) + * @return SearchWidgetsOptionalParameters + */ + public SearchWidgetsOptionalParameters filterWidgetType(WidgetType filterWidgetType) { + this.filterWidgetType = filterWidgetType; + return this; + } + + /** + * Set filterCreatorHandle. + * + * @param filterCreatorHandle Filter widgets by the email handle of the creator. (optional) + * @return SearchWidgetsOptionalParameters + */ + public SearchWidgetsOptionalParameters filterCreatorHandle(String filterCreatorHandle) { + this.filterCreatorHandle = filterCreatorHandle; + return this; + } + + /** + * Set filterIsFavorited. + * + * @param filterIsFavorited Filter to only widgets favorited by the current user. (optional) + * @return SearchWidgetsOptionalParameters + */ + public SearchWidgetsOptionalParameters filterIsFavorited(Boolean filterIsFavorited) { + this.filterIsFavorited = filterIsFavorited; + return this; + } + + /** + * Set filterTitle. + * + * @param filterTitle Filter widgets by title (substring match). (optional) + * @return SearchWidgetsOptionalParameters + */ + public SearchWidgetsOptionalParameters filterTitle(String filterTitle) { + this.filterTitle = filterTitle; + return this; + } + + /** + * Set filterTags. + * + * @param filterTags Filter widgets by tags. Format as bracket-delimited CSV, e.g. + * [tag1,tag2]. (optional) + * @return SearchWidgetsOptionalParameters + */ + public SearchWidgetsOptionalParameters filterTags(String filterTags) { + this.filterTags = filterTags; + return this; + } + + /** + * Set sort. + * + * @param sort Sort field for the results. Prefix with - for descending order. + * Allowed values: title, created_at, modified_at. + * (optional, default to "-modified_at") + * @return SearchWidgetsOptionalParameters + */ + public SearchWidgetsOptionalParameters sort(String sort) { + this.sort = sort; + return this; + } + + /** + * Set pageNumber. + * + * @param pageNumber Page number for pagination (0-indexed). (optional, default to 0) + * @return SearchWidgetsOptionalParameters + */ + public SearchWidgetsOptionalParameters pageNumber(Integer pageNumber) { + this.pageNumber = pageNumber; + return this; + } + + /** + * Set pageSize. + * + * @param pageSize Number of widgets per page. (optional, default to 50) + * @return SearchWidgetsOptionalParameters + */ + public SearchWidgetsOptionalParameters pageSize(Integer pageSize) { + this.pageSize = pageSize; + return this; + } + } + + /** + * Search widgets. + * + *

See {@link #searchWidgetsWithHttpInfo}. + * + * @param experienceType The experience type for the widget. (required) + * @return WidgetListResponse + * @throws ApiException if fails to make API call + */ + public WidgetListResponse searchWidgets(WidgetExperienceType experienceType) throws ApiException { + return searchWidgetsWithHttpInfo(experienceType, new SearchWidgetsOptionalParameters()) + .getData(); + } + + /** + * Search widgets. + * + *

See {@link #searchWidgetsWithHttpInfoAsync}. + * + * @param experienceType The experience type for the widget. (required) + * @return CompletableFuture<WidgetListResponse> + */ + public CompletableFuture searchWidgetsAsync( + WidgetExperienceType experienceType) { + return searchWidgetsWithHttpInfoAsync(experienceType, new SearchWidgetsOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Search widgets. + * + *

See {@link #searchWidgetsWithHttpInfo}. + * + * @param experienceType The experience type for the widget. (required) + * @param parameters Optional parameters for the request. + * @return WidgetListResponse + * @throws ApiException if fails to make API call + */ + public WidgetListResponse searchWidgets( + WidgetExperienceType experienceType, SearchWidgetsOptionalParameters parameters) + throws ApiException { + return searchWidgetsWithHttpInfo(experienceType, parameters).getData(); + } + + /** + * Search widgets. + * + *

See {@link #searchWidgetsWithHttpInfoAsync}. + * + * @param experienceType The experience type for the widget. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<WidgetListResponse> + */ + public CompletableFuture searchWidgetsAsync( + WidgetExperienceType experienceType, SearchWidgetsOptionalParameters parameters) { + return searchWidgetsWithHttpInfoAsync(experienceType, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Search and list widgets for a given experience type. Supports filtering by widget type, + * creator, title, and tags, as well as sorting and pagination. + * + * @param experienceType The experience type for the widget. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<WidgetListResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
429 Too many requests -
+ */ + public ApiResponse searchWidgetsWithHttpInfo( + WidgetExperienceType experienceType, SearchWidgetsOptionalParameters parameters) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'experienceType' is set + if (experienceType == null) { + throw new ApiException( + 400, "Missing the required parameter 'experienceType' when calling searchWidgets"); + } + WidgetType filterWidgetType = parameters.filterWidgetType; + String filterCreatorHandle = parameters.filterCreatorHandle; + Boolean filterIsFavorited = parameters.filterIsFavorited; + String filterTitle = parameters.filterTitle; + String filterTags = parameters.filterTags; + String sort = parameters.sort; + Integer pageNumber = parameters.pageNumber; + Integer pageSize = parameters.pageSize; + // create path and map variables + String localVarPath = + "/api/v2/widgets/{experience_type}" + .replaceAll( + "\\{" + "experience_type" + "\\}", + apiClient.escapeString(experienceType.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[widgetType]", filterWidgetType)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[creatorHandle]", filterCreatorHandle)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[isFavorited]", filterIsFavorited)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[title]", filterTitle)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[tags]", filterTags)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.WidgetsApi.searchWidgets", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Search widgets. + * + *

See {@link #searchWidgetsWithHttpInfo}. + * + * @param experienceType The experience type for the widget. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<WidgetListResponse>> + */ + public CompletableFuture> searchWidgetsWithHttpInfoAsync( + WidgetExperienceType experienceType, SearchWidgetsOptionalParameters parameters) { + Object localVarPostBody = null; + + // verify the required parameter 'experienceType' is set + if (experienceType == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'experienceType' when calling searchWidgets")); + return result; + } + WidgetType filterWidgetType = parameters.filterWidgetType; + String filterCreatorHandle = parameters.filterCreatorHandle; + Boolean filterIsFavorited = parameters.filterIsFavorited; + String filterTitle = parameters.filterTitle; + String filterTags = parameters.filterTags; + String sort = parameters.sort; + Integer pageNumber = parameters.pageNumber; + Integer pageSize = parameters.pageSize; + // create path and map variables + String localVarPath = + "/api/v2/widgets/{experience_type}" + .replaceAll( + "\\{" + "experience_type" + "\\}", + apiClient.escapeString(experienceType.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[widgetType]", filterWidgetType)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[creatorHandle]", filterCreatorHandle)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "filter[isFavorited]", filterIsFavorited)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[title]", filterTitle)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter[tags]", filterTags)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[number]", pageNumber)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "page[size]", pageSize)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.WidgetsApi.searchWidgets", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update a widget. + * + *

See {@link #updateWidgetWithHttpInfo}. + * + * @param experienceType The experience type for the widget. (required) + * @param uuid The UUID of the widget. (required) + * @param body Widget request body. (required) + * @return WidgetResponse + * @throws ApiException if fails to make API call + */ + public WidgetResponse updateWidget( + WidgetExperienceType experienceType, UUID uuid, CreateOrUpdateWidgetRequest body) + throws ApiException { + return updateWidgetWithHttpInfo(experienceType, uuid, body).getData(); + } + + /** + * Update a widget. + * + *

See {@link #updateWidgetWithHttpInfoAsync}. + * + * @param experienceType The experience type for the widget. (required) + * @param uuid The UUID of the widget. (required) + * @param body Widget request body. (required) + * @return CompletableFuture<WidgetResponse> + */ + public CompletableFuture updateWidgetAsync( + WidgetExperienceType experienceType, UUID uuid, CreateOrUpdateWidgetRequest body) { + return updateWidgetWithHttpInfoAsync(experienceType, uuid, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update a widget by its UUID for a given experience type. This performs a full replacement of + * the widget definition. + * + * @param experienceType The experience type for the widget. (required) + * @param uuid The UUID of the widget. (required) + * @param body Widget request body. (required) + * @return ApiResponse<WidgetResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updateWidgetWithHttpInfo( + WidgetExperienceType experienceType, UUID uuid, CreateOrUpdateWidgetRequest body) + throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'experienceType' is set + if (experienceType == null) { + throw new ApiException( + 400, "Missing the required parameter 'experienceType' when calling updateWidget"); + } + + // verify the required parameter 'uuid' is set + if (uuid == null) { + throw new ApiException( + 400, "Missing the required parameter 'uuid' when calling updateWidget"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateWidget"); + } + // create path and map variables + String localVarPath = + "/api/v2/widgets/{experience_type}/{uuid}" + .replaceAll( + "\\{" + "experience_type" + "\\}", + apiClient.escapeString(experienceType.toString())) + .replaceAll("\\{" + "uuid" + "\\}", apiClient.escapeString(uuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.WidgetsApi.updateWidget", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update a widget. + * + *

See {@link #updateWidgetWithHttpInfo}. + * + * @param experienceType The experience type for the widget. (required) + * @param uuid The UUID of the widget. (required) + * @param body Widget request body. (required) + * @return CompletableFuture<ApiResponse<WidgetResponse>> + */ + public CompletableFuture> updateWidgetWithHttpInfoAsync( + WidgetExperienceType experienceType, UUID uuid, CreateOrUpdateWidgetRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'experienceType' is set + if (experienceType == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'experienceType' when calling updateWidget")); + return result; + } + + // verify the required parameter 'uuid' is set + if (uuid == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(400, "Missing the required parameter 'uuid' when calling updateWidget")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(400, "Missing the required parameter 'body' when calling updateWidget")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/widgets/{experience_type}/{uuid}" + .replaceAll( + "\\{" + "experience_type" + "\\}", + apiClient.escapeString(experienceType.toString())) + .replaceAll("\\{" + "uuid" + "\\}", apiClient.escapeString(uuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.WidgetsApi.updateWidget", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CampaignResponse.java b/src/main/java/com/datadog/api/client/v2/model/CampaignResponse.java new file mode 100644 index 00000000000..d83a7f42252 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CampaignResponse.java @@ -0,0 +1,145 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response containing campaign data. */ +@JsonPropertyOrder({CampaignResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CampaignResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CampaignResponseData data; + + public CampaignResponse() {} + + @JsonCreator + public CampaignResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) CampaignResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CampaignResponse data(CampaignResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Campaign data. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CampaignResponseData getData() { + return data; + } + + public void setData(CampaignResponseData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CampaignResponse + */ + @JsonAnySetter + public CampaignResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CampaignResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CampaignResponse campaignResponse = (CampaignResponse) o; + return Objects.equals(this.data, campaignResponse.data) + && Objects.equals(this.additionalProperties, campaignResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CampaignResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CampaignResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CampaignResponseAttributes.java new file mode 100644 index 00000000000..61569f033ef --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CampaignResponseAttributes.java @@ -0,0 +1,435 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Campaign attributes. */ +@JsonPropertyOrder({ + CampaignResponseAttributes.JSON_PROPERTY_CREATED_AT, + CampaignResponseAttributes.JSON_PROPERTY_DESCRIPTION, + CampaignResponseAttributes.JSON_PROPERTY_DUE_DATE, + CampaignResponseAttributes.JSON_PROPERTY_ENTITY_SCOPE, + CampaignResponseAttributes.JSON_PROPERTY_GUIDANCE, + CampaignResponseAttributes.JSON_PROPERTY_KEY, + CampaignResponseAttributes.JSON_PROPERTY_MODIFIED_AT, + CampaignResponseAttributes.JSON_PROPERTY_NAME, + CampaignResponseAttributes.JSON_PROPERTY_OWNER, + CampaignResponseAttributes.JSON_PROPERTY_START_DATE, + CampaignResponseAttributes.JSON_PROPERTY_STATUS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CampaignResponseAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_DUE_DATE = "due_date"; + private OffsetDateTime dueDate; + + public static final String JSON_PROPERTY_ENTITY_SCOPE = "entity_scope"; + private String entityScope; + + public static final String JSON_PROPERTY_GUIDANCE = "guidance"; + private String guidance; + + public static final String JSON_PROPERTY_KEY = "key"; + private String key; + + public static final String JSON_PROPERTY_MODIFIED_AT = "modified_at"; + private OffsetDateTime modifiedAt; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_OWNER = "owner"; + private String owner; + + public static final String JSON_PROPERTY_START_DATE = "start_date"; + private OffsetDateTime startDate; + + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; + + public CampaignResponseAttributes() {} + + @JsonCreator + public CampaignResponseAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_KEY) String key, + @JsonProperty(required = true, value = JSON_PROPERTY_MODIFIED_AT) OffsetDateTime modifiedAt, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_OWNER) String owner, + @JsonProperty(required = true, value = JSON_PROPERTY_START_DATE) OffsetDateTime startDate, + @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) String status) { + this.createdAt = createdAt; + this.key = key; + this.modifiedAt = modifiedAt; + this.name = name; + this.owner = owner; + this.startDate = startDate; + this.status = status; + } + + public CampaignResponseAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation time of the campaign. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public CampaignResponseAttributes description(String description) { + this.description = description; + return this; + } + + /** + * The description of the campaign. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CampaignResponseAttributes dueDate(OffsetDateTime dueDate) { + this.dueDate = dueDate; + return this; + } + + /** + * The due date of the campaign. + * + * @return dueDate + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DUE_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getDueDate() { + return dueDate; + } + + public void setDueDate(OffsetDateTime dueDate) { + this.dueDate = dueDate; + } + + public CampaignResponseAttributes entityScope(String entityScope) { + this.entityScope = entityScope; + return this; + } + + /** + * Entity scope query to filter entities for this campaign. + * + * @return entityScope + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENTITY_SCOPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEntityScope() { + return entityScope; + } + + public void setEntityScope(String entityScope) { + this.entityScope = entityScope; + } + + public CampaignResponseAttributes guidance(String guidance) { + this.guidance = guidance; + return this; + } + + /** + * Guidance for the campaign. + * + * @return guidance + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_GUIDANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getGuidance() { + return guidance; + } + + public void setGuidance(String guidance) { + this.guidance = guidance; + } + + public CampaignResponseAttributes key(String key) { + this.key = key; + return this; + } + + /** + * The unique key for the campaign. + * + * @return key + */ + @JsonProperty(JSON_PROPERTY_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public CampaignResponseAttributes modifiedAt(OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + return this; + } + + /** + * Time of last campaign modification. + * + * @return modifiedAt + */ + @JsonProperty(JSON_PROPERTY_MODIFIED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + } + + public CampaignResponseAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The name of the campaign. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CampaignResponseAttributes owner(String owner) { + this.owner = owner; + return this; + } + + /** + * The UUID of the campaign owner. + * + * @return owner + */ + @JsonProperty(JSON_PROPERTY_OWNER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public CampaignResponseAttributes startDate(OffsetDateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * The start date of the campaign. + * + * @return startDate + */ + @JsonProperty(JSON_PROPERTY_START_DATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getStartDate() { + return startDate; + } + + public void setStartDate(OffsetDateTime startDate) { + this.startDate = startDate; + } + + public CampaignResponseAttributes status(String status) { + this.status = status; + return this; + } + + /** + * The status of the campaign. + * + * @return status + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CampaignResponseAttributes + */ + @JsonAnySetter + public CampaignResponseAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CampaignResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CampaignResponseAttributes campaignResponseAttributes = (CampaignResponseAttributes) o; + return Objects.equals(this.createdAt, campaignResponseAttributes.createdAt) + && Objects.equals(this.description, campaignResponseAttributes.description) + && Objects.equals(this.dueDate, campaignResponseAttributes.dueDate) + && Objects.equals(this.entityScope, campaignResponseAttributes.entityScope) + && Objects.equals(this.guidance, campaignResponseAttributes.guidance) + && Objects.equals(this.key, campaignResponseAttributes.key) + && Objects.equals(this.modifiedAt, campaignResponseAttributes.modifiedAt) + && Objects.equals(this.name, campaignResponseAttributes.name) + && Objects.equals(this.owner, campaignResponseAttributes.owner) + && Objects.equals(this.startDate, campaignResponseAttributes.startDate) + && Objects.equals(this.status, campaignResponseAttributes.status) + && Objects.equals( + this.additionalProperties, campaignResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + description, + dueDate, + entityScope, + guidance, + key, + modifiedAt, + name, + owner, + startDate, + status, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CampaignResponseAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" dueDate: ").append(toIndentedString(dueDate)).append("\n"); + sb.append(" entityScope: ").append(toIndentedString(entityScope)).append("\n"); + sb.append(" guidance: ").append(toIndentedString(guidance)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CampaignResponseData.java b/src/main/java/com/datadog/api/client/v2/model/CampaignResponseData.java new file mode 100644 index 00000000000..c2bb7b8f27a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CampaignResponseData.java @@ -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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Campaign data. */ +@JsonPropertyOrder({ + CampaignResponseData.JSON_PROPERTY_ATTRIBUTES, + CampaignResponseData.JSON_PROPERTY_ID, + CampaignResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CampaignResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CampaignResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CampaignType type; + + public CampaignResponseData() {} + + @JsonCreator + public CampaignResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CampaignResponseAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CampaignType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CampaignResponseData attributes(CampaignResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Campaign attributes. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CampaignResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CampaignResponseAttributes attributes) { + this.attributes = attributes; + } + + public CampaignResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The unique ID of the campaign. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public CampaignResponseData type(CampaignType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The JSON:API type for campaigns. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CampaignType getType() { + return type; + } + + public void setType(CampaignType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CampaignResponseData + */ + @JsonAnySetter + public CampaignResponseData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CampaignResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CampaignResponseData campaignResponseData = (CampaignResponseData) o; + return Objects.equals(this.attributes, campaignResponseData.attributes) + && Objects.equals(this.id, campaignResponseData.id) + && Objects.equals(this.type, campaignResponseData.type) + && Objects.equals(this.additionalProperties, campaignResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CampaignResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CampaignStatus.java b/src/main/java/com/datadog/api/client/v2/model/CampaignStatus.java new file mode 100644 index 00000000000..ada94335c5a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CampaignStatus.java @@ -0,0 +1,56 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The status of the campaign. */ +@JsonSerialize(using = CampaignStatus.CampaignStatusSerializer.class) +public class CampaignStatus extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("in_progress", "not_started", "completed")); + + public static final CampaignStatus IN_PROGRESS = new CampaignStatus("in_progress"); + public static final CampaignStatus NOT_STARTED = new CampaignStatus("not_started"); + public static final CampaignStatus COMPLETED = new CampaignStatus("completed"); + + CampaignStatus(String value) { + super(value, allowedValues); + } + + public static class CampaignStatusSerializer extends StdSerializer { + public CampaignStatusSerializer(Class t) { + super(t); + } + + public CampaignStatusSerializer() { + this(null); + } + + @Override + public void serialize(CampaignStatus value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CampaignStatus fromValue(String value) { + return new CampaignStatus(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CampaignType.java b/src/main/java/com/datadog/api/client/v2/model/CampaignType.java new file mode 100644 index 00000000000..49b9e4ba2cf --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CampaignType.java @@ -0,0 +1,53 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The JSON:API type for campaigns. */ +@JsonSerialize(using = CampaignType.CampaignTypeSerializer.class) +public class CampaignType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("campaign")); + + public static final CampaignType CAMPAIGN = new CampaignType("campaign"); + + CampaignType(String value) { + super(value, allowedValues); + } + + public static class CampaignTypeSerializer extends StdSerializer { + public CampaignTypeSerializer(Class t) { + super(t); + } + + public CampaignTypeSerializer() { + this(null); + } + + @Override + public void serialize(CampaignType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static CampaignType fromValue(String value) { + return new CampaignType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateCampaignRequest.java b/src/main/java/com/datadog/api/client/v2/model/CreateCampaignRequest.java new file mode 100644 index 00000000000..a0aa71b2548 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateCampaignRequest.java @@ -0,0 +1,145 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request to create a new campaign. */ +@JsonPropertyOrder({CreateCampaignRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateCampaignRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CreateCampaignRequestData data; + + public CreateCampaignRequest() {} + + @JsonCreator + public CreateCampaignRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) CreateCampaignRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CreateCampaignRequest data(CreateCampaignRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for creating a new campaign. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreateCampaignRequestData getData() { + return data; + } + + public void setData(CreateCampaignRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreateCampaignRequest + */ + @JsonAnySetter + public CreateCampaignRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreateCampaignRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCampaignRequest createCampaignRequest = (CreateCampaignRequest) o; + return Objects.equals(this.data, createCampaignRequest.data) + && Objects.equals(this.additionalProperties, createCampaignRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCampaignRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateCampaignRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CreateCampaignRequestAttributes.java new file mode 100644 index 00000000000..83b51b2684d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateCampaignRequestAttributes.java @@ -0,0 +1,417 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes for creating a new campaign. */ +@JsonPropertyOrder({ + CreateCampaignRequestAttributes.JSON_PROPERTY_DESCRIPTION, + CreateCampaignRequestAttributes.JSON_PROPERTY_DUE_DATE, + CreateCampaignRequestAttributes.JSON_PROPERTY_ENTITY_SCOPE, + CreateCampaignRequestAttributes.JSON_PROPERTY_GUIDANCE, + CreateCampaignRequestAttributes.JSON_PROPERTY_KEY, + CreateCampaignRequestAttributes.JSON_PROPERTY_NAME, + CreateCampaignRequestAttributes.JSON_PROPERTY_OWNER_ID, + CreateCampaignRequestAttributes.JSON_PROPERTY_RULE_IDS, + CreateCampaignRequestAttributes.JSON_PROPERTY_START_DATE, + CreateCampaignRequestAttributes.JSON_PROPERTY_STATUS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateCampaignRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_DUE_DATE = "due_date"; + private OffsetDateTime dueDate; + + public static final String JSON_PROPERTY_ENTITY_SCOPE = "entity_scope"; + private String entityScope; + + public static final String JSON_PROPERTY_GUIDANCE = "guidance"; + private String guidance; + + public static final String JSON_PROPERTY_KEY = "key"; + private String key; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_OWNER_ID = "owner_id"; + private String ownerId; + + public static final String JSON_PROPERTY_RULE_IDS = "rule_ids"; + private List ruleIds = new ArrayList<>(); + + public static final String JSON_PROPERTY_START_DATE = "start_date"; + private OffsetDateTime startDate; + + public static final String JSON_PROPERTY_STATUS = "status"; + private CampaignStatus status; + + public CreateCampaignRequestAttributes() {} + + @JsonCreator + public CreateCampaignRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_KEY) String key, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_OWNER_ID) String ownerId, + @JsonProperty(required = true, value = JSON_PROPERTY_RULE_IDS) List ruleIds, + @JsonProperty(required = true, value = JSON_PROPERTY_START_DATE) OffsetDateTime startDate) { + this.key = key; + this.name = name; + this.ownerId = ownerId; + this.ruleIds = ruleIds; + this.startDate = startDate; + } + + public CreateCampaignRequestAttributes description(String description) { + this.description = description; + return this; + } + + /** + * The description of the campaign. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public CreateCampaignRequestAttributes dueDate(OffsetDateTime dueDate) { + this.dueDate = dueDate; + return this; + } + + /** + * The due date of the campaign. + * + * @return dueDate + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DUE_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getDueDate() { + return dueDate; + } + + public void setDueDate(OffsetDateTime dueDate) { + this.dueDate = dueDate; + } + + public CreateCampaignRequestAttributes entityScope(String entityScope) { + this.entityScope = entityScope; + return this; + } + + /** + * Entity scope query to filter entities for this campaign. + * + * @return entityScope + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENTITY_SCOPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEntityScope() { + return entityScope; + } + + public void setEntityScope(String entityScope) { + this.entityScope = entityScope; + } + + public CreateCampaignRequestAttributes guidance(String guidance) { + this.guidance = guidance; + return this; + } + + /** + * Guidance for the campaign. + * + * @return guidance + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_GUIDANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getGuidance() { + return guidance; + } + + public void setGuidance(String guidance) { + this.guidance = guidance; + } + + public CreateCampaignRequestAttributes key(String key) { + this.key = key; + return this; + } + + /** + * The unique key for the campaign. + * + * @return key + */ + @JsonProperty(JSON_PROPERTY_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public CreateCampaignRequestAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The name of the campaign. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public CreateCampaignRequestAttributes ownerId(String ownerId) { + this.ownerId = ownerId; + return this; + } + + /** + * The UUID of the campaign owner. + * + * @return ownerId + */ + @JsonProperty(JSON_PROPERTY_OWNER_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getOwnerId() { + return ownerId; + } + + public void setOwnerId(String ownerId) { + this.ownerId = ownerId; + } + + public CreateCampaignRequestAttributes ruleIds(List ruleIds) { + this.ruleIds = ruleIds; + return this; + } + + public CreateCampaignRequestAttributes addRuleIdsItem(String ruleIdsItem) { + this.ruleIds.add(ruleIdsItem); + return this; + } + + /** + * Array of rule IDs associated with this campaign. + * + * @return ruleIds + */ + @JsonProperty(JSON_PROPERTY_RULE_IDS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRuleIds() { + return ruleIds; + } + + public void setRuleIds(List ruleIds) { + this.ruleIds = ruleIds; + } + + public CreateCampaignRequestAttributes startDate(OffsetDateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * The start date of the campaign. + * + * @return startDate + */ + @JsonProperty(JSON_PROPERTY_START_DATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getStartDate() { + return startDate; + } + + public void setStartDate(OffsetDateTime startDate) { + this.startDate = startDate; + } + + public CreateCampaignRequestAttributes status(CampaignStatus status) { + this.status = status; + this.unparsed |= !status.isValid(); + return this; + } + + /** + * The status of the campaign. + * + * @return status + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public CampaignStatus getStatus() { + return status; + } + + public void setStatus(CampaignStatus status) { + if (!status.isValid()) { + this.unparsed = true; + } + this.status = status; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreateCampaignRequestAttributes + */ + @JsonAnySetter + public CreateCampaignRequestAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreateCampaignRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCampaignRequestAttributes createCampaignRequestAttributes = + (CreateCampaignRequestAttributes) o; + return Objects.equals(this.description, createCampaignRequestAttributes.description) + && Objects.equals(this.dueDate, createCampaignRequestAttributes.dueDate) + && Objects.equals(this.entityScope, createCampaignRequestAttributes.entityScope) + && Objects.equals(this.guidance, createCampaignRequestAttributes.guidance) + && Objects.equals(this.key, createCampaignRequestAttributes.key) + && Objects.equals(this.name, createCampaignRequestAttributes.name) + && Objects.equals(this.ownerId, createCampaignRequestAttributes.ownerId) + && Objects.equals(this.ruleIds, createCampaignRequestAttributes.ruleIds) + && Objects.equals(this.startDate, createCampaignRequestAttributes.startDate) + && Objects.equals(this.status, createCampaignRequestAttributes.status) + && Objects.equals( + this.additionalProperties, createCampaignRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + description, + dueDate, + entityScope, + guidance, + key, + name, + ownerId, + ruleIds, + startDate, + status, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCampaignRequestAttributes {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" dueDate: ").append(toIndentedString(dueDate)).append("\n"); + sb.append(" entityScope: ").append(toIndentedString(entityScope)).append("\n"); + sb.append(" guidance: ").append(toIndentedString(guidance)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" ownerId: ").append(toIndentedString(ownerId)).append("\n"); + sb.append(" ruleIds: ").append(toIndentedString(ruleIds)).append("\n"); + sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateCampaignRequestData.java b/src/main/java/com/datadog/api/client/v2/model/CreateCampaignRequestData.java new file mode 100644 index 00000000000..08de24f1958 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateCampaignRequestData.java @@ -0,0 +1,182 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data for creating a new campaign. */ +@JsonPropertyOrder({ + CreateCampaignRequestData.JSON_PROPERTY_ATTRIBUTES, + CreateCampaignRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateCampaignRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CreateCampaignRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CampaignType type; + + public CreateCampaignRequestData() {} + + @JsonCreator + public CreateCampaignRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CreateCampaignRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CampaignType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public CreateCampaignRequestData attributes(CreateCampaignRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for creating a new campaign. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreateCampaignRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CreateCampaignRequestAttributes attributes) { + this.attributes = attributes; + } + + public CreateCampaignRequestData type(CampaignType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The JSON:API type for campaigns. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CampaignType getType() { + return type; + } + + public void setType(CampaignType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreateCampaignRequestData + */ + @JsonAnySetter + public CreateCampaignRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreateCampaignRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCampaignRequestData createCampaignRequestData = (CreateCampaignRequestData) o; + return Objects.equals(this.attributes, createCampaignRequestData.attributes) + && Objects.equals(this.type, createCampaignRequestData.type) + && Objects.equals( + this.additionalProperties, createCampaignRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCampaignRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateOrUpdateWidgetRequest.java b/src/main/java/com/datadog/api/client/v2/model/CreateOrUpdateWidgetRequest.java new file mode 100644 index 00000000000..1f1601d3a4b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateOrUpdateWidgetRequest.java @@ -0,0 +1,147 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request body for creating or updating a widget. */ +@JsonPropertyOrder({CreateOrUpdateWidgetRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateOrUpdateWidgetRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private CreateOrUpdateWidgetRequestData data; + + public CreateOrUpdateWidgetRequest() {} + + @JsonCreator + public CreateOrUpdateWidgetRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + CreateOrUpdateWidgetRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CreateOrUpdateWidgetRequest data(CreateOrUpdateWidgetRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for creating or updating a widget. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreateOrUpdateWidgetRequestData getData() { + return data; + } + + public void setData(CreateOrUpdateWidgetRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreateOrUpdateWidgetRequest + */ + @JsonAnySetter + public CreateOrUpdateWidgetRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreateOrUpdateWidgetRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateOrUpdateWidgetRequest createOrUpdateWidgetRequest = (CreateOrUpdateWidgetRequest) o; + return Objects.equals(this.data, createOrUpdateWidgetRequest.data) + && Objects.equals( + this.additionalProperties, createOrUpdateWidgetRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateOrUpdateWidgetRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateOrUpdateWidgetRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/CreateOrUpdateWidgetRequestAttributes.java new file mode 100644 index 00000000000..3b8616026be --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateOrUpdateWidgetRequestAttributes.java @@ -0,0 +1,202 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Attributes for creating or updating a widget. */ +@JsonPropertyOrder({ + CreateOrUpdateWidgetRequestAttributes.JSON_PROPERTY_DEFINITION, + CreateOrUpdateWidgetRequestAttributes.JSON_PROPERTY_TAGS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateOrUpdateWidgetRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DEFINITION = "definition"; + private WidgetDefinition definition; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private JsonNullable> tags = JsonNullable.>undefined(); + + public CreateOrUpdateWidgetRequestAttributes() {} + + @JsonCreator + public CreateOrUpdateWidgetRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_DEFINITION) + WidgetDefinition definition) { + this.definition = definition; + this.unparsed |= definition.unparsed; + } + + public CreateOrUpdateWidgetRequestAttributes definition(WidgetDefinition definition) { + this.definition = definition; + this.unparsed |= definition.unparsed; + return this; + } + + /** + * The definition of a widget, including its type and configuration. + * + * @return definition + */ + @JsonProperty(JSON_PROPERTY_DEFINITION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WidgetDefinition getDefinition() { + return definition; + } + + public void setDefinition(WidgetDefinition definition) { + this.definition = definition; + } + + public CreateOrUpdateWidgetRequestAttributes tags(List tags) { + this.tags = JsonNullable.>of(tags); + return this; + } + + public CreateOrUpdateWidgetRequestAttributes addTagsItem(String tagsItem) { + if (this.tags == null || !this.tags.isPresent()) { + this.tags = JsonNullable.>of(new ArrayList<>()); + } + try { + this.tags.get().add(tagsItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * User-defined tags for organizing the widget. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonIgnore + public List getTags() { + return tags.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable> getTags_JsonNullable() { + return tags; + } + + @JsonProperty(JSON_PROPERTY_TAGS) + public void setTags_JsonNullable(JsonNullable> tags) { + this.tags = tags; + } + + public void setTags(List tags) { + this.tags = JsonNullable.>of(tags); + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreateOrUpdateWidgetRequestAttributes + */ + @JsonAnySetter + public CreateOrUpdateWidgetRequestAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreateOrUpdateWidgetRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateOrUpdateWidgetRequestAttributes createOrUpdateWidgetRequestAttributes = + (CreateOrUpdateWidgetRequestAttributes) o; + return Objects.equals(this.definition, createOrUpdateWidgetRequestAttributes.definition) + && Objects.equals(this.tags, createOrUpdateWidgetRequestAttributes.tags) + && Objects.equals( + this.additionalProperties, createOrUpdateWidgetRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(definition, tags, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateOrUpdateWidgetRequestAttributes {\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateOrUpdateWidgetRequestData.java b/src/main/java/com/datadog/api/client/v2/model/CreateOrUpdateWidgetRequestData.java new file mode 100644 index 00000000000..85604bace65 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateOrUpdateWidgetRequestData.java @@ -0,0 +1,179 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data for creating or updating a widget. */ +@JsonPropertyOrder({ + CreateOrUpdateWidgetRequestData.JSON_PROPERTY_ATTRIBUTES, + CreateOrUpdateWidgetRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateOrUpdateWidgetRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private CreateOrUpdateWidgetRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public CreateOrUpdateWidgetRequestData() {} + + @JsonCreator + public CreateOrUpdateWidgetRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + CreateOrUpdateWidgetRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + } + + public CreateOrUpdateWidgetRequestData attributes( + CreateOrUpdateWidgetRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for creating or updating a widget. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CreateOrUpdateWidgetRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(CreateOrUpdateWidgetRequestAttributes attributes) { + this.attributes = attributes; + } + + public CreateOrUpdateWidgetRequestData type(String type) { + this.type = type; + return this; + } + + /** + * Widgets resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreateOrUpdateWidgetRequestData + */ + @JsonAnySetter + public CreateOrUpdateWidgetRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreateOrUpdateWidgetRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateOrUpdateWidgetRequestData createOrUpdateWidgetRequestData = + (CreateOrUpdateWidgetRequestData) o; + return Objects.equals(this.attributes, createOrUpdateWidgetRequestData.attributes) + && Objects.equals(this.type, createOrUpdateWidgetRequestData.type) + && Objects.equals( + this.additionalProperties, createOrUpdateWidgetRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateOrUpdateWidgetRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateRuleRequestData.java b/src/main/java/com/datadog/api/client/v2/model/CreateRuleRequestData.java index d5fbe137f47..50a115fde92 100644 --- a/src/main/java/com/datadog/api/client/v2/model/CreateRuleRequestData.java +++ b/src/main/java/com/datadog/api/client/v2/model/CreateRuleRequestData.java @@ -26,30 +26,31 @@ public class CreateRuleRequestData { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; - private RuleAttributes attributes; + private RuleAttributesRequest attributes; public static final String JSON_PROPERTY_TYPE = "type"; private RuleType type = RuleType.RULE; - public CreateRuleRequestData attributes(RuleAttributes attributes) { + public CreateRuleRequestData attributes(RuleAttributesRequest attributes) { this.attributes = attributes; this.unparsed |= attributes.unparsed; return this; } /** - * Details of a rule. + * Attributes for creating or updating a rule. Server-managed fields (created_at, modified_at, + * custom) are excluded. * * @return attributes */ @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ATTRIBUTES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public RuleAttributes getAttributes() { + public RuleAttributesRequest getAttributes() { return attributes; } - public void setAttributes(RuleAttributes attributes) { + public void setAttributes(RuleAttributesRequest attributes) { this.attributes = attributes; } diff --git a/src/main/java/com/datadog/api/client/v2/model/ListCampaignsResponse.java b/src/main/java/com/datadog/api/client/v2/model/ListCampaignsResponse.java new file mode 100644 index 00000000000..c3993665950 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ListCampaignsResponse.java @@ -0,0 +1,186 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response containing a list of campaigns. */ +@JsonPropertyOrder({ + ListCampaignsResponse.JSON_PROPERTY_DATA, + ListCampaignsResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ListCampaignsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public static final String JSON_PROPERTY_META = "meta"; + private PaginatedResponseMeta meta; + + public ListCampaignsResponse() {} + + @JsonCreator + public ListCampaignsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data, + @JsonProperty(required = true, value = JSON_PROPERTY_META) PaginatedResponseMeta meta) { + this.data = data; + this.meta = meta; + this.unparsed |= meta.unparsed; + } + + public ListCampaignsResponse data(List data) { + this.data = data; + for (CampaignResponseData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ListCampaignsResponse addDataItem(CampaignResponseData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Array of campaigns. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public ListCampaignsResponse meta(PaginatedResponseMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Metadata for scores response. + * + * @return meta + */ + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public PaginatedResponseMeta getMeta() { + return meta; + } + + public void setMeta(PaginatedResponseMeta meta) { + this.meta = meta; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ListCampaignsResponse + */ + @JsonAnySetter + public ListCampaignsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ListCampaignsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListCampaignsResponse listCampaignsResponse = (ListCampaignsResponse) o; + return Objects.equals(this.data, listCampaignsResponse.data) + && Objects.equals(this.meta, listCampaignsResponse.meta) + && Objects.equals(this.additionalProperties, listCampaignsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListCampaignsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ListScorecardsResponse.java b/src/main/java/com/datadog/api/client/v2/model/ListScorecardsResponse.java new file mode 100644 index 00000000000..0c347578822 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ListScorecardsResponse.java @@ -0,0 +1,155 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response containing a list of scorecards. */ +@JsonPropertyOrder({ListScorecardsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ListScorecardsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public ListScorecardsResponse() {} + + @JsonCreator + public ListScorecardsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + } + + public ListScorecardsResponse data(List data) { + this.data = data; + for (ScorecardListResponseData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ListScorecardsResponse addDataItem(ScorecardListResponseData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Array of scorecards. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ListScorecardsResponse + */ + @JsonAnySetter + public ListScorecardsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ListScorecardsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListScorecardsResponse listScorecardsResponse = (ListScorecardsResponse) o; + return Objects.equals(this.data, listScorecardsResponse.data) + && Objects.equals(this.additionalProperties, listScorecardsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListScorecardsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/PaginatedResponseMeta.java b/src/main/java/com/datadog/api/client/v2/model/PaginatedResponseMeta.java new file mode 100644 index 00000000000..e1523c95961 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PaginatedResponseMeta.java @@ -0,0 +1,229 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Metadata for scores response. */ +@JsonPropertyOrder({ + PaginatedResponseMeta.JSON_PROPERTY_COUNT, + PaginatedResponseMeta.JSON_PROPERTY_LIMIT, + PaginatedResponseMeta.JSON_PROPERTY_OFFSET, + PaginatedResponseMeta.JSON_PROPERTY_TOTAL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PaginatedResponseMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_COUNT = "count"; + private Long count; + + public static final String JSON_PROPERTY_LIMIT = "limit"; + private Long limit; + + public static final String JSON_PROPERTY_OFFSET = "offset"; + private Long offset; + + public static final String JSON_PROPERTY_TOTAL = "total"; + private Long total; + + public PaginatedResponseMeta() {} + + @JsonCreator + public PaginatedResponseMeta( + @JsonProperty(required = true, value = JSON_PROPERTY_COUNT) Long count, + @JsonProperty(required = true, value = JSON_PROPERTY_LIMIT) Long limit, + @JsonProperty(required = true, value = JSON_PROPERTY_OFFSET) Long offset, + @JsonProperty(required = true, value = JSON_PROPERTY_TOTAL) Long total) { + this.count = count; + this.limit = limit; + this.offset = offset; + this.total = total; + } + + public PaginatedResponseMeta count(Long count) { + this.count = count; + return this; + } + + /** + * Number of entities in this response. + * + * @return count + */ + @JsonProperty(JSON_PROPERTY_COUNT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getCount() { + return count; + } + + public void setCount(Long count) { + this.count = count; + } + + public PaginatedResponseMeta limit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Pagination limit. + * + * @return limit + */ + @JsonProperty(JSON_PROPERTY_LIMIT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getLimit() { + return limit; + } + + public void setLimit(Long limit) { + this.limit = limit; + } + + public PaginatedResponseMeta offset(Long offset) { + this.offset = offset; + return this; + } + + /** + * Pagination offset. + * + * @return offset + */ + @JsonProperty(JSON_PROPERTY_OFFSET) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getOffset() { + return offset; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public PaginatedResponseMeta total(Long total) { + this.total = total; + return this; + } + + /** + * Total number of entities available. + * + * @return total + */ + @JsonProperty(JSON_PROPERTY_TOTAL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return PaginatedResponseMeta + */ + @JsonAnySetter + public PaginatedResponseMeta putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this PaginatedResponseMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PaginatedResponseMeta paginatedResponseMeta = (PaginatedResponseMeta) o; + return Objects.equals(this.count, paginatedResponseMeta.count) + && Objects.equals(this.limit, paginatedResponseMeta.limit) + && Objects.equals(this.offset, paginatedResponseMeta.offset) + && Objects.equals(this.total, paginatedResponseMeta.total) + && Objects.equals(this.additionalProperties, paginatedResponseMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(count, limit, offset, total, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PaginatedResponseMeta {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RuleAttributes.java b/src/main/java/com/datadog/api/client/v2/model/RuleAttributes.java index 1aba8337175..6501fe9b2f7 100644 --- a/src/main/java/com/datadog/api/client/v2/model/RuleAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/RuleAttributes.java @@ -28,6 +28,7 @@ RuleAttributes.JSON_PROPERTY_MODIFIED_AT, RuleAttributes.JSON_PROPERTY_NAME, RuleAttributes.JSON_PROPERTY_OWNER, + RuleAttributes.JSON_PROPERTY_SCOPE_QUERY, RuleAttributes.JSON_PROPERTY_SCORECARD_NAME }) @jakarta.annotation.Generated( @@ -61,6 +62,9 @@ public class RuleAttributes { public static final String JSON_PROPERTY_OWNER = "owner"; private String owner; + public static final String JSON_PROPERTY_SCOPE_QUERY = "scope_query"; + private String scopeQuery; + public static final String JSON_PROPERTY_SCORECARD_NAME = "scorecard_name"; private String scorecardName; @@ -256,6 +260,27 @@ public void setOwner(String owner) { this.owner = owner; } + public RuleAttributes scopeQuery(String scopeQuery) { + this.scopeQuery = scopeQuery; + return this; + } + + /** + * A query to filter which entities this rule applies to. + * + * @return scopeQuery + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCOPE_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getScopeQuery() { + return scopeQuery; + } + + public void setScopeQuery(String scopeQuery) { + this.scopeQuery = scopeQuery; + } + public RuleAttributes scorecardName(String scorecardName) { this.scorecardName = scorecardName; return this; @@ -342,6 +367,7 @@ public boolean equals(Object o) { && Objects.equals(this.modifiedAt, ruleAttributes.modifiedAt) && Objects.equals(this.name, ruleAttributes.name) && Objects.equals(this.owner, ruleAttributes.owner) + && Objects.equals(this.scopeQuery, ruleAttributes.scopeQuery) && Objects.equals(this.scorecardName, ruleAttributes.scorecardName) && Objects.equals(this.additionalProperties, ruleAttributes.additionalProperties); } @@ -358,6 +384,7 @@ public int hashCode() { modifiedAt, name, owner, + scopeQuery, scorecardName, additionalProperties); } @@ -375,6 +402,7 @@ public String toString() { sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append(" scopeQuery: ").append(toIndentedString(scopeQuery)).append("\n"); sb.append(" scorecardName: ").append(toIndentedString(scorecardName)).append("\n"); sb.append(" additionalProperties: ") .append(toIndentedString(additionalProperties)) diff --git a/src/main/java/com/datadog/api/client/v2/model/RuleAttributesRequest.java b/src/main/java/com/datadog/api/client/v2/model/RuleAttributesRequest.java new file mode 100644 index 00000000000..b34ab581f33 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RuleAttributesRequest.java @@ -0,0 +1,303 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * Attributes for creating or updating a rule. Server-managed fields (created_at, modified_at, + * custom) are excluded. + */ +@JsonPropertyOrder({ + RuleAttributesRequest.JSON_PROPERTY_DESCRIPTION, + RuleAttributesRequest.JSON_PROPERTY_ENABLED, + RuleAttributesRequest.JSON_PROPERTY_LEVEL, + RuleAttributesRequest.JSON_PROPERTY_NAME, + RuleAttributesRequest.JSON_PROPERTY_OWNER, + RuleAttributesRequest.JSON_PROPERTY_SCOPE_QUERY, + RuleAttributesRequest.JSON_PROPERTY_SCORECARD_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RuleAttributesRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public static final String JSON_PROPERTY_LEVEL = "level"; + private Integer level; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_OWNER = "owner"; + private String owner; + + public static final String JSON_PROPERTY_SCOPE_QUERY = "scope_query"; + private String scopeQuery; + + public static final String JSON_PROPERTY_SCORECARD_NAME = "scorecard_name"; + private String scorecardName; + + public RuleAttributesRequest description(String description) { + this.description = description; + return this; + } + + /** + * Explanation of the rule. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public RuleAttributesRequest enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * If enabled, the rule is calculated as part of the score. + * + * @return enabled + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public RuleAttributesRequest level(Integer level) { + this.level = level; + return this; + } + + /** + * The maturity level of the rule (1, 2, or 3). minimum: 1 maximum: 3 + * + * @return level + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LEVEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getLevel() { + return level; + } + + public void setLevel(Integer level) { + this.level = level; + } + + public RuleAttributesRequest name(String name) { + this.name = name; + return this; + } + + /** + * Name of the rule. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public RuleAttributesRequest owner(String owner) { + this.owner = owner; + return this; + } + + /** + * Owner of the rule. + * + * @return owner + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OWNER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public RuleAttributesRequest scopeQuery(String scopeQuery) { + this.scopeQuery = scopeQuery; + return this; + } + + /** + * A query to filter which entities this rule applies to. + * + * @return scopeQuery + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCOPE_QUERY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getScopeQuery() { + return scopeQuery; + } + + public void setScopeQuery(String scopeQuery) { + this.scopeQuery = scopeQuery; + } + + public RuleAttributesRequest scorecardName(String scorecardName) { + this.scorecardName = scorecardName; + return this; + } + + /** + * The scorecard name to which this rule must belong. + * + * @return scorecardName + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SCORECARD_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getScorecardName() { + return scorecardName; + } + + public void setScorecardName(String scorecardName) { + this.scorecardName = scorecardName; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RuleAttributesRequest + */ + @JsonAnySetter + public RuleAttributesRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RuleAttributesRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RuleAttributesRequest ruleAttributesRequest = (RuleAttributesRequest) o; + return Objects.equals(this.description, ruleAttributesRequest.description) + && Objects.equals(this.enabled, ruleAttributesRequest.enabled) + && Objects.equals(this.level, ruleAttributesRequest.level) + && Objects.equals(this.name, ruleAttributesRequest.name) + && Objects.equals(this.owner, ruleAttributesRequest.owner) + && Objects.equals(this.scopeQuery, ruleAttributesRequest.scopeQuery) + && Objects.equals(this.scorecardName, ruleAttributesRequest.scorecardName) + && Objects.equals(this.additionalProperties, ruleAttributesRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + description, enabled, level, name, owner, scopeQuery, scorecardName, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RuleAttributesRequest {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" level: ").append(toIndentedString(level)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append(" scopeQuery: ").append(toIndentedString(scopeQuery)).append("\n"); + sb.append(" scorecardName: ").append(toIndentedString(scorecardName)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ScorecardListResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/ScorecardListResponseAttributes.java new file mode 100644 index 00000000000..d2180ca542d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ScorecardListResponseAttributes.java @@ -0,0 +1,231 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Scorecard attributes. */ +@JsonPropertyOrder({ + ScorecardListResponseAttributes.JSON_PROPERTY_CREATED_AT, + ScorecardListResponseAttributes.JSON_PROPERTY_DESCRIPTION, + ScorecardListResponseAttributes.JSON_PROPERTY_MODIFIED_AT, + ScorecardListResponseAttributes.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ScorecardListResponseAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_MODIFIED_AT = "modified_at"; + private OffsetDateTime modifiedAt; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public ScorecardListResponseAttributes() {} + + @JsonCreator + public ScorecardListResponseAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_MODIFIED_AT) OffsetDateTime modifiedAt, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.createdAt = createdAt; + this.modifiedAt = modifiedAt; + this.name = name; + } + + public ScorecardListResponseAttributes createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation time of the scorecard. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public ScorecardListResponseAttributes description(String description) { + this.description = description; + return this; + } + + /** + * The description of the scorecard. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public ScorecardListResponseAttributes modifiedAt(OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + return this; + } + + /** + * Time of last scorecard modification. + * + * @return modifiedAt + */ + @JsonProperty(JSON_PROPERTY_MODIFIED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(OffsetDateTime modifiedAt) { + this.modifiedAt = modifiedAt; + } + + public ScorecardListResponseAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The name of the scorecard. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ScorecardListResponseAttributes + */ + @JsonAnySetter + public ScorecardListResponseAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ScorecardListResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ScorecardListResponseAttributes scorecardListResponseAttributes = + (ScorecardListResponseAttributes) o; + return Objects.equals(this.createdAt, scorecardListResponseAttributes.createdAt) + && Objects.equals(this.description, scorecardListResponseAttributes.description) + && Objects.equals(this.modifiedAt, scorecardListResponseAttributes.modifiedAt) + && Objects.equals(this.name, scorecardListResponseAttributes.name) + && Objects.equals( + this.additionalProperties, scorecardListResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, description, modifiedAt, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ScorecardListResponseAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ScorecardListResponseData.java b/src/main/java/com/datadog/api/client/v2/model/ScorecardListResponseData.java new file mode 100644 index 00000000000..1dd93902b2f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ScorecardListResponseData.java @@ -0,0 +1,210 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Scorecard data. */ +@JsonPropertyOrder({ + ScorecardListResponseData.JSON_PROPERTY_ATTRIBUTES, + ScorecardListResponseData.JSON_PROPERTY_ID, + ScorecardListResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ScorecardListResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private ScorecardListResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ScorecardListType type; + + public ScorecardListResponseData() {} + + @JsonCreator + public ScorecardListResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + ScorecardListResponseAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ScorecardListType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ScorecardListResponseData attributes(ScorecardListResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Scorecard attributes. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ScorecardListResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ScorecardListResponseAttributes attributes) { + this.attributes = attributes; + } + + public ScorecardListResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The unique ID of the scorecard. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ScorecardListResponseData type(ScorecardListType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The JSON:API type for scorecard list. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ScorecardListType getType() { + return type; + } + + public void setType(ScorecardListType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ScorecardListResponseData + */ + @JsonAnySetter + public ScorecardListResponseData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ScorecardListResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ScorecardListResponseData scorecardListResponseData = (ScorecardListResponseData) o; + return Objects.equals(this.attributes, scorecardListResponseData.attributes) + && Objects.equals(this.id, scorecardListResponseData.id) + && Objects.equals(this.type, scorecardListResponseData.type) + && Objects.equals( + this.additionalProperties, scorecardListResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ScorecardListResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ScorecardListType.java b/src/main/java/com/datadog/api/client/v2/model/ScorecardListType.java new file mode 100644 index 00000000000..f1ac545ccde --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ScorecardListType.java @@ -0,0 +1,53 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The JSON:API type for scorecard list. */ +@JsonSerialize(using = ScorecardListType.ScorecardListTypeSerializer.class) +public class ScorecardListType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("scorecard")); + + public static final ScorecardListType SCORECARD = new ScorecardListType("scorecard"); + + ScorecardListType(String value) { + super(value, allowedValues); + } + + public static class ScorecardListTypeSerializer extends StdSerializer { + public ScorecardListTypeSerializer(Class t) { + super(t); + } + + public ScorecardListTypeSerializer() { + this(null); + } + + @Override + public void serialize(ScorecardListType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ScorecardListType fromValue(String value) { + return new ScorecardListType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateCampaignRequest.java b/src/main/java/com/datadog/api/client/v2/model/UpdateCampaignRequest.java new file mode 100644 index 00000000000..c25a634ba05 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateCampaignRequest.java @@ -0,0 +1,145 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request to update a campaign. */ +@JsonPropertyOrder({UpdateCampaignRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpdateCampaignRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private UpdateCampaignRequestData data; + + public UpdateCampaignRequest() {} + + @JsonCreator + public UpdateCampaignRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) UpdateCampaignRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public UpdateCampaignRequest data(UpdateCampaignRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data for updating a campaign. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UpdateCampaignRequestData getData() { + return data; + } + + public void setData(UpdateCampaignRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return UpdateCampaignRequest + */ + @JsonAnySetter + public UpdateCampaignRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this UpdateCampaignRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateCampaignRequest updateCampaignRequest = (UpdateCampaignRequest) o; + return Objects.equals(this.data, updateCampaignRequest.data) + && Objects.equals(this.additionalProperties, updateCampaignRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateCampaignRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateCampaignRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/UpdateCampaignRequestAttributes.java new file mode 100644 index 00000000000..38e0a84fbd5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateCampaignRequestAttributes.java @@ -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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes for updating a campaign. */ +@JsonPropertyOrder({ + UpdateCampaignRequestAttributes.JSON_PROPERTY_DESCRIPTION, + UpdateCampaignRequestAttributes.JSON_PROPERTY_DUE_DATE, + UpdateCampaignRequestAttributes.JSON_PROPERTY_ENTITY_SCOPE, + UpdateCampaignRequestAttributes.JSON_PROPERTY_GUIDANCE, + UpdateCampaignRequestAttributes.JSON_PROPERTY_KEY, + UpdateCampaignRequestAttributes.JSON_PROPERTY_NAME, + UpdateCampaignRequestAttributes.JSON_PROPERTY_OWNER_ID, + UpdateCampaignRequestAttributes.JSON_PROPERTY_RULE_IDS, + UpdateCampaignRequestAttributes.JSON_PROPERTY_START_DATE, + UpdateCampaignRequestAttributes.JSON_PROPERTY_STATUS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpdateCampaignRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_DUE_DATE = "due_date"; + private OffsetDateTime dueDate; + + public static final String JSON_PROPERTY_ENTITY_SCOPE = "entity_scope"; + private String entityScope; + + public static final String JSON_PROPERTY_GUIDANCE = "guidance"; + private String guidance; + + public static final String JSON_PROPERTY_KEY = "key"; + private String key; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_OWNER_ID = "owner_id"; + private String ownerId; + + public static final String JSON_PROPERTY_RULE_IDS = "rule_ids"; + private List ruleIds = new ArrayList<>(); + + public static final String JSON_PROPERTY_START_DATE = "start_date"; + private OffsetDateTime startDate; + + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; + + public UpdateCampaignRequestAttributes() {} + + @JsonCreator + public UpdateCampaignRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_OWNER_ID) String ownerId, + @JsonProperty(required = true, value = JSON_PROPERTY_RULE_IDS) List ruleIds, + @JsonProperty(required = true, value = JSON_PROPERTY_START_DATE) OffsetDateTime startDate, + @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) String status) { + this.name = name; + this.ownerId = ownerId; + this.ruleIds = ruleIds; + this.startDate = startDate; + this.status = status; + } + + public UpdateCampaignRequestAttributes description(String description) { + this.description = description; + return this; + } + + /** + * The description of the campaign. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public UpdateCampaignRequestAttributes dueDate(OffsetDateTime dueDate) { + this.dueDate = dueDate; + return this; + } + + /** + * The due date of the campaign. + * + * @return dueDate + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DUE_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getDueDate() { + return dueDate; + } + + public void setDueDate(OffsetDateTime dueDate) { + this.dueDate = dueDate; + } + + public UpdateCampaignRequestAttributes entityScope(String entityScope) { + this.entityScope = entityScope; + return this; + } + + /** + * Entity scope query to filter entities for this campaign. + * + * @return entityScope + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENTITY_SCOPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getEntityScope() { + return entityScope; + } + + public void setEntityScope(String entityScope) { + this.entityScope = entityScope; + } + + public UpdateCampaignRequestAttributes guidance(String guidance) { + this.guidance = guidance; + return this; + } + + /** + * Guidance for the campaign. + * + * @return guidance + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_GUIDANCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getGuidance() { + return guidance; + } + + public void setGuidance(String guidance) { + this.guidance = guidance; + } + + public UpdateCampaignRequestAttributes key(String key) { + this.key = key; + return this; + } + + /** + * The unique key for the campaign. + * + * @return key + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public UpdateCampaignRequestAttributes name(String name) { + this.name = name; + return this; + } + + /** + * The name of the campaign. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public UpdateCampaignRequestAttributes ownerId(String ownerId) { + this.ownerId = ownerId; + return this; + } + + /** + * The UUID of the campaign owner. + * + * @return ownerId + */ + @JsonProperty(JSON_PROPERTY_OWNER_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getOwnerId() { + return ownerId; + } + + public void setOwnerId(String ownerId) { + this.ownerId = ownerId; + } + + public UpdateCampaignRequestAttributes ruleIds(List ruleIds) { + this.ruleIds = ruleIds; + return this; + } + + public UpdateCampaignRequestAttributes addRuleIdsItem(String ruleIdsItem) { + this.ruleIds.add(ruleIdsItem); + return this; + } + + /** + * Array of rule IDs associated with this campaign. + * + * @return ruleIds + */ + @JsonProperty(JSON_PROPERTY_RULE_IDS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRuleIds() { + return ruleIds; + } + + public void setRuleIds(List ruleIds) { + this.ruleIds = ruleIds; + } + + public UpdateCampaignRequestAttributes startDate(OffsetDateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * The start date of the campaign. + * + * @return startDate + */ + @JsonProperty(JSON_PROPERTY_START_DATE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getStartDate() { + return startDate; + } + + public void setStartDate(OffsetDateTime startDate) { + this.startDate = startDate; + } + + public UpdateCampaignRequestAttributes status(String status) { + this.status = status; + return this; + } + + /** + * The status of the campaign. + * + * @return status + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return UpdateCampaignRequestAttributes + */ + @JsonAnySetter + public UpdateCampaignRequestAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this UpdateCampaignRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateCampaignRequestAttributes updateCampaignRequestAttributes = + (UpdateCampaignRequestAttributes) o; + return Objects.equals(this.description, updateCampaignRequestAttributes.description) + && Objects.equals(this.dueDate, updateCampaignRequestAttributes.dueDate) + && Objects.equals(this.entityScope, updateCampaignRequestAttributes.entityScope) + && Objects.equals(this.guidance, updateCampaignRequestAttributes.guidance) + && Objects.equals(this.key, updateCampaignRequestAttributes.key) + && Objects.equals(this.name, updateCampaignRequestAttributes.name) + && Objects.equals(this.ownerId, updateCampaignRequestAttributes.ownerId) + && Objects.equals(this.ruleIds, updateCampaignRequestAttributes.ruleIds) + && Objects.equals(this.startDate, updateCampaignRequestAttributes.startDate) + && Objects.equals(this.status, updateCampaignRequestAttributes.status) + && Objects.equals( + this.additionalProperties, updateCampaignRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + description, + dueDate, + entityScope, + guidance, + key, + name, + ownerId, + ruleIds, + startDate, + status, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateCampaignRequestAttributes {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" dueDate: ").append(toIndentedString(dueDate)).append("\n"); + sb.append(" entityScope: ").append(toIndentedString(entityScope)).append("\n"); + sb.append(" guidance: ").append(toIndentedString(guidance)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" ownerId: ").append(toIndentedString(ownerId)).append("\n"); + sb.append(" ruleIds: ").append(toIndentedString(ruleIds)).append("\n"); + sb.append(" startDate: ").append(toIndentedString(startDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateCampaignRequestData.java b/src/main/java/com/datadog/api/client/v2/model/UpdateCampaignRequestData.java new file mode 100644 index 00000000000..d02fddcfca5 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateCampaignRequestData.java @@ -0,0 +1,182 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data for updating a campaign. */ +@JsonPropertyOrder({ + UpdateCampaignRequestData.JSON_PROPERTY_ATTRIBUTES, + UpdateCampaignRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpdateCampaignRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private UpdateCampaignRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private CampaignType type; + + public UpdateCampaignRequestData() {} + + @JsonCreator + public UpdateCampaignRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + UpdateCampaignRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) CampaignType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public UpdateCampaignRequestData attributes(UpdateCampaignRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for updating a campaign. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UpdateCampaignRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(UpdateCampaignRequestAttributes attributes) { + this.attributes = attributes; + } + + public UpdateCampaignRequestData type(CampaignType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The JSON:API type for campaigns. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CampaignType getType() { + return type; + } + + public void setType(CampaignType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return UpdateCampaignRequestData + */ + @JsonAnySetter + public UpdateCampaignRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this UpdateCampaignRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateCampaignRequestData updateCampaignRequestData = (UpdateCampaignRequestData) o; + return Objects.equals(this.attributes, updateCampaignRequestData.attributes) + && Objects.equals(this.type, updateCampaignRequestData.type) + && Objects.equals( + this.additionalProperties, updateCampaignRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateCampaignRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpdateRuleRequestData.java b/src/main/java/com/datadog/api/client/v2/model/UpdateRuleRequestData.java index 2e7e588c9a3..949d87a0b7e 100644 --- a/src/main/java/com/datadog/api/client/v2/model/UpdateRuleRequestData.java +++ b/src/main/java/com/datadog/api/client/v2/model/UpdateRuleRequestData.java @@ -26,30 +26,31 @@ public class UpdateRuleRequestData { @JsonIgnore public boolean unparsed = false; public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; - private RuleAttributes attributes; + private RuleAttributesRequest attributes; public static final String JSON_PROPERTY_TYPE = "type"; private RuleType type = RuleType.RULE; - public UpdateRuleRequestData attributes(RuleAttributes attributes) { + public UpdateRuleRequestData attributes(RuleAttributesRequest attributes) { this.attributes = attributes; this.unparsed |= attributes.unparsed; return this; } /** - * Details of a rule. + * Attributes for creating or updating a rule. Server-managed fields (created_at, modified_at, + * custom) are excluded. * * @return attributes */ @jakarta.annotation.Nullable @JsonProperty(JSON_PROPERTY_ATTRIBUTES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public RuleAttributes getAttributes() { + public RuleAttributesRequest getAttributes() { return attributes; } - public void setAttributes(RuleAttributes attributes) { + public void setAttributes(RuleAttributesRequest attributes) { this.attributes = attributes; } diff --git a/src/main/java/com/datadog/api/client/v2/model/WidgetAttributes.java b/src/main/java/com/datadog/api/client/v2/model/WidgetAttributes.java new file mode 100644 index 00000000000..b7f0c9cbf2e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WidgetAttributes.java @@ -0,0 +1,268 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Attributes of a widget resource. */ +@JsonPropertyOrder({ + WidgetAttributes.JSON_PROPERTY_CREATED_AT, + WidgetAttributes.JSON_PROPERTY_DEFINITION, + WidgetAttributes.JSON_PROPERTY_IS_FAVORITED, + WidgetAttributes.JSON_PROPERTY_MODIFIED_AT, + WidgetAttributes.JSON_PROPERTY_TAGS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WidgetAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private String createdAt; + + public static final String JSON_PROPERTY_DEFINITION = "definition"; + private WidgetDefinition definition; + + public static final String JSON_PROPERTY_IS_FAVORITED = "is_favorited"; + private Boolean isFavorited; + + public static final String JSON_PROPERTY_MODIFIED_AT = "modified_at"; + private String modifiedAt; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = new ArrayList<>(); + + public WidgetAttributes() {} + + @JsonCreator + public WidgetAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) String createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_DEFINITION) WidgetDefinition definition, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_FAVORITED) Boolean isFavorited, + @JsonProperty(required = true, value = JSON_PROPERTY_MODIFIED_AT) String modifiedAt, + @JsonProperty(required = true, value = JSON_PROPERTY_TAGS) List tags) { + this.createdAt = createdAt; + this.definition = definition; + this.unparsed |= definition.unparsed; + this.isFavorited = isFavorited; + this.modifiedAt = modifiedAt; + this.tags = tags; + if (tags != null) {} + } + + public WidgetAttributes createdAt(String createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * ISO 8601 timestamp of when the widget was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public WidgetAttributes definition(WidgetDefinition definition) { + this.definition = definition; + this.unparsed |= definition.unparsed; + return this; + } + + /** + * The definition of a widget, including its type and configuration. + * + * @return definition + */ + @JsonProperty(JSON_PROPERTY_DEFINITION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WidgetDefinition getDefinition() { + return definition; + } + + public void setDefinition(WidgetDefinition definition) { + this.definition = definition; + } + + public WidgetAttributes isFavorited(Boolean isFavorited) { + this.isFavorited = isFavorited; + return this; + } + + /** + * Will be implemented soon. Currently always returns false. + * + * @return isFavorited + */ + @JsonProperty(JSON_PROPERTY_IS_FAVORITED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsFavorited() { + return isFavorited; + } + + public void setIsFavorited(Boolean isFavorited) { + this.isFavorited = isFavorited; + } + + public WidgetAttributes modifiedAt(String modifiedAt) { + this.modifiedAt = modifiedAt; + return this; + } + + /** + * ISO 8601 timestamp of when the widget was last modified. + * + * @return modifiedAt + */ + @JsonProperty(JSON_PROPERTY_MODIFIED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(String modifiedAt) { + this.modifiedAt = modifiedAt; + } + + public WidgetAttributes tags(List tags) { + this.tags = tags; + return this; + } + + public WidgetAttributes addTagsItem(String tagsItem) { + this.tags.add(tagsItem); + return this; + } + + /** + * User-defined tags for organizing widgets. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WidgetAttributes + */ + @JsonAnySetter + public WidgetAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WidgetAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WidgetAttributes widgetAttributes = (WidgetAttributes) o; + return Objects.equals(this.createdAt, widgetAttributes.createdAt) + && Objects.equals(this.definition, widgetAttributes.definition) + && Objects.equals(this.isFavorited, widgetAttributes.isFavorited) + && Objects.equals(this.modifiedAt, widgetAttributes.modifiedAt) + && Objects.equals(this.tags, widgetAttributes.tags) + && Objects.equals(this.additionalProperties, widgetAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, definition, isFavorited, modifiedAt, tags, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WidgetAttributes {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" definition: ").append(toIndentedString(definition)).append("\n"); + sb.append(" isFavorited: ").append(toIndentedString(isFavorited)).append("\n"); + sb.append(" modifiedAt: ").append(toIndentedString(modifiedAt)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WidgetData.java b/src/main/java/com/datadog/api/client/v2/model/WidgetData.java new file mode 100644 index 00000000000..35056cec50e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WidgetData.java @@ -0,0 +1,231 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A widget resource object. */ +@JsonPropertyOrder({ + WidgetData.JSON_PROPERTY_ATTRIBUTES, + WidgetData.JSON_PROPERTY_ID, + WidgetData.JSON_PROPERTY_RELATIONSHIPS, + WidgetData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WidgetData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private WidgetAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private WidgetRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public WidgetData() {} + + @JsonCreator + public WidgetData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) WidgetAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + } + + public WidgetData attributes(WidgetAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of a widget resource. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WidgetAttributes getAttributes() { + return attributes; + } + + public void setAttributes(WidgetAttributes attributes) { + this.attributes = attributes; + } + + public WidgetData id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the widget. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public WidgetData relationships(WidgetRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * Relationships of the widget resource. + * + * @return relationships + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WidgetRelationships getRelationships() { + return relationships; + } + + public void setRelationships(WidgetRelationships relationships) { + this.relationships = relationships; + } + + public WidgetData type(String type) { + this.type = type; + return this; + } + + /** + * Widgets resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WidgetData + */ + @JsonAnySetter + public WidgetData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WidgetData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WidgetData widgetData = (WidgetData) o; + return Objects.equals(this.attributes, widgetData.attributes) + && Objects.equals(this.id, widgetData.id) + && Objects.equals(this.relationships, widgetData.relationships) + && Objects.equals(this.type, widgetData.type) + && Objects.equals(this.additionalProperties, widgetData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WidgetData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WidgetDefinition.java b/src/main/java/com/datadog/api/client/v2/model/WidgetDefinition.java new file mode 100644 index 00000000000..0fb3d1812c2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WidgetDefinition.java @@ -0,0 +1,176 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of a widget, including its type and configuration. */ +@JsonPropertyOrder({WidgetDefinition.JSON_PROPERTY_TITLE, WidgetDefinition.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WidgetDefinition { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public static final String JSON_PROPERTY_TYPE = "type"; + private WidgetType type; + + public WidgetDefinition() {} + + @JsonCreator + public WidgetDefinition( + @JsonProperty(required = true, value = JSON_PROPERTY_TITLE) String title, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) WidgetType type) { + this.title = title; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public WidgetDefinition title(String title) { + this.title = title; + return this; + } + + /** + * The display title of the widget. + * + * @return title + */ + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public WidgetDefinition type(WidgetType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Widget types that are allowed to be stored as individual records. This is not a complete list + * of dashboard and notebook widget types. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WidgetType getType() { + return type; + } + + public void setType(WidgetType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WidgetDefinition + */ + @JsonAnySetter + public WidgetDefinition putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WidgetDefinition object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WidgetDefinition widgetDefinition = (WidgetDefinition) o; + return Objects.equals(this.title, widgetDefinition.title) + && Objects.equals(this.type, widgetDefinition.type) + && Objects.equals(this.additionalProperties, widgetDefinition.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(title, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WidgetDefinition {\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WidgetExperienceType.java b/src/main/java/com/datadog/api/client/v2/model/WidgetExperienceType.java new file mode 100644 index 00000000000..5b1bd842156 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WidgetExperienceType.java @@ -0,0 +1,60 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Widget experience types that differentiate between the products using the specific widget. */ +@JsonSerialize(using = WidgetExperienceType.WidgetExperienceTypeSerializer.class) +public class WidgetExperienceType extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList("ccm_reports", "logs_reports", "csv_reports", "product_analytics")); + + public static final WidgetExperienceType CCM_REPORTS = new WidgetExperienceType("ccm_reports"); + public static final WidgetExperienceType LOGS_REPORTS = new WidgetExperienceType("logs_reports"); + public static final WidgetExperienceType CSV_REPORTS = new WidgetExperienceType("csv_reports"); + public static final WidgetExperienceType PRODUCT_ANALYTICS = + new WidgetExperienceType("product_analytics"); + + WidgetExperienceType(String value) { + super(value, allowedValues); + } + + public static class WidgetExperienceTypeSerializer extends StdSerializer { + public WidgetExperienceTypeSerializer(Class t) { + super(t); + } + + public WidgetExperienceTypeSerializer() { + this(null); + } + + @Override + public void serialize( + WidgetExperienceType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static WidgetExperienceType fromValue(String value) { + return new WidgetExperienceType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WidgetIncludedUser.java b/src/main/java/com/datadog/api/client/v2/model/WidgetIncludedUser.java new file mode 100644 index 00000000000..6b2b2c57245 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WidgetIncludedUser.java @@ -0,0 +1,201 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A user resource included in the response. */ +@JsonPropertyOrder({ + WidgetIncludedUser.JSON_PROPERTY_ATTRIBUTES, + WidgetIncludedUser.JSON_PROPERTY_ID, + WidgetIncludedUser.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WidgetIncludedUser { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private WidgetIncludedUserAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public WidgetIncludedUser() {} + + @JsonCreator + public WidgetIncludedUser( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type) { + this.id = id; + this.type = type; + } + + public WidgetIncludedUser attributes(WidgetIncludedUserAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of an included user resource. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WidgetIncludedUserAttributes getAttributes() { + return attributes; + } + + public void setAttributes(WidgetIncludedUserAttributes attributes) { + this.attributes = attributes; + } + + public WidgetIncludedUser id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the user. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public WidgetIncludedUser type(String type) { + this.type = type; + return this; + } + + /** + * Users resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WidgetIncludedUser + */ + @JsonAnySetter + public WidgetIncludedUser putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WidgetIncludedUser object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WidgetIncludedUser widgetIncludedUser = (WidgetIncludedUser) o; + return Objects.equals(this.attributes, widgetIncludedUser.attributes) + && Objects.equals(this.id, widgetIncludedUser.id) + && Objects.equals(this.type, widgetIncludedUser.type) + && Objects.equals(this.additionalProperties, widgetIncludedUser.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WidgetIncludedUser {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WidgetIncludedUserAttributes.java b/src/main/java/com/datadog/api/client/v2/model/WidgetIncludedUserAttributes.java new file mode 100644 index 00000000000..93e2e67aa27 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WidgetIncludedUserAttributes.java @@ -0,0 +1,176 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Attributes of an included user resource. */ +@JsonPropertyOrder({ + WidgetIncludedUserAttributes.JSON_PROPERTY_HANDLE, + WidgetIncludedUserAttributes.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WidgetIncludedUserAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_HANDLE = "handle"; + private String handle; + + public static final String JSON_PROPERTY_NAME = "name"; + private JsonNullable name = JsonNullable.undefined(); + + public WidgetIncludedUserAttributes handle(String handle) { + this.handle = handle; + return this; + } + + /** + * The email handle of the user. + * + * @return handle + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_HANDLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getHandle() { + return handle; + } + + public void setHandle(String handle) { + this.handle = handle; + } + + public WidgetIncludedUserAttributes name(String name) { + this.name = JsonNullable.of(name); + return this; + } + + /** + * The display name of the user. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getName() { + return name.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getName_JsonNullable() { + return name; + } + + @JsonProperty(JSON_PROPERTY_NAME) + public void setName_JsonNullable(JsonNullable name) { + this.name = name; + } + + public void setName(String name) { + this.name = JsonNullable.of(name); + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WidgetIncludedUserAttributes + */ + @JsonAnySetter + public WidgetIncludedUserAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WidgetIncludedUserAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WidgetIncludedUserAttributes widgetIncludedUserAttributes = (WidgetIncludedUserAttributes) o; + return Objects.equals(this.handle, widgetIncludedUserAttributes.handle) + && Objects.equals(this.name, widgetIncludedUserAttributes.name) + && Objects.equals( + this.additionalProperties, widgetIncludedUserAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(handle, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WidgetIncludedUserAttributes {\n"); + sb.append(" handle: ").append(toIndentedString(handle)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WidgetListResponse.java b/src/main/java/com/datadog/api/client/v2/model/WidgetListResponse.java new file mode 100644 index 00000000000..158ec1988ad --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WidgetListResponse.java @@ -0,0 +1,223 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response containing a list of widgets. */ +@JsonPropertyOrder({ + WidgetListResponse.JSON_PROPERTY_DATA, + WidgetListResponse.JSON_PROPERTY_INCLUDED, + WidgetListResponse.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WidgetListResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public static final String JSON_PROPERTY_INCLUDED = "included"; + private List included = null; + + public static final String JSON_PROPERTY_META = "meta"; + private WidgetSearchMeta meta; + + public WidgetListResponse() {} + + @JsonCreator + public WidgetListResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + } + + public WidgetListResponse data(List data) { + this.data = data; + for (WidgetData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public WidgetListResponse addDataItem(WidgetData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * List of widget resources. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public WidgetListResponse included(List included) { + this.included = included; + for (WidgetIncludedUser item : included) { + this.unparsed |= item.unparsed; + } + return this; + } + + public WidgetListResponse addIncludedItem(WidgetIncludedUser includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + this.unparsed |= includedItem.unparsed; + return this; + } + + /** + * Array of user resources related to the widgets. + * + * @return included + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCLUDED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIncluded() { + return included; + } + + public void setIncluded(List included) { + this.included = included; + } + + public WidgetListResponse meta(WidgetSearchMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Metadata about the search results. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WidgetSearchMeta getMeta() { + return meta; + } + + public void setMeta(WidgetSearchMeta meta) { + this.meta = meta; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WidgetListResponse + */ + @JsonAnySetter + public WidgetListResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WidgetListResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WidgetListResponse widgetListResponse = (WidgetListResponse) o; + return Objects.equals(this.data, widgetListResponse.data) + && Objects.equals(this.included, widgetListResponse.included) + && Objects.equals(this.meta, widgetListResponse.meta) + && Objects.equals(this.additionalProperties, widgetListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WidgetListResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WidgetRelationshipData.java b/src/main/java/com/datadog/api/client/v2/model/WidgetRelationshipData.java new file mode 100644 index 00000000000..3da15f37197 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WidgetRelationshipData.java @@ -0,0 +1,173 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Relationship data referencing a user resource. */ +@JsonPropertyOrder({ + WidgetRelationshipData.JSON_PROPERTY_ID, + WidgetRelationshipData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WidgetRelationshipData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private String type; + + public WidgetRelationshipData() {} + + @JsonCreator + public WidgetRelationshipData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) String type) { + this.id = id; + this.type = type; + } + + public WidgetRelationshipData id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the user. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public WidgetRelationshipData type(String type) { + this.type = type; + return this; + } + + /** + * Users resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WidgetRelationshipData + */ + @JsonAnySetter + public WidgetRelationshipData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WidgetRelationshipData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WidgetRelationshipData widgetRelationshipData = (WidgetRelationshipData) o; + return Objects.equals(this.id, widgetRelationshipData.id) + && Objects.equals(this.type, widgetRelationshipData.type) + && Objects.equals(this.additionalProperties, widgetRelationshipData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WidgetRelationshipData {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WidgetRelationshipItem.java b/src/main/java/com/datadog/api/client/v2/model/WidgetRelationshipItem.java new file mode 100644 index 00000000000..0c4a91bdf84 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WidgetRelationshipItem.java @@ -0,0 +1,136 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A JSON:API relationship to a user. */ +@JsonPropertyOrder({WidgetRelationshipItem.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WidgetRelationshipItem { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private WidgetRelationshipData data; + + public WidgetRelationshipItem data(WidgetRelationshipData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Relationship data referencing a user resource. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WidgetRelationshipData getData() { + return data; + } + + public void setData(WidgetRelationshipData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WidgetRelationshipItem + */ + @JsonAnySetter + public WidgetRelationshipItem putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WidgetRelationshipItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WidgetRelationshipItem widgetRelationshipItem = (WidgetRelationshipItem) o; + return Objects.equals(this.data, widgetRelationshipItem.data) + && Objects.equals(this.additionalProperties, widgetRelationshipItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WidgetRelationshipItem {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WidgetRelationships.java b/src/main/java/com/datadog/api/client/v2/model/WidgetRelationships.java new file mode 100644 index 00000000000..3e5c28faa0a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WidgetRelationships.java @@ -0,0 +1,166 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Relationships of the widget resource. */ +@JsonPropertyOrder({ + WidgetRelationships.JSON_PROPERTY_CREATED_BY, + WidgetRelationships.JSON_PROPERTY_MODIFIED_BY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WidgetRelationships { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_BY = "created_by"; + private WidgetRelationshipItem createdBy; + + public static final String JSON_PROPERTY_MODIFIED_BY = "modified_by"; + private WidgetRelationshipItem modifiedBy; + + public WidgetRelationships createdBy(WidgetRelationshipItem createdBy) { + this.createdBy = createdBy; + this.unparsed |= createdBy.unparsed; + return this; + } + + /** + * A JSON:API relationship to a user. + * + * @return createdBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WidgetRelationshipItem getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(WidgetRelationshipItem createdBy) { + this.createdBy = createdBy; + } + + public WidgetRelationships modifiedBy(WidgetRelationshipItem modifiedBy) { + this.modifiedBy = modifiedBy; + this.unparsed |= modifiedBy.unparsed; + return this; + } + + /** + * A JSON:API relationship to a user. + * + * @return modifiedBy + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MODIFIED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public WidgetRelationshipItem getModifiedBy() { + return modifiedBy; + } + + public void setModifiedBy(WidgetRelationshipItem modifiedBy) { + this.modifiedBy = modifiedBy; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WidgetRelationships + */ + @JsonAnySetter + public WidgetRelationships putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WidgetRelationships object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WidgetRelationships widgetRelationships = (WidgetRelationships) o; + return Objects.equals(this.createdBy, widgetRelationships.createdBy) + && Objects.equals(this.modifiedBy, widgetRelationships.modifiedBy) + && Objects.equals(this.additionalProperties, widgetRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdBy, modifiedBy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WidgetRelationships {\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" modifiedBy: ").append(toIndentedString(modifiedBy)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WidgetResponse.java b/src/main/java/com/datadog/api/client/v2/model/WidgetResponse.java new file mode 100644 index 00000000000..aeb16df9254 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WidgetResponse.java @@ -0,0 +1,185 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response containing a single widget. */ +@JsonPropertyOrder({WidgetResponse.JSON_PROPERTY_DATA, WidgetResponse.JSON_PROPERTY_INCLUDED}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WidgetResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private WidgetData data; + + public static final String JSON_PROPERTY_INCLUDED = "included"; + private List included = null; + + public WidgetResponse() {} + + @JsonCreator + public WidgetResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) WidgetData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public WidgetResponse data(WidgetData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * A widget resource object. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public WidgetData getData() { + return data; + } + + public void setData(WidgetData data) { + this.data = data; + } + + public WidgetResponse included(List included) { + this.included = included; + for (WidgetIncludedUser item : included) { + this.unparsed |= item.unparsed; + } + return this; + } + + public WidgetResponse addIncludedItem(WidgetIncludedUser includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + this.unparsed |= includedItem.unparsed; + return this; + } + + /** + * Array of user resources related to the widget. + * + * @return included + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCLUDED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIncluded() { + return included; + } + + public void setIncluded(List included) { + this.included = included; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WidgetResponse + */ + @JsonAnySetter + public WidgetResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WidgetResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WidgetResponse widgetResponse = (WidgetResponse) o; + return Objects.equals(this.data, widgetResponse.data) + && Objects.equals(this.included, widgetResponse.included) + && Objects.equals(this.additionalProperties, widgetResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WidgetResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WidgetSearchMeta.java b/src/main/java/com/datadog/api/client/v2/model/WidgetSearchMeta.java new file mode 100644 index 00000000000..50ea3f1850c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WidgetSearchMeta.java @@ -0,0 +1,227 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Metadata about the search results. */ +@JsonPropertyOrder({ + WidgetSearchMeta.JSON_PROPERTY_CREATED_BY_ANYONE_TOTAL, + WidgetSearchMeta.JSON_PROPERTY_CREATED_BY_YOU_TOTAL, + WidgetSearchMeta.JSON_PROPERTY_FAVORITED_BY_YOU_TOTAL, + WidgetSearchMeta.JSON_PROPERTY_FILTERED_TOTAL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class WidgetSearchMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_BY_ANYONE_TOTAL = "created_by_anyone_total"; + private Long createdByAnyoneTotal; + + public static final String JSON_PROPERTY_CREATED_BY_YOU_TOTAL = "created_by_you_total"; + private Long createdByYouTotal; + + public static final String JSON_PROPERTY_FAVORITED_BY_YOU_TOTAL = "favorited_by_you_total"; + private Long favoritedByYouTotal; + + public static final String JSON_PROPERTY_FILTERED_TOTAL = "filtered_total"; + private Long filteredTotal; + + public WidgetSearchMeta createdByAnyoneTotal(Long createdByAnyoneTotal) { + this.createdByAnyoneTotal = createdByAnyoneTotal; + return this; + } + + /** + * Total number of widgets created by anyone. + * + * @return createdByAnyoneTotal + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_BY_ANYONE_TOTAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getCreatedByAnyoneTotal() { + return createdByAnyoneTotal; + } + + public void setCreatedByAnyoneTotal(Long createdByAnyoneTotal) { + this.createdByAnyoneTotal = createdByAnyoneTotal; + } + + public WidgetSearchMeta createdByYouTotal(Long createdByYouTotal) { + this.createdByYouTotal = createdByYouTotal; + return this; + } + + /** + * Total number of widgets created by the current user. + * + * @return createdByYouTotal + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_BY_YOU_TOTAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getCreatedByYouTotal() { + return createdByYouTotal; + } + + public void setCreatedByYouTotal(Long createdByYouTotal) { + this.createdByYouTotal = createdByYouTotal; + } + + public WidgetSearchMeta favoritedByYouTotal(Long favoritedByYouTotal) { + this.favoritedByYouTotal = favoritedByYouTotal; + return this; + } + + /** + * Total number of widgets favorited by the current user. + * + * @return favoritedByYouTotal + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FAVORITED_BY_YOU_TOTAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getFavoritedByYouTotal() { + return favoritedByYouTotal; + } + + public void setFavoritedByYouTotal(Long favoritedByYouTotal) { + this.favoritedByYouTotal = favoritedByYouTotal; + } + + public WidgetSearchMeta filteredTotal(Long filteredTotal) { + this.filteredTotal = filteredTotal; + return this; + } + + /** + * Total number of widgets matching the current filter criteria. + * + * @return filteredTotal + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_FILTERED_TOTAL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getFilteredTotal() { + return filteredTotal; + } + + public void setFilteredTotal(Long filteredTotal) { + this.filteredTotal = filteredTotal; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return WidgetSearchMeta + */ + @JsonAnySetter + public WidgetSearchMeta putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this WidgetSearchMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WidgetSearchMeta widgetSearchMeta = (WidgetSearchMeta) o; + return Objects.equals(this.createdByAnyoneTotal, widgetSearchMeta.createdByAnyoneTotal) + && Objects.equals(this.createdByYouTotal, widgetSearchMeta.createdByYouTotal) + && Objects.equals(this.favoritedByYouTotal, widgetSearchMeta.favoritedByYouTotal) + && Objects.equals(this.filteredTotal, widgetSearchMeta.filteredTotal) + && Objects.equals(this.additionalProperties, widgetSearchMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdByAnyoneTotal, + createdByYouTotal, + favoritedByYouTotal, + filteredTotal, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WidgetSearchMeta {\n"); + sb.append(" createdByAnyoneTotal: ") + .append(toIndentedString(createdByAnyoneTotal)) + .append("\n"); + sb.append(" createdByYouTotal: ").append(toIndentedString(createdByYouTotal)).append("\n"); + sb.append(" favoritedByYouTotal: ") + .append(toIndentedString(favoritedByYouTotal)) + .append("\n"); + sb.append(" filteredTotal: ").append(toIndentedString(filteredTotal)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/WidgetType.java b/src/main/java/com/datadog/api/client/v2/model/WidgetType.java new file mode 100644 index 00000000000..28ca7342765 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/WidgetType.java @@ -0,0 +1,87 @@ +/* + * 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 com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * Widget types that are allowed to be stored as individual records. This is not a complete list of + * dashboard and notebook widget types. + */ +@JsonSerialize(using = WidgetType.WidgetTypeSerializer.class) +public class WidgetType extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "bar_chart", + "change", + "cloud_cost_summary", + "cohort", + "funnel", + "geomap", + "list_stream", + "query_table", + "query_value", + "retention_curve", + "sankey", + "sunburst", + "timeseries", + "toplist", + "treemap")); + + public static final WidgetType BAR_CHART = new WidgetType("bar_chart"); + public static final WidgetType CHANGE = new WidgetType("change"); + public static final WidgetType CLOUD_COST_SUMMARY = new WidgetType("cloud_cost_summary"); + public static final WidgetType COHORT = new WidgetType("cohort"); + public static final WidgetType FUNNEL = new WidgetType("funnel"); + public static final WidgetType GEOMAP = new WidgetType("geomap"); + public static final WidgetType LIST_STREAM = new WidgetType("list_stream"); + public static final WidgetType QUERY_TABLE = new WidgetType("query_table"); + public static final WidgetType QUERY_VALUE = new WidgetType("query_value"); + public static final WidgetType RETENTION_CURVE = new WidgetType("retention_curve"); + public static final WidgetType SANKEY = new WidgetType("sankey"); + public static final WidgetType SUNBURST = new WidgetType("sunburst"); + public static final WidgetType TIMESERIES = new WidgetType("timeseries"); + public static final WidgetType TOPLIST = new WidgetType("toplist"); + public static final WidgetType TREEMAP = new WidgetType("treemap"); + + WidgetType(String value) { + super(value, allowedValues); + } + + public static class WidgetTypeSerializer extends StdSerializer { + public WidgetTypeSerializer(Class t) { + super(t); + } + + public WidgetTypeSerializer() { + this(null); + } + + @Override + public void serialize(WidgetType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static WidgetType fromValue(String value) { + return new WidgetType(value); + } +} diff --git a/src/test/resources/cassettes/features/v2/Update_an_existing_rule_returns_Rule_updated_successfully_response.json b/src/test/resources/cassettes/features/v2/Update_an_existing_rule_returns_Rule_updated_successfully_response.json index f28bc3a04f3..ce8587753ae 100644 --- a/src/test/resources/cassettes/features/v2/Update_an_existing_rule_returns_Rule_updated_successfully_response.json +++ b/src/test/resources/cassettes/features/v2/Update_an_existing_rule_returns_Rule_updated_successfully_response.json @@ -33,7 +33,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"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\"}}}" + "json": "{\"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\"}}" }, "headers": {}, "method": "PUT", @@ -57,7 +57,7 @@ "timeToLive": { "unlimited": true }, - "id": "c173c2c3-af4e-e37c-6f43-19a3182dd04d" + "id": "14405d8c-52a7-3cea-87ac-1473d69830e0" }, { "httpRequest": { diff --git a/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index 6c42beffa17..57ed25bf71a 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/given.json @@ -1066,7 +1066,7 @@ ], "step": "there is a valid \"create_scorecard_rule\" in the system", "key": "create_scorecard_rule", - "tag": "Service Scorecards", + "tag": "Scorecards", "operationId": "CreateScorecardRule" }, { diff --git a/src/test/resources/com/datadog/api/client/v2/api/scorecards.feature b/src/test/resources/com/datadog/api/client/v2/api/scorecards.feature new file mode 100644 index 00000000000..750948d8991 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/service_scorecards.feature b/src/test/resources/com/datadog/api/client/v2/api/service_scorecards.feature deleted file mode 100644 index 387f04cf711..00000000000 --- a/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 67596e3589c..2783f30f9e8 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -4702,32 +4702,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": [ @@ -4740,17 +4770,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": { @@ -6356,6 +6392,47 @@ "type": "safe" } }, + "SearchWidgets": { + "tag": "Widgets", + "undo": { + "type": "safe" + } + }, + "CreateWidget": { + "tag": "Widgets", + "undo": { + "operationId": "DeleteWidget", + "parameters": [ + { + "name": "experience_type", + "source": "experience_type" + }, + { + "name": "uuid", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteWidget": { + "tag": "Widgets", + "undo": { + "type": "idempotent" + } + }, + "GetWidget": { + "tag": "Widgets", + "undo": { + "type": "safe" + } + }, + "UpdateWidget": { + "tag": "Widgets", + "undo": { + "type": "safe" + } + }, "CreateWorkflow": { "tag": "Workflow Automation", "undo": { diff --git a/src/test/resources/com/datadog/api/client/v2/api/widgets.feature b/src/test/resources/com/datadog/api/client/v2/api/widgets.feature new file mode 100644 index 00000000000..54b01571156 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/widgets.feature @@ -0,0 +1,115 @@ +@endpoint(widgets) @endpoint(widgets-v2) +Feature: Widgets + Create, read, update, and delete saved widgets. Widgets are reusable + visualization components stored independently from any dashboard or + notebook, partitioned by experience type and identified by a UUID. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Widgets" API + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Create a widget returns "Bad Request" response + Given new "CreateWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"definition": {"title": "My Widget", "type": "bar_chart"}, "tags": []}, "type": "widgets"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Create a widget returns "OK" response + Given new "CreateWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"definition": {"title": "My Widget", "type": "bar_chart"}, "tags": []}, "type": "widgets"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Delete a widget returns "Bad Request" response + Given new "DeleteWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Delete a widget returns "No Content" response + Given new "DeleteWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Delete a widget returns "Not Found" response + Given new "DeleteWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get a widget returns "Bad Request" response + Given new "GetWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get a widget returns "Not Found" response + Given new "GetWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get a widget returns "OK" response + Given new "GetWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Search widgets returns "Bad Request" response + Given new "SearchWidgets" request + And request contains "experience_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Search widgets returns "OK" response + Given new "SearchWidgets" request + And request contains "experience_type" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Update a widget returns "Bad Request" response + Given new "UpdateWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"definition": {"title": "My Widget", "type": "bar_chart"}, "tags": []}, "type": "widgets"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Update a widget returns "Not Found" response + Given new "UpdateWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"definition": {"title": "My Widget", "type": "bar_chart"}, "tags": []}, "type": "widgets"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Update a widget returns "OK" response + Given new "UpdateWidget" request + And request contains "experience_type" parameter from "REPLACE.ME" + And request contains "uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"definition": {"title": "My Widget", "type": "bar_chart"}, "tags": []}, "type": "widgets"}} + When the request is sent + Then the response status is 200 OK