diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9bceb715496..d09adfa7620 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -5249,6 +5249,79 @@ components: example: _latest type: string type: object + AttachCaseRequest: + description: Request for attaching security findings to a case. + properties: + data: + $ref: '#/components/schemas/AttachCaseRequestData' + type: object + AttachCaseRequestData: + description: Data of the case to attach security findings to. + properties: + id: + description: The unique identifier of the case. + example: c1234567-89ab-cdef-0123-456789abcdef + type: string + relationships: + $ref: '#/components/schemas/AttachCaseRequestDataRelationships' + type: + $ref: '#/components/schemas/CaseDataType' + required: + - type + - id + type: object + AttachCaseRequestDataRelationships: + description: Relationships of the case to attach security findings to. + properties: + findings: + $ref: '#/components/schemas/Findings' + description: Security findings to attach to the case. + required: + - findings + type: object + AttachJiraIssueRequest: + description: Request for attaching security findings to a Jira issue. + properties: + data: + $ref: '#/components/schemas/AttachJiraIssueRequestData' + type: object + AttachJiraIssueRequestData: + description: Data of the Jira issue to attach security findings to. + properties: + attributes: + $ref: '#/components/schemas/AttachJiraIssueRequestDataAttributes' + id: + description: The unique identifier of the Jira issue attachment request. + example: j1234567-89ab-cdef-0123-456789abcdef + type: string + relationships: + $ref: '#/components/schemas/AttachJiraIssueRequestDataRelationships' + type: + $ref: '#/components/schemas/JiraIssuesDataType' + required: + - type + type: object + AttachJiraIssueRequestDataAttributes: + description: Attributes of the Jira issue to attach security findings to. + properties: + jira_issue_url: + description: The URL of the Jira issue to attach security findings to. + example: https://domain.atlassian.net/browse/PROJ-123 + type: string + required: + - jira_issue_url + type: object + AttachJiraIssueRequestDataRelationships: + description: Relationships of the Jira issue to attach security findings to. + properties: + findings: + $ref: '#/components/schemas/Findings' + project: + $ref: '#/components/schemas/CaseManagementProject' + required: + - findings + - project + type: object AuditLogsEvent: description: Object description of an Audit Logs event after it is processed and stored by Datadog. @@ -8921,6 +8994,15 @@ components: required: - data type: object + CaseDataType: + default: cases + description: Cases resource type. + enum: + - cases + example: cases + type: string + x-enum-varnames: + - CASES CaseEmpty: description: Case empty request data properties: @@ -8937,6 +9019,53 @@ components: required: - data type: object + CaseInsightsItems: + description: An insight of the case. + properties: + ref: + description: The reference of the insight. + example: /security/appsec/vm/library/vulnerability/dfa027f7c037b2f77159adc027fecb56?detection=static + type: string + resource_id: + description: The unique identifier of the resource. For example, the unique + identifier of a security finding. + example: ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw== + type: string + type: + description: The type of the resource. For example, the type of a security + finding is "SECURITY_FINDING". + example: SECURITY_FINDING + type: string + type: object + CaseManagementProject: + description: Case management project. + properties: + data: + $ref: '#/components/schemas/CaseManagementProjectData' + required: + - data + type: object + CaseManagementProjectData: + properties: + id: + description: The unique identifier of the case management project. + example: aeadc05e-98a8-11ec-ac2c-da7ad0900001 + type: string + type: + $ref: '#/components/schemas/CaseManagementProjectDataType' + required: + - type + - id + type: object + CaseManagementProjectDataType: + default: projects + description: Projects resource type. + enum: + - projects + example: projects + type: string + x-enum-varnames: + - PROJECTS CaseObjectAttributes: additionalProperties: items: @@ -12581,6 +12710,68 @@ components: required: - type type: object + CreateCaseRequestArray: + description: List of requests to create cases for security findings. + properties: + data: + items: + $ref: '#/components/schemas/CreateCaseRequestData' + type: array + required: + - data + type: object + CreateCaseRequestData: + description: Data of the case to create. + properties: + attributes: + $ref: '#/components/schemas/CreateCaseRequestDataAttributes' + id: + description: The unique identifier of the case. + example: c1234567-89ab-cdef-0123-456789abcdef + type: string + relationships: + $ref: '#/components/schemas/CreateCaseRequestDataRelationships' + type: + $ref: '#/components/schemas/CaseDataType' + required: + - type + type: object + CreateCaseRequestDataAttributes: + description: Attributes of the case to create. + properties: + assignee_id: + description: The unique identifier of the user assigned to the case. + example: f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0 + type: string + description: + description: The description of the case. If not provided, the description + will be automatically generated. + example: A description of the case. + type: string + priority: + $ref: '#/components/schemas/CasePriority' + description: The priority of the case. If not provided, the priority will + be automatically set to "NOT_DEFINED". + example: P4 + title: + description: The title of the case. If not provided, the title will be automatically + generated. + example: A title for the case. + type: string + type: object + CreateCaseRequestDataRelationships: + description: Relationships of the case to create. + properties: + findings: + $ref: '#/components/schemas/Findings' + description: Security findings of the case to create. + project: + $ref: '#/components/schemas/CaseManagementProject' + description: Project of the case to create. + required: + - findings + - project + type: object CreateConnectionRequest: example: data: @@ -12852,6 +13043,89 @@ components: required: - data type: object + CreateJiraIssueRequestArray: + description: List of requests to create Jira issues for security findings. + properties: + data: + items: + $ref: '#/components/schemas/CreateJiraIssueRequestData' + type: array + included: + items: + $ref: '#/components/schemas/CreateJiraIssueRequestArrayIncluded' + type: array + required: + - data + type: object + CreateJiraIssueRequestArrayIncluded: + description: 'Attributes and relationships of the case linked to the Jira issue. + Should contain all of the following: case, project, and security findings.' + oneOf: + - $ref: '#/components/schemas/CreateCaseRequestData' + - $ref: '#/components/schemas/CaseManagementProjectData' + - $ref: '#/components/schemas/FindingData' + CreateJiraIssueRequestData: + description: Data of the Jira issue to create. + properties: + attributes: + $ref: '#/components/schemas/CreateJiraIssueRequestDataAttributes' + id: + description: The unique identifier of the Jira issue creation request. + example: j1234567-89ab-cdef-0123-456789abcdef + type: string + relationships: + $ref: '#/components/schemas/CreateJiraIssueRequestDataRelationships' + type: + $ref: '#/components/schemas/JiraIssuesDataType' + required: + - type + type: object + CreateJiraIssueRequestDataAttributes: + description: Attributes of the Jira issue to create. + properties: + fields: + $ref: '#/components/schemas/CreateJiraIssueRequestDataAttributesFields' + type: object + CreateJiraIssueRequestDataAttributesFields: + description: Custom fields of the Jira issue to create. For the list of available + fields, see [Jira documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-createmeta-projectidorkey-issuetypes-issuetypeid-get). + properties: + fields: + example: + customfield_10001: Value 1 + customfield_10002: + - Value 2 + - Value 3 + type: object + type: object + CreateJiraIssueRequestDataRelationships: + description: Relationships of the Jira issue to create. + properties: + case: + $ref: '#/components/schemas/CreateJiraIssueRequestDataRelationshipsCase' + required: + - case + type: object + CreateJiraIssueRequestDataRelationshipsCase: + description: Case linked to the Jira issue. + properties: + data: + $ref: '#/components/schemas/CreateJiraIssueRequestDataRelationshipsCaseData' + required: + - data + type: object + CreateJiraIssueRequestDataRelationshipsCaseData: + description: Case linked to the Jira issue. + properties: + id: + example: c1234567-89ab-cdef-0123-456789abcdef + type: string + type: + $ref: '#/components/schemas/CaseDataType' + required: + - type + - id + type: object CreateNotificationRuleParameters: description: Body of the notification rule create request. properties: @@ -16841,6 +17115,35 @@ components: oneOf: - $ref: '#/components/schemas/DeploymentRuleOptionsFaultyDeploymentDetection' - $ref: '#/components/schemas/DeploymentRuleOptionsMonitor' + DetachCaseRequest: + description: Request for detaching security findings from their case. + properties: + data: + $ref: '#/components/schemas/DetachCaseRequestData' + type: object + DetachCaseRequestData: + description: Data for detaching security findings from their case. + properties: + id: + description: The unique identifier of the detachment request. + example: f8b9e3b1-24ec-4413-8be5-1b12b98533c6 + type: string + relationships: + $ref: '#/components/schemas/DetachCaseRequestDataRelationships' + type: + $ref: '#/components/schemas/CaseDataType' + required: + - type + type: object + DetachCaseRequestDataRelationships: + description: Relationships detaching security findings from their case. + properties: + findings: + $ref: '#/components/schemas/Findings' + description: Security findings to detach from their case. + required: + - findings + type: object DetailedFinding: description: A single finding with with message and resource configuration. properties: @@ -20691,6 +20994,153 @@ components: vulnerability_type: $ref: '#/components/schemas/FindingVulnerabilityType' type: object + FindingCaseResponse: + description: Case response. + properties: + data: + $ref: '#/components/schemas/FindingCaseResponseData' + type: object + FindingCaseResponseArray: + description: List of case responses. + properties: + data: + items: + $ref: '#/components/schemas/FindingCaseResponseData' + type: array + required: + - data + type: object + FindingCaseResponseData: + description: Data of the case. + properties: + attributes: + $ref: '#/components/schemas/FindingCaseResponseDataAttributes' + id: + description: The unique identifier of the case. + example: c1234567-89ab-cdef-0123-456789abcdef + type: string + relationships: + $ref: '#/components/schemas/FindingCaseResponseDataRelationships' + type: + $ref: '#/components/schemas/CaseDataType' + required: + - type + type: object + FindingCaseResponseDataAttributes: + description: Attributes of the case. + properties: + archived_at: + description: Timestamp of when the case was archived. + example: '2025-01-01T00:00:00.000Z' + format: date-time + type: string + assigned_to: + $ref: '#/components/schemas/RelationshipToUser' + description: User assigned to the case. + attributes: + additionalProperties: + items: + type: string + type: array + type: object + closed_at: + description: Timestamp of when the case was closed. + example: '2025-01-01T00:00:00.000Z' + format: date-time + type: string + created_at: + description: Timestamp of when the case was created. + example: '2025-01-01T00:00:00.000Z' + format: date-time + type: string + creation_source: + description: Source of the case creation. + example: CS_SECURITY_FINDING + type: string + description: + description: Description of the case. + example: A description of the case. + type: string + due_date: + description: Due date of the case. + example: '2025-01-01' + type: string + insights: + description: Insights of the case. + items: + $ref: '#/components/schemas/CaseInsightsItems' + type: array + jira_issue: + $ref: '#/components/schemas/FindingJiraIssue' + description: Jira issue associated with the case. + key: + description: Key of the case. + example: PROJ-123 + type: string + modified_at: + description: Timestamp of when the case was last modified. + example: '2025-01-01T00:00:00.000Z' + format: date-time + type: string + priority: + description: Priority of the case. + example: P4 + type: string + status: + description: Status of the case. + example: OPEN + type: string + status_group: + description: Status group of the case. + example: SG_OPEN + type: string + status_name: + description: Status name of the case. + example: Open + type: string + title: + description: Title of the case. + example: A title for the case. + type: string + type: + description: Type of the case. For security cases, this is always "SECURITY". + example: SECURITY + type: string + type: object + FindingCaseResponseDataRelationships: + description: Relationships of the case. + properties: + created_by: + $ref: '#/components/schemas/RelationshipToUser' + description: User who created the case. + modified_by: + $ref: '#/components/schemas/RelationshipToUser' + description: User who last modified the case. + project: + $ref: '#/components/schemas/CaseManagementProject' + description: Project in which the case was created. + type: object + FindingData: + properties: + id: + description: The unique identifier of the security finding. + example: ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw== + type: string + type: + $ref: '#/components/schemas/FindingDataType' + required: + - type + - id + type: object + FindingDataType: + default: findings + description: Security findings resource type. + enum: + - findings + example: findings + type: string + x-enum-varnames: + - FINDINGS FindingDatadogLink: description: The Datadog relative link for this finding. example: /security/compliance?panels=cpfinding%7Cevent%7CruleId%3Adef-000-u5t%7CresourceId%3Ae8c9ab7c52ebd7bf2fdb4db641082d7d%7CtabId%3Aoverview @@ -20732,6 +21182,42 @@ components: description: The unique ID for this finding. example: ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw== type: string + FindingJiraIssue: + description: Jira issue associated with the case. + properties: + error_message: + description: The error message if the Jira issue creation failed. + example: '{"errorMessages":["An error occured."],"errors":{}}' + type: string + result: + $ref: '#/components/schemas/FindingJiraIssueResult' + status: + description: The status of the Jira issue creation. Can be "COMPLETED" if + the Jira issue was created successfully, or "FAILED" if the Jira issue + creation failed. + example: COMPLETED + type: string + type: object + FindingJiraIssueResult: + description: Result of the Jira issue creation. + properties: + account_id: + description: The account ID of the Jira issue. + example: 463a8631-680e-455c-bfd3-3ed04d326eb7 + type: string + issue_id: + description: The unique identifier of the Jira issue. + example: '2871276' + type: string + issue_key: + description: The key of the Jira issue. + example: PROJ-123 + type: string + issue_url: + description: The URL of the Jira issue. + example: https://domain.atlassian.net/browse/PROJ-123 + type: string + type: object FindingMute: additionalProperties: false description: Information about the mute status of this finding. @@ -20857,6 +21343,14 @@ components: - ATTACK_PATH - IDENTITY_RISK - API_SECURITY + Findings: + description: A list of security findings. + properties: + data: + items: + $ref: '#/components/schemas/FindingData' + type: array + type: object FlakyTest: description: A flaky test object. properties: @@ -28274,6 +28768,15 @@ components: description: Jira project key type: string type: object + JiraIssuesDataType: + default: jira_issues + description: Jira issues resource type. + enum: + - jira_issues + example: jira_issues + type: string + x-enum-varnames: + - JIRA_ISSUES JobCreateResponse: description: Run a threat hunting job response. properties: @@ -41410,6 +41913,7 @@ components: type: object RelationshipToUserTeamPermissionData: description: Related user team permission data + nullable: true properties: id: description: The ID of the user team permission @@ -51804,7 +52308,11 @@ components: items: description: String identifier of the module type: string + nullable: true type: array + is_managed: + description: Whether the team is managed from an external source + type: boolean link_count: description: The number of links belonging to the team format: int32 @@ -51836,6 +52344,7 @@ components: items: description: String identifier of the module type: string + nullable: true type: array required: - handle @@ -52016,6 +52525,211 @@ components: required: - data type: object + TeamHierarchyLink: + description: Team hierarchy link + properties: + attributes: + $ref: '#/components/schemas/TeamHierarchyLinkAttributes' + id: + description: The team hierarchy link's identifier + example: b8626d7e-cedd-11eb-abf5-da7ad0900001 + type: string + relationships: + $ref: '#/components/schemas/TeamHierarchyLinkRelationships' + type: + $ref: '#/components/schemas/TeamHierarchyLinkType' + required: + - attributes + - id + - type + type: object + TeamHierarchyLinkAttributes: + description: Team hierarchy link attributes + properties: + created_at: + description: Timestamp when the team hierarchy link was created + example: '' + format: date-time + type: string + provisioned_by: + description: The provisioner of the team hierarchy link + example: system + type: string + required: + - provisioned_by + - created_at + type: object + TeamHierarchyLinkCreate: + description: Data provided when creating a team hierarchy link + properties: + relationships: + $ref: '#/components/schemas/TeamHierarchyLinkCreateRelationships' + type: + $ref: '#/components/schemas/TeamHierarchyLinkType' + required: + - relationships + - type + type: object + TeamHierarchyLinkCreateRelationships: + description: The related teams that will be connected by the team hierarchy + link + properties: + parent_team: + $ref: '#/components/schemas/TeamHierarchyLinkCreateTeamRelationship' + sub_team: + $ref: '#/components/schemas/TeamHierarchyLinkCreateTeamRelationship' + required: + - parent_team + - sub_team + type: object + TeamHierarchyLinkCreateRequest: + description: Request to create a team hierarchy link + properties: + data: + $ref: '#/components/schemas/TeamHierarchyLinkCreate' + required: + - data + type: object + TeamHierarchyLinkCreateTeam: + description: This schema defines the attributes about each team that has to + be provided when creating a team hierarchy link + properties: + id: + description: The team's identifier + example: 692e8073-12c4-4c71-8408-5090bd44c9c8 + type: string + type: + $ref: '#/components/schemas/TeamType' + required: + - id + - type + type: object + TeamHierarchyLinkCreateTeamRelationship: + description: Data about each team that will be connected by the team hierarchy + link + properties: + data: + $ref: '#/components/schemas/TeamHierarchyLinkCreateTeam' + required: + - data + type: object + TeamHierarchyLinkRelationships: + description: Team hierarchy link relationships + properties: + parent_team: + $ref: '#/components/schemas/TeamHierarchyLinkTeamRelationship' + sub_team: + $ref: '#/components/schemas/TeamHierarchyLinkTeamRelationship' + required: + - parent_team + - sub_team + type: object + TeamHierarchyLinkResponse: + description: Team hierarchy link response + properties: + data: + $ref: '#/components/schemas/TeamHierarchyLink' + included: + description: Included teams + items: + $ref: '#/components/schemas/TeamHierarchyLinkTeam' + type: array + links: + $ref: '#/components/schemas/TeamsHierarchyLinksResponseLinks' + type: object + TeamHierarchyLinkTeam: + description: Team hierarchy links connect different teams. This represents team + objects that are connected by the team hierarchy link. + properties: + attributes: + $ref: '#/components/schemas/TeamHierarchyLinkTeamAttributes' + id: + description: The team's identifier + example: 692e8073-12c4-4c71-8408-5090bd44c9c8 + type: string + type: + $ref: '#/components/schemas/TeamType' + required: + - id + - type + type: object + TeamHierarchyLinkTeamAttributes: + description: Team hierarchy links connect different teams. This represents attributes + from teams that are connected by the team hierarchy link. + properties: + avatar: + description: The team's avatar + nullable: true + type: string + banner: + description: The team's banner + format: int64 + type: integer + handle: + description: The team's handle + example: team-handle + type: string + is_managed: + description: Whether the team is managed + type: boolean + is_open_membership: + description: Whether the team has open membership + type: boolean + link_count: + description: The number of links for the team + format: int64 + type: integer + name: + description: The team's name + example: Team Name + type: string + summary: + description: The team's summary + nullable: true + type: string + user_count: + description: The number of users in the team + format: int64 + type: integer + required: + - handle + - name + type: object + TeamHierarchyLinkTeamRelationship: + description: Team hierarchy link team relationship + properties: + data: + $ref: '#/components/schemas/TeamHierarchyLinkTeam' + required: + - data + type: object + TeamHierarchyLinkType: + default: team_hierarchy_links + description: Team hierarchy link type + enum: + - team_hierarchy_links + example: team_hierarchy_links + type: string + x-enum-varnames: + - TEAM_HIERARCHY_LINKS + TeamHierarchyLinksResponse: + description: Team hierarchy links response + properties: + data: + description: Team hierarchy links response data + items: + $ref: '#/components/schemas/TeamHierarchyLink' + type: array + included: + description: Included teams + items: + $ref: '#/components/schemas/TeamHierarchyLinkTeam' + type: array + links: + $ref: '#/components/schemas/TeamsHierarchyLinksResponseLinks' + meta: + $ref: '#/components/schemas/TeamsHierarchyLinksResponseMeta' + type: object TeamIncluded: description: Included resources related to the team oneOf: @@ -52895,6 +53609,76 @@ components: - LINK_COUNT - TEAM_LINKS - USER_TEAM_PERMISSIONS + TeamsHierarchyLinksResponseLinks: + description: When querying team hierarchy links, a set of links for navigation + between different pages is included + properties: + first: + description: Link to the first page. + nullable: true + type: string + last: + description: Link to the last page. + nullable: true + type: string + next: + description: Link to the next page. + nullable: true + type: string + prev: + description: Link to the previous page. + nullable: true + type: string + self: + description: Link to the current object. + type: string + type: object + TeamsHierarchyLinksResponseMeta: + description: Metadata that is included in the response when querying the team + hierarchy links + properties: + page: + $ref: '#/components/schemas/TeamsHierarchyLinksResponseMetaPage' + type: object + TeamsHierarchyLinksResponseMetaPage: + description: Metadata related to paging information that is included in the + response when querying the team hierarchy links + properties: + first_number: + description: First page number. + format: int64 + type: integer + last_number: + description: Last page number. + format: int64 + type: integer + next_number: + description: Next page number. + format: int64 + nullable: true + type: integer + number: + description: Page number. + format: int64 + type: integer + prev_number: + description: Previous page number. + format: int64 + nullable: true + type: integer + size: + description: Page size. + format: int64 + type: integer + total: + description: Total number of results. + format: int64 + type: integer + type: + description: Pagination type. + example: number_size + type: string + type: object TeamsResponse: description: Response with multiple teams properties: @@ -73566,10 +74350,16 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] + - AuthZ: [] summary: Mute or unmute a batch of findings tags: - Security Monitoring x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - security_monitoring_findings_write + - appsec_vm_write x-unstable: '**Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' @@ -77253,6 +78043,208 @@ paths: operator: OR permissions: - security_monitoring_cws_agent_rules_read + /api/v2/security/findings/cases: + delete: + description: Detach security findings from their case. This operation dissociates + security findings from their associated cases without deleting the cases themselves. + You can detach security findings from multiple different cases in a single + request, with a limit of 50 security findings per request. Security findings + that are not currently attached to any case will be ignored. + operationId: DetachCase + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DetachCaseRequest' + required: true + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequestResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Detach security findings from their case + tags: + - Security Monitoring + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - security_monitoring_findings_write + - appsec_vm_write + post: + description: Create cases for security findings. You can create up to 50 cases + per request and associate up to 50 security findings per case. Security findings + that are already attached to another case will be detached from their previous + case and attached to the newly created case. + operationId: CreateCases + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateCaseRequestArray' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/FindingCaseResponseArray' + description: Created + '400': + $ref: '#/components/responses/BadRequestResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Create cases for security findings + tags: + - Security Monitoring + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - security_monitoring_findings_write + - appsec_vm_write + /api/v2/security/findings/cases/{case_id}: + patch: + description: Attach security findings to a case. You can attach up to 50 security + findings per case. Security findings that are already attached to another + case will be detached from their previous case and attached to the specified + case. + operationId: AttachCase + parameters: + - description: The unique identifier of the case to attach security findings + to + in: path + name: case_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AttachCaseRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/FindingCaseResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Attach security findings to a case + tags: + - Security Monitoring + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - security_monitoring_findings_write + - appsec_vm_write + /api/v2/security/findings/jira_issues: + patch: + description: Attach security findings to a Jira issue by providing the Jira + issue URL. You can attach up to 50 security findings per Jira issue. If the + Jira issue is not linked to any case, this operation will create a case for + the security findings and link the Jira issue to the newly created case. Security + findings that are already attached to another Jira issue will be detached + from their previous Jira issue and attached to the specified Jira issue. + operationId: AttachJiraIssue + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AttachJiraIssueRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/FindingCaseResponse' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Attach security findings to a Jira issue + tags: + - Security Monitoring + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - security_monitoring_findings_write + - appsec_vm_write + post: + description: Create Jira issues for security findings. This operation creates + a case in Datadog and a Jira issue linked to that case for bidirectional sync + between Datadog and Jira. You can create up to 50 Jira issues per request + and associate up to 50 security findings per Jira issue. Security findings + that are already attached to another Jira issue will be detached from their + previous Jira issue and attached to the newly created Jira issue. + operationId: CreateJiraIssues + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateJiraIssueRequestArray' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/FindingCaseResponseArray' + description: Created + '400': + $ref: '#/components/responses/BadRequestResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Create Jira issues for security findings + tags: + - Security Monitoring + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - security_monitoring_findings_write + - appsec_vm_write /api/v2/security/sboms: get: description: 'Get a list of assets SBOMs for an organization. @@ -81999,6 +82991,170 @@ paths: permissions: - teams_read - teams_manage + /api/v2/team-hierarchy-links: + get: + description: List all team hierarchy links that match the provided filters. + operationId: ListTeamHierarchyLinks + parameters: + - $ref: '#/components/parameters/PageNumber' + - $ref: '#/components/parameters/PageSize' + - description: Filter by parent team ID + in: query + name: filter[parent_team] + required: false + schema: + type: string + - description: Filter by sub team ID + in: query + name: filter[sub_team] + required: false + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamHierarchyLinksResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Get team hierarchy links + tags: + - Teams + x-pagination: + limitParam: page[size] + pageParam: page[number] + resultsPath: data + x-permission: + operator: OR + permissions: + - teams_read + post: + description: Create a new team hierarchy link between a parent team and a sub + team. + operationId: AddTeamHierarchyLink + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TeamHierarchyLinkCreateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamHierarchyLinkResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Conflict + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + - teams_manage + summary: Create a team hierarchy link + tags: + - Teams + x-permission: + operator: AND + permissions: + - teams_read + - teams_manage + /api/v2/team-hierarchy-links/{link_id}: + delete: + description: Remove a team hierarchy link by the given link_id. + operationId: RemoveTeamHierarchyLink + parameters: + - description: The team hierarchy link's identifier + in: path + name: link_id + required: true + schema: + type: string + responses: + '204': + description: No Content + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + - teams_manage + summary: Remove a team hierarchy link + tags: + - Teams + x-permission: + operator: AND + permissions: + - teams_read + - teams_manage + get: + description: Get a single team hierarchy link for the given link_id. + operationId: GetTeamHierarchyLink + parameters: + - description: The team hierarchy link's identifier + in: path + name: link_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamHierarchyLinkResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Get a team hierarchy link + tags: + - Teams + x-permission: + operator: OR + permissions: + - teams_read /api/v2/team/connections: delete: description: Delete multiple team connections. @@ -82273,7 +83429,13 @@ paths: If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/team/{super_team_id}/member_teams: get: - description: Get all member teams. + deprecated: true + description: 'Get all member teams. + + + **Note**: This API is deprecated. For team hierarchy relationships (parent-child + + teams), use the team hierarchy links API: `GET /api/v2/team-hierarchy-links`.' operationId: ListMemberTeams parameters: - description: None @@ -82326,14 +83488,20 @@ paths: operator: OR permissions: - teams_read + x-sunset: '2026-06-01' x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' post: + deprecated: true description: 'Add a member team. Adds the team given by the `id` in the body as a member team of the super - team.' + team. + + + **Note**: This API is deprecated. For creating team hierarchy links, use the + team hierarchy links API: `POST /api/v2/team-hierarchy-links`.' operationId: AddMemberTeam parameters: - description: None @@ -82373,12 +83541,18 @@ paths: operator: OR permissions: - teams_read + x-sunset: '2026-06-01' x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/team/{super_team_id}/member_teams/{member_team_id}: delete: - description: Remove a super team's member team identified by `member_team_id`. + deprecated: true + description: 'Remove a super team''s member team identified by `member_team_id`. + + + **Note**: This API is deprecated. For deleting team hierarchy links, use the + team hierarchy links API: `DELETE /api/v2/team-hierarchy-links/{link_id}`.' operationId: RemoveMemberTeam parameters: - description: None @@ -82418,6 +83592,7 @@ paths: operator: OR permissions: - teams_read + x-sunset: '2026-06-01' x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' diff --git a/api/datadogV2/api_security_monitoring.go b/api/datadogV2/api_security_monitoring.go index fd8cacacc17..fb2a50c75f8 100644 --- a/api/datadogV2/api_security_monitoring.go +++ b/api/datadogV2/api_security_monitoring.go @@ -19,6 +19,167 @@ import ( // SecurityMonitoringApi service type type SecurityMonitoringApi datadog.Service +// AttachCase Attach security findings to a case. +// Attach security findings to a case. You can attach up to 50 security findings per case. Security findings that are already attached to another case will be detached from their previous case and attached to the specified case. +func (a *SecurityMonitoringApi) AttachCase(ctx _context.Context, caseId string, body AttachCaseRequest) (FindingCaseResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue FindingCaseResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.AttachCase") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security/findings/cases/{case_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{case_id}", _neturl.PathEscape(datadog.ParameterToString(caseId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// AttachJiraIssue Attach security findings to a Jira issue. +// Attach security findings to a Jira issue by providing the Jira issue URL. You can attach up to 50 security findings per Jira issue. If the Jira issue is not linked to any case, this operation will create a case for the security findings and link the Jira issue to the newly created case. Security findings that are already attached to another Jira issue will be detached from their previous Jira issue and attached to the specified Jira issue. +func (a *SecurityMonitoringApi) AttachJiraIssue(ctx _context.Context, body AttachJiraIssueRequest) (FindingCaseResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue FindingCaseResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.AttachJiraIssue") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security/findings/jira_issues" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // CancelThreatHuntingJob Cancel a threat hunting job. // Cancel a threat hunting job. func (a *SecurityMonitoringApi) CancelThreatHuntingJob(ctx _context.Context, jobId string) (*_nethttp.Response, error) { @@ -345,6 +506,86 @@ func (a *SecurityMonitoringApi) ConvertSecurityMonitoringRuleFromJSONToTerraform return localVarReturnValue, localVarHTTPResponse, nil } +// CreateCases Create cases for security findings. +// Create cases for security findings. You can create up to 50 cases per request and associate up to 50 security findings per case. Security findings that are already attached to another case will be detached from their previous case and attached to the newly created case. +func (a *SecurityMonitoringApi) CreateCases(ctx _context.Context, body CreateCaseRequestArray) (FindingCaseResponseArray, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue FindingCaseResponseArray + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.CreateCases") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security/findings/cases" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // CreateCustomFramework Create a custom framework. // Create a custom framework. func (a *SecurityMonitoringApi) CreateCustomFramework(ctx _context.Context, body CreateCustomFrameworkRequest) (CreateCustomFrameworkResponse, *_nethttp.Response, error) { @@ -425,6 +666,86 @@ func (a *SecurityMonitoringApi) CreateCustomFramework(ctx _context.Context, body return localVarReturnValue, localVarHTTPResponse, nil } +// CreateJiraIssues Create Jira issues for security findings. +// Create Jira issues for security findings. This operation creates a case in Datadog and a Jira issue linked to that case for bidirectional sync between Datadog and Jira. You can create up to 50 Jira issues per request and associate up to 50 security findings per Jira issue. Security findings that are already attached to another Jira issue will be detached from their previous Jira issue and attached to the newly created Jira issue. +func (a *SecurityMonitoringApi) CreateJiraIssues(ctx _context.Context, body CreateJiraIssueRequestArray) (FindingCaseResponseArray, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue FindingCaseResponseArray + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.CreateJiraIssues") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security/findings/jira_issues" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // CreateSecurityFilter Create a security filter. // Create a security filter. // @@ -1324,6 +1645,76 @@ func (a *SecurityMonitoringApi) DeleteVulnerabilityNotificationRule(ctx _context return localVarHTTPResponse, nil } +// DetachCase Detach security findings from their case. +// Detach security findings from their case. This operation dissociates security findings from their associated cases without deleting the cases themselves. You can detach security findings from multiple different cases in a single request, with a limit of 50 security findings per request. Security findings that are not currently attached to any case will be ignored. +func (a *SecurityMonitoringApi) DetachCase(ctx _context.Context, body DetachCaseRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.DetachCase") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security/findings/cases" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "*/*" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + // EditSecurityMonitoringSignalAssignee Modify the triage assignee of a security signal. // Modify the triage assignee of a security signal. func (a *SecurityMonitoringApi) EditSecurityMonitoringSignalAssignee(ctx _context.Context, signalId string, body SecurityMonitoringSignalAssigneeUpdateRequest) (SecurityMonitoringSignalTriageUpdateResponse, *_nethttp.Response, error) { diff --git a/api/datadogV2/api_teams.go b/api/datadogV2/api_teams.go index 7ba206ca691..8350d54acf4 100644 --- a/api/datadogV2/api_teams.go +++ b/api/datadogV2/api_teams.go @@ -21,6 +21,10 @@ type TeamsApi datadog.Service // AddMemberTeam Add a member team. // Add a member team. // Adds the team given by the `id` in the body as a member team of the super team. +// +// **Note**: This API is deprecated. For creating team hierarchy links, use the team hierarchy links API: `POST /api/v2/team-hierarchy-links`. +// +// Deprecated: This API is deprecated. func (a *TeamsApi) AddMemberTeam(ctx _context.Context, superTeamId string, body AddMemberTeamRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -99,6 +103,86 @@ func (a *TeamsApi) AddMemberTeam(ctx _context.Context, superTeamId string, body return localVarHTTPResponse, nil } +// AddTeamHierarchyLink Create a team hierarchy link. +// Create a new team hierarchy link between a parent team and a sub team. +func (a *TeamsApi) AddTeamHierarchyLink(ctx _context.Context, body TeamHierarchyLinkCreateRequest) (TeamHierarchyLinkResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue TeamHierarchyLinkResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.TeamsApi.AddTeamHierarchyLink") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/team-hierarchy-links" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 409 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // CreateTeam Create a team. // Create a new team. // User IDs passed through the `users` relationship field are added to the team. @@ -626,6 +710,84 @@ func (a *TeamsApi) GetTeam(ctx _context.Context, teamId string) (TeamResponse, * return localVarReturnValue, localVarHTTPResponse, nil } +// GetTeamHierarchyLink Get a team hierarchy link. +// Get a single team hierarchy link for the given link_id. +func (a *TeamsApi) GetTeamHierarchyLink(ctx _context.Context, linkId string) (TeamHierarchyLinkResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue TeamHierarchyLinkResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.TeamsApi.GetTeamHierarchyLink") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/team-hierarchy-links/{link_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{link_id}", _neturl.PathEscape(datadog.ParameterToString(linkId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // GetTeamLink Get a team link. // Get a single link for a team. func (a *TeamsApi) GetTeamLink(ctx _context.Context, teamId string, linkId string) (TeamLinkResponse, *_nethttp.Response, error) { @@ -1244,6 +1406,11 @@ func (r *ListMemberTeamsOptionalParameters) WithFieldsTeam(fieldsTeam []TeamsFie // ListMemberTeams Get all member teams. // Get all member teams. +// +// **Note**: This API is deprecated. For team hierarchy relationships (parent-child +// teams), use the team hierarchy links API: `GET /api/v2/team-hierarchy-links`. +// +// Deprecated: This API is deprecated. func (a *TeamsApi) ListMemberTeams(ctx _context.Context, superTeamId string, o ...ListMemberTeamsOptionalParameters) (TeamsResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -1394,6 +1561,189 @@ func (a *TeamsApi) ListMemberTeamsWithPagination(ctx _context.Context, superTeam return items, cancel } +// ListTeamHierarchyLinksOptionalParameters holds optional parameters for ListTeamHierarchyLinks. +type ListTeamHierarchyLinksOptionalParameters struct { + PageNumber *int64 + PageSize *int64 + FilterParentTeam *string + FilterSubTeam *string +} + +// NewListTeamHierarchyLinksOptionalParameters creates an empty struct for parameters. +func NewListTeamHierarchyLinksOptionalParameters() *ListTeamHierarchyLinksOptionalParameters { + this := ListTeamHierarchyLinksOptionalParameters{} + return &this +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListTeamHierarchyLinksOptionalParameters) WithPageNumber(pageNumber int64) *ListTeamHierarchyLinksOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListTeamHierarchyLinksOptionalParameters) WithPageSize(pageSize int64) *ListTeamHierarchyLinksOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithFilterParentTeam sets the corresponding parameter name and returns the struct. +func (r *ListTeamHierarchyLinksOptionalParameters) WithFilterParentTeam(filterParentTeam string) *ListTeamHierarchyLinksOptionalParameters { + r.FilterParentTeam = &filterParentTeam + return r +} + +// WithFilterSubTeam sets the corresponding parameter name and returns the struct. +func (r *ListTeamHierarchyLinksOptionalParameters) WithFilterSubTeam(filterSubTeam string) *ListTeamHierarchyLinksOptionalParameters { + r.FilterSubTeam = &filterSubTeam + return r +} + +// ListTeamHierarchyLinks Get team hierarchy links. +// List all team hierarchy links that match the provided filters. +func (a *TeamsApi) ListTeamHierarchyLinks(ctx _context.Context, o ...ListTeamHierarchyLinksOptionalParameters) (TeamHierarchyLinksResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue TeamHierarchyLinksResponse + optionalParams ListTeamHierarchyLinksOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListTeamHierarchyLinksOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.TeamsApi.ListTeamHierarchyLinks") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/team-hierarchy-links" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.PageNumber != nil { + localVarQueryParams.Add("page[number]", datadog.ParameterToString(*optionalParams.PageNumber, "")) + } + if optionalParams.PageSize != nil { + localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, "")) + } + if optionalParams.FilterParentTeam != nil { + localVarQueryParams.Add("filter[parent_team]", datadog.ParameterToString(*optionalParams.FilterParentTeam, "")) + } + if optionalParams.FilterSubTeam != nil { + localVarQueryParams.Add("filter[sub_team]", datadog.ParameterToString(*optionalParams.FilterSubTeam, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListTeamHierarchyLinksWithPagination provides a paginated version of ListTeamHierarchyLinks returning a channel with all items. +func (a *TeamsApi) ListTeamHierarchyLinksWithPagination(ctx _context.Context, o ...ListTeamHierarchyLinksOptionalParameters) (<-chan datadog.PaginationResult[TeamHierarchyLink], func()) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int64(10) + if len(o) == 0 { + o = append(o, ListTeamHierarchyLinksOptionalParameters{}) + } + if o[0].PageSize != nil { + pageSize_ = *o[0].PageSize + } + o[0].PageSize = &pageSize_ + page_ := int64(0) + o[0].PageNumber = &page_ + + items := make(chan datadog.PaginationResult[TeamHierarchyLink], pageSize_) + go func() { + for { + resp, _, err := a.ListTeamHierarchyLinks(ctx, o...) + if err != nil { + var returnItem TeamHierarchyLink + items <- datadog.PaginationResult[TeamHierarchyLink]{Item: returnItem, Error: err} + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- datadog.PaginationResult[TeamHierarchyLink]{Item: item, Error: nil}: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) < int(pageSize_) { + break + } + pageOffset_ := *o[0].PageNumber + 1 + o[0].PageNumber = &pageOffset_ + } + close(items) + }() + return items, cancel +} + // ListTeamsOptionalParameters holds optional parameters for ListTeams. type ListTeamsOptionalParameters struct { PageNumber *int64 @@ -1618,6 +1968,10 @@ func (a *TeamsApi) ListTeamsWithPagination(ctx _context.Context, o ...ListTeamsO // RemoveMemberTeam Remove a member team. // Remove a super team's member team identified by `member_team_id`. +// +// **Note**: This API is deprecated. For deleting team hierarchy links, use the team hierarchy links API: `DELETE /api/v2/team-hierarchy-links/{link_id}`. +// +// Deprecated: This API is deprecated. func (a *TeamsApi) RemoveMemberTeam(ctx _context.Context, superTeamId string, memberTeamId string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete @@ -1694,6 +2048,74 @@ func (a *TeamsApi) RemoveMemberTeam(ctx _context.Context, superTeamId string, me return localVarHTTPResponse, nil } +// RemoveTeamHierarchyLink Remove a team hierarchy link. +// Remove a team hierarchy link by the given link_id. +func (a *TeamsApi) RemoveTeamHierarchyLink(ctx _context.Context, linkId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.TeamsApi.RemoveTeamHierarchyLink") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/team-hierarchy-links/{link_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{link_id}", _neturl.PathEscape(datadog.ParameterToString(linkId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + // SyncTeams Link Teams with GitHub Teams. // This endpoint attempts to link your existing Datadog teams with GitHub teams by matching their names. // It evaluates all current Datadog teams and compares them against teams in the GitHub organization diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index c5cf4723b97..e0c544aed5b 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -508,11 +508,15 @@ // - [RumRetentionFiltersApi.ListRetentionFilters] // - [RumRetentionFiltersApi.OrderRetentionFilters] // - [RumRetentionFiltersApi.UpdateRetentionFilter] +// - [SecurityMonitoringApi.AttachCase] +// - [SecurityMonitoringApi.AttachJiraIssue] // - [SecurityMonitoringApi.CancelThreatHuntingJob] // - [SecurityMonitoringApi.ConvertExistingSecurityMonitoringRule] // - [SecurityMonitoringApi.ConvertJobResultToSignal] // - [SecurityMonitoringApi.ConvertSecurityMonitoringRuleFromJSONToTerraform] +// - [SecurityMonitoringApi.CreateCases] // - [SecurityMonitoringApi.CreateCustomFramework] +// - [SecurityMonitoringApi.CreateJiraIssues] // - [SecurityMonitoringApi.CreateSecurityFilter] // - [SecurityMonitoringApi.CreateSecurityMonitoringRule] // - [SecurityMonitoringApi.CreateSecurityMonitoringSuppression] @@ -525,6 +529,7 @@ // - [SecurityMonitoringApi.DeleteSignalNotificationRule] // - [SecurityMonitoringApi.DeleteThreatHuntingJob] // - [SecurityMonitoringApi.DeleteVulnerabilityNotificationRule] +// - [SecurityMonitoringApi.DetachCase] // - [SecurityMonitoringApi.EditSecurityMonitoringSignalAssignee] // - [SecurityMonitoringApi.EditSecurityMonitoringSignalIncidents] // - [SecurityMonitoringApi.EditSecurityMonitoringSignalState] @@ -628,6 +633,7 @@ // - [TeamConnectionsApi.DeleteTeamConnections] // - [TeamConnectionsApi.ListTeamConnections] // - [TeamsApi.AddMemberTeam] +// - [TeamsApi.AddTeamHierarchyLink] // - [TeamsApi.CreateTeam] // - [TeamsApi.CreateTeamLink] // - [TeamsApi.CreateTeamMembership] @@ -635,6 +641,7 @@ // - [TeamsApi.DeleteTeamLink] // - [TeamsApi.DeleteTeamMembership] // - [TeamsApi.GetTeam] +// - [TeamsApi.GetTeamHierarchyLink] // - [TeamsApi.GetTeamLink] // - [TeamsApi.GetTeamLinks] // - [TeamsApi.GetTeamMemberships] @@ -642,8 +649,10 @@ // - [TeamsApi.GetTeamSync] // - [TeamsApi.GetUserMemberships] // - [TeamsApi.ListMemberTeams] +// - [TeamsApi.ListTeamHierarchyLinks] // - [TeamsApi.ListTeams] // - [TeamsApi.RemoveMemberTeam] +// - [TeamsApi.RemoveTeamHierarchyLink] // - [TeamsApi.SyncTeams] // - [TeamsApi.UpdateTeam] // - [TeamsApi.UpdateTeamLink] diff --git a/api/datadogV2/model_attach_case_request.go b/api/datadogV2/model_attach_case_request.go new file mode 100644 index 00000000000..d057904fbbc --- /dev/null +++ b/api/datadogV2/model_attach_case_request.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AttachCaseRequest Request for attaching security findings to a case. +type AttachCaseRequest struct { + // Data of the case to attach security findings to. + Data *AttachCaseRequestData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAttachCaseRequest instantiates a new AttachCaseRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAttachCaseRequest() *AttachCaseRequest { + this := AttachCaseRequest{} + return &this +} + +// NewAttachCaseRequestWithDefaults instantiates a new AttachCaseRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAttachCaseRequestWithDefaults() *AttachCaseRequest { + this := AttachCaseRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *AttachCaseRequest) GetData() AttachCaseRequestData { + if o == nil || o.Data == nil { + var ret AttachCaseRequestData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AttachCaseRequest) GetDataOk() (*AttachCaseRequestData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *AttachCaseRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given AttachCaseRequestData and assigns it to the Data field. +func (o *AttachCaseRequest) SetData(v AttachCaseRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AttachCaseRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AttachCaseRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AttachCaseRequestData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_attach_case_request_data.go b/api/datadogV2/model_attach_case_request_data.go new file mode 100644 index 00000000000..40030cd23f5 --- /dev/null +++ b/api/datadogV2/model_attach_case_request_data.go @@ -0,0 +1,183 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AttachCaseRequestData Data of the case to attach security findings to. +type AttachCaseRequestData struct { + // The unique identifier of the case. + Id string `json:"id"` + // Relationships of the case to attach security findings to. + Relationships *AttachCaseRequestDataRelationships `json:"relationships,omitempty"` + // Cases resource type. + Type CaseDataType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAttachCaseRequestData instantiates a new AttachCaseRequestData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAttachCaseRequestData(id string, typeVar CaseDataType) *AttachCaseRequestData { + this := AttachCaseRequestData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewAttachCaseRequestDataWithDefaults instantiates a new AttachCaseRequestData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAttachCaseRequestDataWithDefaults() *AttachCaseRequestData { + this := AttachCaseRequestData{} + var typeVar CaseDataType = CASEDATATYPE_CASES + this.Type = typeVar + return &this +} + +// GetId returns the Id field value. +func (o *AttachCaseRequestData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *AttachCaseRequestData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *AttachCaseRequestData) SetId(v string) { + o.Id = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *AttachCaseRequestData) GetRelationships() AttachCaseRequestDataRelationships { + if o == nil || o.Relationships == nil { + var ret AttachCaseRequestDataRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AttachCaseRequestData) GetRelationshipsOk() (*AttachCaseRequestDataRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *AttachCaseRequestData) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given AttachCaseRequestDataRelationships and assigns it to the Relationships field. +func (o *AttachCaseRequestData) SetRelationships(v AttachCaseRequestDataRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *AttachCaseRequestData) GetType() CaseDataType { + if o == nil { + var ret CaseDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *AttachCaseRequestData) GetTypeOk() (*CaseDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AttachCaseRequestData) SetType(v CaseDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AttachCaseRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AttachCaseRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id"` + Relationships *AttachCaseRequestDataRelationships `json:"relationships,omitempty"` + Type *CaseDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + o.Id = *all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_attach_case_request_data_relationships.go b/api/datadogV2/model_attach_case_request_data_relationships.go new file mode 100644 index 00000000000..df6748bad30 --- /dev/null +++ b/api/datadogV2/model_attach_case_request_data_relationships.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AttachCaseRequestDataRelationships Relationships of the case to attach security findings to. +type AttachCaseRequestDataRelationships struct { + // A list of security findings. + Findings Findings `json:"findings"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAttachCaseRequestDataRelationships instantiates a new AttachCaseRequestDataRelationships object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAttachCaseRequestDataRelationships(findings Findings) *AttachCaseRequestDataRelationships { + this := AttachCaseRequestDataRelationships{} + this.Findings = findings + return &this +} + +// NewAttachCaseRequestDataRelationshipsWithDefaults instantiates a new AttachCaseRequestDataRelationships object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAttachCaseRequestDataRelationshipsWithDefaults() *AttachCaseRequestDataRelationships { + this := AttachCaseRequestDataRelationships{} + return &this +} + +// GetFindings returns the Findings field value. +func (o *AttachCaseRequestDataRelationships) GetFindings() Findings { + if o == nil { + var ret Findings + return ret + } + return o.Findings +} + +// GetFindingsOk returns a tuple with the Findings field value +// and a boolean to check if the value has been set. +func (o *AttachCaseRequestDataRelationships) GetFindingsOk() (*Findings, bool) { + if o == nil { + return nil, false + } + return &o.Findings, true +} + +// SetFindings sets field value. +func (o *AttachCaseRequestDataRelationships) SetFindings(v Findings) { + o.Findings = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AttachCaseRequestDataRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["findings"] = o.Findings + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AttachCaseRequestDataRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Findings *Findings `json:"findings"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Findings == nil { + return fmt.Errorf("required field findings missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"findings"}) + } else { + return err + } + + hasInvalidField := false + if all.Findings.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Findings = *all.Findings + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_attach_jira_issue_request.go b/api/datadogV2/model_attach_jira_issue_request.go new file mode 100644 index 00000000000..aa6e75e13a4 --- /dev/null +++ b/api/datadogV2/model_attach_jira_issue_request.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AttachJiraIssueRequest Request for attaching security findings to a Jira issue. +type AttachJiraIssueRequest struct { + // Data of the Jira issue to attach security findings to. + Data *AttachJiraIssueRequestData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAttachJiraIssueRequest instantiates a new AttachJiraIssueRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAttachJiraIssueRequest() *AttachJiraIssueRequest { + this := AttachJiraIssueRequest{} + return &this +} + +// NewAttachJiraIssueRequestWithDefaults instantiates a new AttachJiraIssueRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAttachJiraIssueRequestWithDefaults() *AttachJiraIssueRequest { + this := AttachJiraIssueRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *AttachJiraIssueRequest) GetData() AttachJiraIssueRequestData { + if o == nil || o.Data == nil { + var ret AttachJiraIssueRequestData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AttachJiraIssueRequest) GetDataOk() (*AttachJiraIssueRequestData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *AttachJiraIssueRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given AttachJiraIssueRequestData and assigns it to the Data field. +func (o *AttachJiraIssueRequest) SetData(v AttachJiraIssueRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AttachJiraIssueRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AttachJiraIssueRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *AttachJiraIssueRequestData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_attach_jira_issue_request_data.go b/api/datadogV2/model_attach_jira_issue_request_data.go new file mode 100644 index 00000000000..4acbfaafbec --- /dev/null +++ b/api/datadogV2/model_attach_jira_issue_request_data.go @@ -0,0 +1,224 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AttachJiraIssueRequestData Data of the Jira issue to attach security findings to. +type AttachJiraIssueRequestData struct { + // Attributes of the Jira issue to attach security findings to. + Attributes *AttachJiraIssueRequestDataAttributes `json:"attributes,omitempty"` + // The unique identifier of the Jira issue attachment request. + Id *string `json:"id,omitempty"` + // Relationships of the Jira issue to attach security findings to. + Relationships *AttachJiraIssueRequestDataRelationships `json:"relationships,omitempty"` + // Jira issues resource type. + Type JiraIssuesDataType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAttachJiraIssueRequestData instantiates a new AttachJiraIssueRequestData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAttachJiraIssueRequestData(typeVar JiraIssuesDataType) *AttachJiraIssueRequestData { + this := AttachJiraIssueRequestData{} + this.Type = typeVar + return &this +} + +// NewAttachJiraIssueRequestDataWithDefaults instantiates a new AttachJiraIssueRequestData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAttachJiraIssueRequestDataWithDefaults() *AttachJiraIssueRequestData { + this := AttachJiraIssueRequestData{} + var typeVar JiraIssuesDataType = JIRAISSUESDATATYPE_JIRA_ISSUES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *AttachJiraIssueRequestData) GetAttributes() AttachJiraIssueRequestDataAttributes { + if o == nil || o.Attributes == nil { + var ret AttachJiraIssueRequestDataAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AttachJiraIssueRequestData) GetAttributesOk() (*AttachJiraIssueRequestDataAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *AttachJiraIssueRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given AttachJiraIssueRequestDataAttributes and assigns it to the Attributes field. +func (o *AttachJiraIssueRequestData) SetAttributes(v AttachJiraIssueRequestDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AttachJiraIssueRequestData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AttachJiraIssueRequestData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *AttachJiraIssueRequestData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *AttachJiraIssueRequestData) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *AttachJiraIssueRequestData) GetRelationships() AttachJiraIssueRequestDataRelationships { + if o == nil || o.Relationships == nil { + var ret AttachJiraIssueRequestDataRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AttachJiraIssueRequestData) GetRelationshipsOk() (*AttachJiraIssueRequestDataRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *AttachJiraIssueRequestData) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given AttachJiraIssueRequestDataRelationships and assigns it to the Relationships field. +func (o *AttachJiraIssueRequestData) SetRelationships(v AttachJiraIssueRequestDataRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *AttachJiraIssueRequestData) GetType() JiraIssuesDataType { + if o == nil { + var ret JiraIssuesDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *AttachJiraIssueRequestData) GetTypeOk() (*JiraIssuesDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AttachJiraIssueRequestData) SetType(v JiraIssuesDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AttachJiraIssueRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AttachJiraIssueRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AttachJiraIssueRequestDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *AttachJiraIssueRequestDataRelationships `json:"relationships,omitempty"` + Type *JiraIssuesDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_attach_jira_issue_request_data_attributes.go b/api/datadogV2/model_attach_jira_issue_request_data_attributes.go new file mode 100644 index 00000000000..cc43d82b095 --- /dev/null +++ b/api/datadogV2/model_attach_jira_issue_request_data_attributes.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AttachJiraIssueRequestDataAttributes Attributes of the Jira issue to attach security findings to. +type AttachJiraIssueRequestDataAttributes struct { + // The URL of the Jira issue to attach security findings to. + JiraIssueUrl string `json:"jira_issue_url"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAttachJiraIssueRequestDataAttributes instantiates a new AttachJiraIssueRequestDataAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAttachJiraIssueRequestDataAttributes(jiraIssueUrl string) *AttachJiraIssueRequestDataAttributes { + this := AttachJiraIssueRequestDataAttributes{} + this.JiraIssueUrl = jiraIssueUrl + return &this +} + +// NewAttachJiraIssueRequestDataAttributesWithDefaults instantiates a new AttachJiraIssueRequestDataAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAttachJiraIssueRequestDataAttributesWithDefaults() *AttachJiraIssueRequestDataAttributes { + this := AttachJiraIssueRequestDataAttributes{} + return &this +} + +// GetJiraIssueUrl returns the JiraIssueUrl field value. +func (o *AttachJiraIssueRequestDataAttributes) GetJiraIssueUrl() string { + if o == nil { + var ret string + return ret + } + return o.JiraIssueUrl +} + +// GetJiraIssueUrlOk returns a tuple with the JiraIssueUrl field value +// and a boolean to check if the value has been set. +func (o *AttachJiraIssueRequestDataAttributes) GetJiraIssueUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.JiraIssueUrl, true +} + +// SetJiraIssueUrl sets field value. +func (o *AttachJiraIssueRequestDataAttributes) SetJiraIssueUrl(v string) { + o.JiraIssueUrl = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AttachJiraIssueRequestDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["jira_issue_url"] = o.JiraIssueUrl + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AttachJiraIssueRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + JiraIssueUrl *string `json:"jira_issue_url"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.JiraIssueUrl == nil { + return fmt.Errorf("required field jira_issue_url missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"jira_issue_url"}) + } else { + return err + } + o.JiraIssueUrl = *all.JiraIssueUrl + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_attach_jira_issue_request_data_relationships.go b/api/datadogV2/model_attach_jira_issue_request_data_relationships.go new file mode 100644 index 00000000000..26ff6239232 --- /dev/null +++ b/api/datadogV2/model_attach_jira_issue_request_data_relationships.go @@ -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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// AttachJiraIssueRequestDataRelationships Relationships of the Jira issue to attach security findings to. +type AttachJiraIssueRequestDataRelationships struct { + // A list of security findings. + Findings Findings `json:"findings"` + // Case management project. + Project CaseManagementProject `json:"project"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewAttachJiraIssueRequestDataRelationships instantiates a new AttachJiraIssueRequestDataRelationships object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewAttachJiraIssueRequestDataRelationships(findings Findings, project CaseManagementProject) *AttachJiraIssueRequestDataRelationships { + this := AttachJiraIssueRequestDataRelationships{} + this.Findings = findings + this.Project = project + return &this +} + +// NewAttachJiraIssueRequestDataRelationshipsWithDefaults instantiates a new AttachJiraIssueRequestDataRelationships object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewAttachJiraIssueRequestDataRelationshipsWithDefaults() *AttachJiraIssueRequestDataRelationships { + this := AttachJiraIssueRequestDataRelationships{} + return &this +} + +// GetFindings returns the Findings field value. +func (o *AttachJiraIssueRequestDataRelationships) GetFindings() Findings { + if o == nil { + var ret Findings + return ret + } + return o.Findings +} + +// GetFindingsOk returns a tuple with the Findings field value +// and a boolean to check if the value has been set. +func (o *AttachJiraIssueRequestDataRelationships) GetFindingsOk() (*Findings, bool) { + if o == nil { + return nil, false + } + return &o.Findings, true +} + +// SetFindings sets field value. +func (o *AttachJiraIssueRequestDataRelationships) SetFindings(v Findings) { + o.Findings = v +} + +// GetProject returns the Project field value. +func (o *AttachJiraIssueRequestDataRelationships) GetProject() CaseManagementProject { + if o == nil { + var ret CaseManagementProject + return ret + } + return o.Project +} + +// GetProjectOk returns a tuple with the Project field value +// and a boolean to check if the value has been set. +func (o *AttachJiraIssueRequestDataRelationships) GetProjectOk() (*CaseManagementProject, bool) { + if o == nil { + return nil, false + } + return &o.Project, true +} + +// SetProject sets field value. +func (o *AttachJiraIssueRequestDataRelationships) SetProject(v CaseManagementProject) { + o.Project = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AttachJiraIssueRequestDataRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["findings"] = o.Findings + toSerialize["project"] = o.Project + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AttachJiraIssueRequestDataRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Findings *Findings `json:"findings"` + Project *CaseManagementProject `json:"project"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Findings == nil { + return fmt.Errorf("required field findings missing") + } + if all.Project == nil { + return fmt.Errorf("required field project missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"findings", "project"}) + } else { + return err + } + + hasInvalidField := false + if all.Findings.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Findings = *all.Findings + if all.Project.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Project = *all.Project + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_case_data_type.go b/api/datadogV2/model_case_data_type.go new file mode 100644 index 00000000000..994cefe3a1a --- /dev/null +++ b/api/datadogV2/model_case_data_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CaseDataType Cases resource type. +type CaseDataType string + +// List of CaseDataType. +const ( + CASEDATATYPE_CASES CaseDataType = "cases" +) + +var allowedCaseDataTypeEnumValues = []CaseDataType{ + CASEDATATYPE_CASES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *CaseDataType) GetAllowedValues() []CaseDataType { + return allowedCaseDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *CaseDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = CaseDataType(value) + return nil +} + +// NewCaseDataTypeFromValue returns a pointer to a valid CaseDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewCaseDataTypeFromValue(v string) (*CaseDataType, error) { + ev := CaseDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for CaseDataType: valid values are %v", v, allowedCaseDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v CaseDataType) IsValid() bool { + for _, existing := range allowedCaseDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CaseDataType value. +func (v CaseDataType) Ptr() *CaseDataType { + return &v +} diff --git a/api/datadogV2/model_case_insights_items.go b/api/datadogV2/model_case_insights_items.go new file mode 100644 index 00000000000..b46f05556a8 --- /dev/null +++ b/api/datadogV2/model_case_insights_items.go @@ -0,0 +1,172 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CaseInsightsItems An insight of the case. +type CaseInsightsItems struct { + // The reference of the insight. + Ref *string `json:"ref,omitempty"` + // The unique identifier of the resource. For example, the unique identifier of a security finding. + ResourceId *string `json:"resource_id,omitempty"` + // The type of the resource. For example, the type of a security finding is "SECURITY_FINDING". + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCaseInsightsItems instantiates a new CaseInsightsItems object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCaseInsightsItems() *CaseInsightsItems { + this := CaseInsightsItems{} + return &this +} + +// NewCaseInsightsItemsWithDefaults instantiates a new CaseInsightsItems object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCaseInsightsItemsWithDefaults() *CaseInsightsItems { + this := CaseInsightsItems{} + return &this +} + +// GetRef returns the Ref field value if set, zero value otherwise. +func (o *CaseInsightsItems) GetRef() string { + if o == nil || o.Ref == nil { + var ret string + return ret + } + return *o.Ref +} + +// GetRefOk returns a tuple with the Ref field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseInsightsItems) GetRefOk() (*string, bool) { + if o == nil || o.Ref == nil { + return nil, false + } + return o.Ref, true +} + +// HasRef returns a boolean if a field has been set. +func (o *CaseInsightsItems) HasRef() bool { + return o != nil && o.Ref != nil +} + +// SetRef gets a reference to the given string and assigns it to the Ref field. +func (o *CaseInsightsItems) SetRef(v string) { + o.Ref = &v +} + +// GetResourceId returns the ResourceId field value if set, zero value otherwise. +func (o *CaseInsightsItems) GetResourceId() string { + if o == nil || o.ResourceId == nil { + var ret string + return ret + } + return *o.ResourceId +} + +// GetResourceIdOk returns a tuple with the ResourceId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseInsightsItems) GetResourceIdOk() (*string, bool) { + if o == nil || o.ResourceId == nil { + return nil, false + } + return o.ResourceId, true +} + +// HasResourceId returns a boolean if a field has been set. +func (o *CaseInsightsItems) HasResourceId() bool { + return o != nil && o.ResourceId != nil +} + +// SetResourceId gets a reference to the given string and assigns it to the ResourceId field. +func (o *CaseInsightsItems) SetResourceId(v string) { + o.ResourceId = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *CaseInsightsItems) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CaseInsightsItems) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *CaseInsightsItems) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *CaseInsightsItems) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CaseInsightsItems) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Ref != nil { + toSerialize["ref"] = o.Ref + } + if o.ResourceId != nil { + toSerialize["resource_id"] = o.ResourceId + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CaseInsightsItems) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Ref *string `json:"ref,omitempty"` + ResourceId *string `json:"resource_id,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"ref", "resource_id", "type"}) + } else { + return err + } + o.Ref = all.Ref + o.ResourceId = all.ResourceId + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_case_management_project.go b/api/datadogV2/model_case_management_project.go new file mode 100644 index 00000000000..527855cbb8c --- /dev/null +++ b/api/datadogV2/model_case_management_project.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CaseManagementProject Case management project. +type CaseManagementProject struct { + // + Data CaseManagementProjectData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCaseManagementProject instantiates a new CaseManagementProject object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCaseManagementProject(data CaseManagementProjectData) *CaseManagementProject { + this := CaseManagementProject{} + this.Data = data + return &this +} + +// NewCaseManagementProjectWithDefaults instantiates a new CaseManagementProject object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCaseManagementProjectWithDefaults() *CaseManagementProject { + this := CaseManagementProject{} + return &this +} + +// GetData returns the Data field value. +func (o *CaseManagementProject) GetData() CaseManagementProjectData { + if o == nil { + var ret CaseManagementProjectData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *CaseManagementProject) GetDataOk() (*CaseManagementProjectData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *CaseManagementProject) SetData(v CaseManagementProjectData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CaseManagementProject) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CaseManagementProject) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CaseManagementProjectData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_case_management_project_data.go b/api/datadogV2/model_case_management_project_data.go new file mode 100644 index 00000000000..5b0679d8e88 --- /dev/null +++ b/api/datadogV2/model_case_management_project_data.go @@ -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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CaseManagementProjectData +type CaseManagementProjectData struct { + // The unique identifier of the case management project. + Id string `json:"id"` + // Projects resource type. + Type CaseManagementProjectDataType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCaseManagementProjectData instantiates a new CaseManagementProjectData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCaseManagementProjectData(id string, typeVar CaseManagementProjectDataType) *CaseManagementProjectData { + this := CaseManagementProjectData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewCaseManagementProjectDataWithDefaults instantiates a new CaseManagementProjectData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCaseManagementProjectDataWithDefaults() *CaseManagementProjectData { + this := CaseManagementProjectData{} + var typeVar CaseManagementProjectDataType = CASEMANAGEMENTPROJECTDATATYPE_PROJECTS + this.Type = typeVar + return &this +} + +// GetId returns the Id field value. +func (o *CaseManagementProjectData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *CaseManagementProjectData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *CaseManagementProjectData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *CaseManagementProjectData) GetType() CaseManagementProjectDataType { + if o == nil { + var ret CaseManagementProjectDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *CaseManagementProjectData) GetTypeOk() (*CaseManagementProjectDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CaseManagementProjectData) SetType(v CaseManagementProjectDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CaseManagementProjectData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CaseManagementProjectData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id"` + Type *CaseManagementProjectDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) + } else { + return err + } + + hasInvalidField := false + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_case_management_project_data_type.go b/api/datadogV2/model_case_management_project_data_type.go new file mode 100644 index 00000000000..a1f376d046c --- /dev/null +++ b/api/datadogV2/model_case_management_project_data_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CaseManagementProjectDataType Projects resource type. +type CaseManagementProjectDataType string + +// List of CaseManagementProjectDataType. +const ( + CASEMANAGEMENTPROJECTDATATYPE_PROJECTS CaseManagementProjectDataType = "projects" +) + +var allowedCaseManagementProjectDataTypeEnumValues = []CaseManagementProjectDataType{ + CASEMANAGEMENTPROJECTDATATYPE_PROJECTS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *CaseManagementProjectDataType) GetAllowedValues() []CaseManagementProjectDataType { + return allowedCaseManagementProjectDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *CaseManagementProjectDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = CaseManagementProjectDataType(value) + return nil +} + +// NewCaseManagementProjectDataTypeFromValue returns a pointer to a valid CaseManagementProjectDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewCaseManagementProjectDataTypeFromValue(v string) (*CaseManagementProjectDataType, error) { + ev := CaseManagementProjectDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for CaseManagementProjectDataType: valid values are %v", v, allowedCaseManagementProjectDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v CaseManagementProjectDataType) IsValid() bool { + for _, existing := range allowedCaseManagementProjectDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to CaseManagementProjectDataType value. +func (v CaseManagementProjectDataType) Ptr() *CaseManagementProjectDataType { + return &v +} diff --git a/api/datadogV2/model_create_case_request_array.go b/api/datadogV2/model_create_case_request_array.go new file mode 100644 index 00000000000..b7bec14f232 --- /dev/null +++ b/api/datadogV2/model_create_case_request_array.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateCaseRequestArray List of requests to create cases for security findings. +type CreateCaseRequestArray struct { + // + Data []CreateCaseRequestData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCreateCaseRequestArray instantiates a new CreateCaseRequestArray object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCreateCaseRequestArray(data []CreateCaseRequestData) *CreateCaseRequestArray { + this := CreateCaseRequestArray{} + this.Data = data + return &this +} + +// NewCreateCaseRequestArrayWithDefaults instantiates a new CreateCaseRequestArray object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCreateCaseRequestArrayWithDefaults() *CreateCaseRequestArray { + this := CreateCaseRequestArray{} + return &this +} + +// GetData returns the Data field value. +func (o *CreateCaseRequestArray) GetData() []CreateCaseRequestData { + if o == nil { + var ret []CreateCaseRequestData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *CreateCaseRequestArray) GetDataOk() (*[]CreateCaseRequestData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *CreateCaseRequestArray) SetData(v []CreateCaseRequestData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateCaseRequestArray) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateCaseRequestArray) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]CreateCaseRequestData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_create_case_request_data.go b/api/datadogV2/model_create_case_request_data.go new file mode 100644 index 00000000000..f0da4b7ebe0 --- /dev/null +++ b/api/datadogV2/model_create_case_request_data.go @@ -0,0 +1,224 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateCaseRequestData Data of the case to create. +type CreateCaseRequestData struct { + // Attributes of the case to create. + Attributes *CreateCaseRequestDataAttributes `json:"attributes,omitempty"` + // The unique identifier of the case. + Id *string `json:"id,omitempty"` + // Relationships of the case to create. + Relationships *CreateCaseRequestDataRelationships `json:"relationships,omitempty"` + // Cases resource type. + Type CaseDataType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCreateCaseRequestData instantiates a new CreateCaseRequestData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCreateCaseRequestData(typeVar CaseDataType) *CreateCaseRequestData { + this := CreateCaseRequestData{} + this.Type = typeVar + return &this +} + +// NewCreateCaseRequestDataWithDefaults instantiates a new CreateCaseRequestData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCreateCaseRequestDataWithDefaults() *CreateCaseRequestData { + this := CreateCaseRequestData{} + var typeVar CaseDataType = CASEDATATYPE_CASES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *CreateCaseRequestData) GetAttributes() CreateCaseRequestDataAttributes { + if o == nil || o.Attributes == nil { + var ret CreateCaseRequestDataAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCaseRequestData) GetAttributesOk() (*CreateCaseRequestDataAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *CreateCaseRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given CreateCaseRequestDataAttributes and assigns it to the Attributes field. +func (o *CreateCaseRequestData) SetAttributes(v CreateCaseRequestDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateCaseRequestData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCaseRequestData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CreateCaseRequestData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateCaseRequestData) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *CreateCaseRequestData) GetRelationships() CreateCaseRequestDataRelationships { + if o == nil || o.Relationships == nil { + var ret CreateCaseRequestDataRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCaseRequestData) GetRelationshipsOk() (*CreateCaseRequestDataRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *CreateCaseRequestData) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given CreateCaseRequestDataRelationships and assigns it to the Relationships field. +func (o *CreateCaseRequestData) SetRelationships(v CreateCaseRequestDataRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *CreateCaseRequestData) GetType() CaseDataType { + if o == nil { + var ret CaseDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *CreateCaseRequestData) GetTypeOk() (*CaseDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CreateCaseRequestData) SetType(v CaseDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateCaseRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateCaseRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *CreateCaseRequestDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *CreateCaseRequestDataRelationships `json:"relationships,omitempty"` + Type *CaseDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_create_case_request_data_attributes.go b/api/datadogV2/model_create_case_request_data_attributes.go new file mode 100644 index 00000000000..8dc3db25828 --- /dev/null +++ b/api/datadogV2/model_create_case_request_data_attributes.go @@ -0,0 +1,221 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateCaseRequestDataAttributes Attributes of the case to create. +type CreateCaseRequestDataAttributes struct { + // The unique identifier of the user assigned to the case. + AssigneeId *string `json:"assignee_id,omitempty"` + // The description of the case. If not provided, the description will be automatically generated. + Description *string `json:"description,omitempty"` + // Case priority + Priority *CasePriority `json:"priority,omitempty"` + // The title of the case. If not provided, the title will be automatically generated. + Title *string `json:"title,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCreateCaseRequestDataAttributes instantiates a new CreateCaseRequestDataAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCreateCaseRequestDataAttributes() *CreateCaseRequestDataAttributes { + this := CreateCaseRequestDataAttributes{} + var priority CasePriority = CASEPRIORITY_NOT_DEFINED + this.Priority = &priority + return &this +} + +// NewCreateCaseRequestDataAttributesWithDefaults instantiates a new CreateCaseRequestDataAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCreateCaseRequestDataAttributesWithDefaults() *CreateCaseRequestDataAttributes { + this := CreateCaseRequestDataAttributes{} + var priority CasePriority = CASEPRIORITY_NOT_DEFINED + this.Priority = &priority + return &this +} + +// GetAssigneeId returns the AssigneeId field value if set, zero value otherwise. +func (o *CreateCaseRequestDataAttributes) GetAssigneeId() string { + if o == nil || o.AssigneeId == nil { + var ret string + return ret + } + return *o.AssigneeId +} + +// GetAssigneeIdOk returns a tuple with the AssigneeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCaseRequestDataAttributes) GetAssigneeIdOk() (*string, bool) { + if o == nil || o.AssigneeId == nil { + return nil, false + } + return o.AssigneeId, true +} + +// HasAssigneeId returns a boolean if a field has been set. +func (o *CreateCaseRequestDataAttributes) HasAssigneeId() bool { + return o != nil && o.AssigneeId != nil +} + +// SetAssigneeId gets a reference to the given string and assigns it to the AssigneeId field. +func (o *CreateCaseRequestDataAttributes) SetAssigneeId(v string) { + o.AssigneeId = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateCaseRequestDataAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCaseRequestDataAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateCaseRequestDataAttributes) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateCaseRequestDataAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetPriority returns the Priority field value if set, zero value otherwise. +func (o *CreateCaseRequestDataAttributes) GetPriority() CasePriority { + if o == nil || o.Priority == nil { + var ret CasePriority + return ret + } + return *o.Priority +} + +// GetPriorityOk returns a tuple with the Priority field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCaseRequestDataAttributes) GetPriorityOk() (*CasePriority, bool) { + if o == nil || o.Priority == nil { + return nil, false + } + return o.Priority, true +} + +// HasPriority returns a boolean if a field has been set. +func (o *CreateCaseRequestDataAttributes) HasPriority() bool { + return o != nil && o.Priority != nil +} + +// SetPriority gets a reference to the given CasePriority and assigns it to the Priority field. +func (o *CreateCaseRequestDataAttributes) SetPriority(v CasePriority) { + o.Priority = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *CreateCaseRequestDataAttributes) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCaseRequestDataAttributes) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *CreateCaseRequestDataAttributes) HasTitle() bool { + return o != nil && o.Title != nil +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *CreateCaseRequestDataAttributes) SetTitle(v string) { + o.Title = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateCaseRequestDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AssigneeId != nil { + toSerialize["assignee_id"] = o.AssigneeId + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.Priority != nil { + toSerialize["priority"] = o.Priority + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateCaseRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AssigneeId *string `json:"assignee_id,omitempty"` + Description *string `json:"description,omitempty"` + Priority *CasePriority `json:"priority,omitempty"` + Title *string `json:"title,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"assignee_id", "description", "priority", "title"}) + } else { + return err + } + + hasInvalidField := false + o.AssigneeId = all.AssigneeId + o.Description = all.Description + if all.Priority != nil && !all.Priority.IsValid() { + hasInvalidField = true + } else { + o.Priority = all.Priority + } + o.Title = all.Title + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_create_case_request_data_relationships.go b/api/datadogV2/model_create_case_request_data_relationships.go new file mode 100644 index 00000000000..0ae0e167a76 --- /dev/null +++ b/api/datadogV2/model_create_case_request_data_relationships.go @@ -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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateCaseRequestDataRelationships Relationships of the case to create. +type CreateCaseRequestDataRelationships struct { + // A list of security findings. + Findings Findings `json:"findings"` + // Case management project. + Project CaseManagementProject `json:"project"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCreateCaseRequestDataRelationships instantiates a new CreateCaseRequestDataRelationships object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCreateCaseRequestDataRelationships(findings Findings, project CaseManagementProject) *CreateCaseRequestDataRelationships { + this := CreateCaseRequestDataRelationships{} + this.Findings = findings + this.Project = project + return &this +} + +// NewCreateCaseRequestDataRelationshipsWithDefaults instantiates a new CreateCaseRequestDataRelationships object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCreateCaseRequestDataRelationshipsWithDefaults() *CreateCaseRequestDataRelationships { + this := CreateCaseRequestDataRelationships{} + return &this +} + +// GetFindings returns the Findings field value. +func (o *CreateCaseRequestDataRelationships) GetFindings() Findings { + if o == nil { + var ret Findings + return ret + } + return o.Findings +} + +// GetFindingsOk returns a tuple with the Findings field value +// and a boolean to check if the value has been set. +func (o *CreateCaseRequestDataRelationships) GetFindingsOk() (*Findings, bool) { + if o == nil { + return nil, false + } + return &o.Findings, true +} + +// SetFindings sets field value. +func (o *CreateCaseRequestDataRelationships) SetFindings(v Findings) { + o.Findings = v +} + +// GetProject returns the Project field value. +func (o *CreateCaseRequestDataRelationships) GetProject() CaseManagementProject { + if o == nil { + var ret CaseManagementProject + return ret + } + return o.Project +} + +// GetProjectOk returns a tuple with the Project field value +// and a boolean to check if the value has been set. +func (o *CreateCaseRequestDataRelationships) GetProjectOk() (*CaseManagementProject, bool) { + if o == nil { + return nil, false + } + return &o.Project, true +} + +// SetProject sets field value. +func (o *CreateCaseRequestDataRelationships) SetProject(v CaseManagementProject) { + o.Project = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateCaseRequestDataRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["findings"] = o.Findings + toSerialize["project"] = o.Project + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateCaseRequestDataRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Findings *Findings `json:"findings"` + Project *CaseManagementProject `json:"project"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Findings == nil { + return fmt.Errorf("required field findings missing") + } + if all.Project == nil { + return fmt.Errorf("required field project missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"findings", "project"}) + } else { + return err + } + + hasInvalidField := false + if all.Findings.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Findings = *all.Findings + if all.Project.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Project = *all.Project + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_create_jira_issue_request_array.go b/api/datadogV2/model_create_jira_issue_request_array.go new file mode 100644 index 00000000000..cb47934fe1c --- /dev/null +++ b/api/datadogV2/model_create_jira_issue_request_array.go @@ -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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateJiraIssueRequestArray List of requests to create Jira issues for security findings. +type CreateJiraIssueRequestArray struct { + // + Data []CreateJiraIssueRequestData `json:"data"` + // + Included []CreateJiraIssueRequestArrayIncluded `json:"included,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCreateJiraIssueRequestArray instantiates a new CreateJiraIssueRequestArray object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCreateJiraIssueRequestArray(data []CreateJiraIssueRequestData) *CreateJiraIssueRequestArray { + this := CreateJiraIssueRequestArray{} + this.Data = data + return &this +} + +// NewCreateJiraIssueRequestArrayWithDefaults instantiates a new CreateJiraIssueRequestArray object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCreateJiraIssueRequestArrayWithDefaults() *CreateJiraIssueRequestArray { + this := CreateJiraIssueRequestArray{} + return &this +} + +// GetData returns the Data field value. +func (o *CreateJiraIssueRequestArray) GetData() []CreateJiraIssueRequestData { + if o == nil { + var ret []CreateJiraIssueRequestData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *CreateJiraIssueRequestArray) GetDataOk() (*[]CreateJiraIssueRequestData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *CreateJiraIssueRequestArray) SetData(v []CreateJiraIssueRequestData) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *CreateJiraIssueRequestArray) GetIncluded() []CreateJiraIssueRequestArrayIncluded { + if o == nil || o.Included == nil { + var ret []CreateJiraIssueRequestArrayIncluded + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateJiraIssueRequestArray) GetIncludedOk() (*[]CreateJiraIssueRequestArrayIncluded, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *CreateJiraIssueRequestArray) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []CreateJiraIssueRequestArrayIncluded and assigns it to the Included field. +func (o *CreateJiraIssueRequestArray) SetIncluded(v []CreateJiraIssueRequestArrayIncluded) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateJiraIssueRequestArray) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + if o.Included != nil { + toSerialize["included"] = o.Included + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateJiraIssueRequestArray) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]CreateJiraIssueRequestData `json:"data"` + Included []CreateJiraIssueRequestArrayIncluded `json:"included,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included"}) + } else { + return err + } + o.Data = *all.Data + o.Included = all.Included + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_create_jira_issue_request_array_included.go b/api/datadogV2/model_create_jira_issue_request_array_included.go new file mode 100644 index 00000000000..d87c5a43475 --- /dev/null +++ b/api/datadogV2/model_create_jira_issue_request_array_included.go @@ -0,0 +1,137 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateJiraIssueRequestArrayIncluded - Attributes and relationships of the case linked to the Jira issue. Should contain all of the following: case, project, and security findings. +type CreateJiraIssueRequestArrayIncluded struct { + CreateCaseRequestData *CreateCaseRequestData + CaseManagementProjectData *CaseManagementProjectData + FindingData *FindingData + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// CreateCaseRequestDataAsCreateJiraIssueRequestArrayIncluded is a convenience function that returns CreateCaseRequestData wrapped in CreateJiraIssueRequestArrayIncluded. +func CreateCaseRequestDataAsCreateJiraIssueRequestArrayIncluded(v *CreateCaseRequestData) CreateJiraIssueRequestArrayIncluded { + return CreateJiraIssueRequestArrayIncluded{CreateCaseRequestData: v} +} + +// CaseManagementProjectDataAsCreateJiraIssueRequestArrayIncluded is a convenience function that returns CaseManagementProjectData wrapped in CreateJiraIssueRequestArrayIncluded. +func CaseManagementProjectDataAsCreateJiraIssueRequestArrayIncluded(v *CaseManagementProjectData) CreateJiraIssueRequestArrayIncluded { + return CreateJiraIssueRequestArrayIncluded{CaseManagementProjectData: v} +} + +// FindingDataAsCreateJiraIssueRequestArrayIncluded is a convenience function that returns FindingData wrapped in CreateJiraIssueRequestArrayIncluded. +func FindingDataAsCreateJiraIssueRequestArrayIncluded(v *FindingData) CreateJiraIssueRequestArrayIncluded { + return CreateJiraIssueRequestArrayIncluded{FindingData: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *CreateJiraIssueRequestArrayIncluded) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into CreateCaseRequestData + err = datadog.Unmarshal(data, &obj.CreateCaseRequestData) + if err == nil { + if obj.CreateCaseRequestData != nil && obj.CreateCaseRequestData.UnparsedObject == nil { + jsonCreateCaseRequestData, _ := datadog.Marshal(obj.CreateCaseRequestData) + if string(jsonCreateCaseRequestData) == "{}" { // empty struct + obj.CreateCaseRequestData = nil + } else { + match++ + } + } else { + obj.CreateCaseRequestData = nil + } + } else { + obj.CreateCaseRequestData = nil + } + + // try to unmarshal data into CaseManagementProjectData + err = datadog.Unmarshal(data, &obj.CaseManagementProjectData) + if err == nil { + if obj.CaseManagementProjectData != nil && obj.CaseManagementProjectData.UnparsedObject == nil { + jsonCaseManagementProjectData, _ := datadog.Marshal(obj.CaseManagementProjectData) + if string(jsonCaseManagementProjectData) == "{}" { // empty struct + obj.CaseManagementProjectData = nil + } else { + match++ + } + } else { + obj.CaseManagementProjectData = nil + } + } else { + obj.CaseManagementProjectData = nil + } + + // try to unmarshal data into FindingData + err = datadog.Unmarshal(data, &obj.FindingData) + if err == nil { + if obj.FindingData != nil && obj.FindingData.UnparsedObject == nil { + jsonFindingData, _ := datadog.Marshal(obj.FindingData) + if string(jsonFindingData) == "{}" { // empty struct + obj.FindingData = nil + } else { + match++ + } + } else { + obj.FindingData = nil + } + } else { + obj.FindingData = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.CreateCaseRequestData = nil + obj.CaseManagementProjectData = nil + obj.FindingData = nil + return datadog.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj CreateJiraIssueRequestArrayIncluded) MarshalJSON() ([]byte, error) { + if obj.CreateCaseRequestData != nil { + return datadog.Marshal(&obj.CreateCaseRequestData) + } + + if obj.CaseManagementProjectData != nil { + return datadog.Marshal(&obj.CaseManagementProjectData) + } + + if obj.FindingData != nil { + return datadog.Marshal(&obj.FindingData) + } + + if obj.UnparsedObject != nil { + return datadog.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *CreateJiraIssueRequestArrayIncluded) GetActualInstance() interface{} { + if obj.CreateCaseRequestData != nil { + return obj.CreateCaseRequestData + } + + if obj.CaseManagementProjectData != nil { + return obj.CaseManagementProjectData + } + + if obj.FindingData != nil { + return obj.FindingData + } + + // all schemas are nil + return nil +} diff --git a/api/datadogV2/model_create_jira_issue_request_data.go b/api/datadogV2/model_create_jira_issue_request_data.go new file mode 100644 index 00000000000..0e4d5f09434 --- /dev/null +++ b/api/datadogV2/model_create_jira_issue_request_data.go @@ -0,0 +1,224 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateJiraIssueRequestData Data of the Jira issue to create. +type CreateJiraIssueRequestData struct { + // Attributes of the Jira issue to create. + Attributes *CreateJiraIssueRequestDataAttributes `json:"attributes,omitempty"` + // The unique identifier of the Jira issue creation request. + Id *string `json:"id,omitempty"` + // Relationships of the Jira issue to create. + Relationships *CreateJiraIssueRequestDataRelationships `json:"relationships,omitempty"` + // Jira issues resource type. + Type JiraIssuesDataType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCreateJiraIssueRequestData instantiates a new CreateJiraIssueRequestData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCreateJiraIssueRequestData(typeVar JiraIssuesDataType) *CreateJiraIssueRequestData { + this := CreateJiraIssueRequestData{} + this.Type = typeVar + return &this +} + +// NewCreateJiraIssueRequestDataWithDefaults instantiates a new CreateJiraIssueRequestData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCreateJiraIssueRequestDataWithDefaults() *CreateJiraIssueRequestData { + this := CreateJiraIssueRequestData{} + var typeVar JiraIssuesDataType = JIRAISSUESDATATYPE_JIRA_ISSUES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *CreateJiraIssueRequestData) GetAttributes() CreateJiraIssueRequestDataAttributes { + if o == nil || o.Attributes == nil { + var ret CreateJiraIssueRequestDataAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateJiraIssueRequestData) GetAttributesOk() (*CreateJiraIssueRequestDataAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *CreateJiraIssueRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given CreateJiraIssueRequestDataAttributes and assigns it to the Attributes field. +func (o *CreateJiraIssueRequestData) SetAttributes(v CreateJiraIssueRequestDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateJiraIssueRequestData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateJiraIssueRequestData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *CreateJiraIssueRequestData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateJiraIssueRequestData) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *CreateJiraIssueRequestData) GetRelationships() CreateJiraIssueRequestDataRelationships { + if o == nil || o.Relationships == nil { + var ret CreateJiraIssueRequestDataRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateJiraIssueRequestData) GetRelationshipsOk() (*CreateJiraIssueRequestDataRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *CreateJiraIssueRequestData) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given CreateJiraIssueRequestDataRelationships and assigns it to the Relationships field. +func (o *CreateJiraIssueRequestData) SetRelationships(v CreateJiraIssueRequestDataRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *CreateJiraIssueRequestData) GetType() JiraIssuesDataType { + if o == nil { + var ret JiraIssuesDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *CreateJiraIssueRequestData) GetTypeOk() (*JiraIssuesDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CreateJiraIssueRequestData) SetType(v JiraIssuesDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateJiraIssueRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateJiraIssueRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *CreateJiraIssueRequestDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *CreateJiraIssueRequestDataRelationships `json:"relationships,omitempty"` + Type *JiraIssuesDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_create_jira_issue_request_data_attributes.go b/api/datadogV2/model_create_jira_issue_request_data_attributes.go new file mode 100644 index 00000000000..978c1468ade --- /dev/null +++ b/api/datadogV2/model_create_jira_issue_request_data_attributes.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateJiraIssueRequestDataAttributes Attributes of the Jira issue to create. +type CreateJiraIssueRequestDataAttributes struct { + // Custom fields of the Jira issue to create. For the list of available fields, see [Jira documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-createmeta-projectidorkey-issuetypes-issuetypeid-get). + Fields *CreateJiraIssueRequestDataAttributesFields `json:"fields,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCreateJiraIssueRequestDataAttributes instantiates a new CreateJiraIssueRequestDataAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCreateJiraIssueRequestDataAttributes() *CreateJiraIssueRequestDataAttributes { + this := CreateJiraIssueRequestDataAttributes{} + return &this +} + +// NewCreateJiraIssueRequestDataAttributesWithDefaults instantiates a new CreateJiraIssueRequestDataAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCreateJiraIssueRequestDataAttributesWithDefaults() *CreateJiraIssueRequestDataAttributes { + this := CreateJiraIssueRequestDataAttributes{} + return &this +} + +// GetFields returns the Fields field value if set, zero value otherwise. +func (o *CreateJiraIssueRequestDataAttributes) GetFields() CreateJiraIssueRequestDataAttributesFields { + if o == nil || o.Fields == nil { + var ret CreateJiraIssueRequestDataAttributesFields + return ret + } + return *o.Fields +} + +// GetFieldsOk returns a tuple with the Fields field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateJiraIssueRequestDataAttributes) GetFieldsOk() (*CreateJiraIssueRequestDataAttributesFields, bool) { + if o == nil || o.Fields == nil { + return nil, false + } + return o.Fields, true +} + +// HasFields returns a boolean if a field has been set. +func (o *CreateJiraIssueRequestDataAttributes) HasFields() bool { + return o != nil && o.Fields != nil +} + +// SetFields gets a reference to the given CreateJiraIssueRequestDataAttributesFields and assigns it to the Fields field. +func (o *CreateJiraIssueRequestDataAttributes) SetFields(v CreateJiraIssueRequestDataAttributesFields) { + o.Fields = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateJiraIssueRequestDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Fields != nil { + toSerialize["fields"] = o.Fields + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateJiraIssueRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Fields *CreateJiraIssueRequestDataAttributesFields `json:"fields,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"fields"}) + } else { + return err + } + + hasInvalidField := false + if all.Fields != nil && all.Fields.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Fields = all.Fields + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_create_jira_issue_request_data_attributes_fields.go b/api/datadogV2/model_create_jira_issue_request_data_attributes_fields.go new file mode 100644 index 00000000000..a7a327e7634 --- /dev/null +++ b/api/datadogV2/model_create_jira_issue_request_data_attributes_fields.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateJiraIssueRequestDataAttributesFields Custom fields of the Jira issue to create. For the list of available fields, see [Jira documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-createmeta-projectidorkey-issuetypes-issuetypeid-get). +type CreateJiraIssueRequestDataAttributesFields struct { + // + Fields interface{} `json:"fields,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCreateJiraIssueRequestDataAttributesFields instantiates a new CreateJiraIssueRequestDataAttributesFields object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCreateJiraIssueRequestDataAttributesFields() *CreateJiraIssueRequestDataAttributesFields { + this := CreateJiraIssueRequestDataAttributesFields{} + return &this +} + +// NewCreateJiraIssueRequestDataAttributesFieldsWithDefaults instantiates a new CreateJiraIssueRequestDataAttributesFields object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCreateJiraIssueRequestDataAttributesFieldsWithDefaults() *CreateJiraIssueRequestDataAttributesFields { + this := CreateJiraIssueRequestDataAttributesFields{} + return &this +} + +// GetFields returns the Fields field value if set, zero value otherwise. +func (o *CreateJiraIssueRequestDataAttributesFields) GetFields() interface{} { + if o == nil || o.Fields == nil { + var ret interface{} + return ret + } + return o.Fields +} + +// GetFieldsOk returns a tuple with the Fields field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateJiraIssueRequestDataAttributesFields) GetFieldsOk() (*interface{}, bool) { + if o == nil || o.Fields == nil { + return nil, false + } + return &o.Fields, true +} + +// HasFields returns a boolean if a field has been set. +func (o *CreateJiraIssueRequestDataAttributesFields) HasFields() bool { + return o != nil && o.Fields != nil +} + +// SetFields gets a reference to the given interface{} and assigns it to the Fields field. +func (o *CreateJiraIssueRequestDataAttributesFields) SetFields(v interface{}) { + o.Fields = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateJiraIssueRequestDataAttributesFields) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Fields != nil { + toSerialize["fields"] = o.Fields + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateJiraIssueRequestDataAttributesFields) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Fields interface{} `json:"fields,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"fields"}) + } else { + return err + } + o.Fields = all.Fields + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_create_jira_issue_request_data_relationships.go b/api/datadogV2/model_create_jira_issue_request_data_relationships.go new file mode 100644 index 00000000000..fbfe77c985f --- /dev/null +++ b/api/datadogV2/model_create_jira_issue_request_data_relationships.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateJiraIssueRequestDataRelationships Relationships of the Jira issue to create. +type CreateJiraIssueRequestDataRelationships struct { + // Case linked to the Jira issue. + Case CreateJiraIssueRequestDataRelationshipsCase `json:"case"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCreateJiraIssueRequestDataRelationships instantiates a new CreateJiraIssueRequestDataRelationships object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCreateJiraIssueRequestDataRelationships(caseVar CreateJiraIssueRequestDataRelationshipsCase) *CreateJiraIssueRequestDataRelationships { + this := CreateJiraIssueRequestDataRelationships{} + this.Case = caseVar + return &this +} + +// NewCreateJiraIssueRequestDataRelationshipsWithDefaults instantiates a new CreateJiraIssueRequestDataRelationships object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCreateJiraIssueRequestDataRelationshipsWithDefaults() *CreateJiraIssueRequestDataRelationships { + this := CreateJiraIssueRequestDataRelationships{} + return &this +} + +// GetCase returns the Case field value. +func (o *CreateJiraIssueRequestDataRelationships) GetCase() CreateJiraIssueRequestDataRelationshipsCase { + if o == nil { + var ret CreateJiraIssueRequestDataRelationshipsCase + return ret + } + return o.Case +} + +// GetCaseOk returns a tuple with the Case field value +// and a boolean to check if the value has been set. +func (o *CreateJiraIssueRequestDataRelationships) GetCaseOk() (*CreateJiraIssueRequestDataRelationshipsCase, bool) { + if o == nil { + return nil, false + } + return &o.Case, true +} + +// SetCase sets field value. +func (o *CreateJiraIssueRequestDataRelationships) SetCase(v CreateJiraIssueRequestDataRelationshipsCase) { + o.Case = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateJiraIssueRequestDataRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["case"] = o.Case + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateJiraIssueRequestDataRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Case *CreateJiraIssueRequestDataRelationshipsCase `json:"case"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Case == nil { + return fmt.Errorf("required field case missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"case"}) + } else { + return err + } + + hasInvalidField := false + if all.Case.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Case = *all.Case + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_create_jira_issue_request_data_relationships_case.go b/api/datadogV2/model_create_jira_issue_request_data_relationships_case.go new file mode 100644 index 00000000000..3046812c8fc --- /dev/null +++ b/api/datadogV2/model_create_jira_issue_request_data_relationships_case.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateJiraIssueRequestDataRelationshipsCase Case linked to the Jira issue. +type CreateJiraIssueRequestDataRelationshipsCase struct { + // Case linked to the Jira issue. + Data CreateJiraIssueRequestDataRelationshipsCaseData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCreateJiraIssueRequestDataRelationshipsCase instantiates a new CreateJiraIssueRequestDataRelationshipsCase object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCreateJiraIssueRequestDataRelationshipsCase(data CreateJiraIssueRequestDataRelationshipsCaseData) *CreateJiraIssueRequestDataRelationshipsCase { + this := CreateJiraIssueRequestDataRelationshipsCase{} + this.Data = data + return &this +} + +// NewCreateJiraIssueRequestDataRelationshipsCaseWithDefaults instantiates a new CreateJiraIssueRequestDataRelationshipsCase object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCreateJiraIssueRequestDataRelationshipsCaseWithDefaults() *CreateJiraIssueRequestDataRelationshipsCase { + this := CreateJiraIssueRequestDataRelationshipsCase{} + return &this +} + +// GetData returns the Data field value. +func (o *CreateJiraIssueRequestDataRelationshipsCase) GetData() CreateJiraIssueRequestDataRelationshipsCaseData { + if o == nil { + var ret CreateJiraIssueRequestDataRelationshipsCaseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *CreateJiraIssueRequestDataRelationshipsCase) GetDataOk() (*CreateJiraIssueRequestDataRelationshipsCaseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *CreateJiraIssueRequestDataRelationshipsCase) SetData(v CreateJiraIssueRequestDataRelationshipsCaseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateJiraIssueRequestDataRelationshipsCase) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateJiraIssueRequestDataRelationshipsCase) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *CreateJiraIssueRequestDataRelationshipsCaseData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_create_jira_issue_request_data_relationships_case_data.go b/api/datadogV2/model_create_jira_issue_request_data_relationships_case_data.go new file mode 100644 index 00000000000..5419401fd07 --- /dev/null +++ b/api/datadogV2/model_create_jira_issue_request_data_relationships_case_data.go @@ -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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// CreateJiraIssueRequestDataRelationshipsCaseData Case linked to the Jira issue. +type CreateJiraIssueRequestDataRelationshipsCaseData struct { + // + Id string `json:"id"` + // Cases resource type. + Type CaseDataType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewCreateJiraIssueRequestDataRelationshipsCaseData instantiates a new CreateJiraIssueRequestDataRelationshipsCaseData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewCreateJiraIssueRequestDataRelationshipsCaseData(id string, typeVar CaseDataType) *CreateJiraIssueRequestDataRelationshipsCaseData { + this := CreateJiraIssueRequestDataRelationshipsCaseData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewCreateJiraIssueRequestDataRelationshipsCaseDataWithDefaults instantiates a new CreateJiraIssueRequestDataRelationshipsCaseData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewCreateJiraIssueRequestDataRelationshipsCaseDataWithDefaults() *CreateJiraIssueRequestDataRelationshipsCaseData { + this := CreateJiraIssueRequestDataRelationshipsCaseData{} + var typeVar CaseDataType = CASEDATATYPE_CASES + this.Type = typeVar + return &this +} + +// GetId returns the Id field value. +func (o *CreateJiraIssueRequestDataRelationshipsCaseData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *CreateJiraIssueRequestDataRelationshipsCaseData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *CreateJiraIssueRequestDataRelationshipsCaseData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *CreateJiraIssueRequestDataRelationshipsCaseData) GetType() CaseDataType { + if o == nil { + var ret CaseDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *CreateJiraIssueRequestDataRelationshipsCaseData) GetTypeOk() (*CaseDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *CreateJiraIssueRequestDataRelationshipsCaseData) SetType(v CaseDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o CreateJiraIssueRequestDataRelationshipsCaseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *CreateJiraIssueRequestDataRelationshipsCaseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id"` + Type *CaseDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) + } else { + return err + } + + hasInvalidField := false + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_detach_case_request.go b/api/datadogV2/model_detach_case_request.go new file mode 100644 index 00000000000..a3a7a482e7b --- /dev/null +++ b/api/datadogV2/model_detach_case_request.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DetachCaseRequest Request for detaching security findings from their case. +type DetachCaseRequest struct { + // Data for detaching security findings from their case. + Data *DetachCaseRequestData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewDetachCaseRequest instantiates a new DetachCaseRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewDetachCaseRequest() *DetachCaseRequest { + this := DetachCaseRequest{} + return &this +} + +// NewDetachCaseRequestWithDefaults instantiates a new DetachCaseRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewDetachCaseRequestWithDefaults() *DetachCaseRequest { + this := DetachCaseRequest{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *DetachCaseRequest) GetData() DetachCaseRequestData { + if o == nil || o.Data == nil { + var ret DetachCaseRequestData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DetachCaseRequest) GetDataOk() (*DetachCaseRequestData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *DetachCaseRequest) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given DetachCaseRequestData and assigns it to the Data field. +func (o *DetachCaseRequest) SetData(v DetachCaseRequestData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DetachCaseRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DetachCaseRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *DetachCaseRequestData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_detach_case_request_data.go b/api/datadogV2/model_detach_case_request_data.go new file mode 100644 index 00000000000..9e2e9459340 --- /dev/null +++ b/api/datadogV2/model_detach_case_request_data.go @@ -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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DetachCaseRequestData Data for detaching security findings from their case. +type DetachCaseRequestData struct { + // The unique identifier of the detachment request. + Id *string `json:"id,omitempty"` + // Relationships detaching security findings from their case. + Relationships *DetachCaseRequestDataRelationships `json:"relationships,omitempty"` + // Cases resource type. + Type CaseDataType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewDetachCaseRequestData instantiates a new DetachCaseRequestData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewDetachCaseRequestData(typeVar CaseDataType) *DetachCaseRequestData { + this := DetachCaseRequestData{} + this.Type = typeVar + return &this +} + +// NewDetachCaseRequestDataWithDefaults instantiates a new DetachCaseRequestData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewDetachCaseRequestDataWithDefaults() *DetachCaseRequestData { + this := DetachCaseRequestData{} + var typeVar CaseDataType = CASEDATATYPE_CASES + this.Type = typeVar + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *DetachCaseRequestData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DetachCaseRequestData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *DetachCaseRequestData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *DetachCaseRequestData) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *DetachCaseRequestData) GetRelationships() DetachCaseRequestDataRelationships { + if o == nil || o.Relationships == nil { + var ret DetachCaseRequestDataRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DetachCaseRequestData) GetRelationshipsOk() (*DetachCaseRequestDataRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *DetachCaseRequestData) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given DetachCaseRequestDataRelationships and assigns it to the Relationships field. +func (o *DetachCaseRequestData) SetRelationships(v DetachCaseRequestDataRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *DetachCaseRequestData) GetType() CaseDataType { + if o == nil { + var ret CaseDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *DetachCaseRequestData) GetTypeOk() (*CaseDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *DetachCaseRequestData) SetType(v CaseDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DetachCaseRequestData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DetachCaseRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id,omitempty"` + Relationships *DetachCaseRequestDataRelationships `json:"relationships,omitempty"` + Type *CaseDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_detach_case_request_data_relationships.go b/api/datadogV2/model_detach_case_request_data_relationships.go new file mode 100644 index 00000000000..c2b036af6d4 --- /dev/null +++ b/api/datadogV2/model_detach_case_request_data_relationships.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// DetachCaseRequestDataRelationships Relationships detaching security findings from their case. +type DetachCaseRequestDataRelationships struct { + // A list of security findings. + Findings Findings `json:"findings"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewDetachCaseRequestDataRelationships instantiates a new DetachCaseRequestDataRelationships object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewDetachCaseRequestDataRelationships(findings Findings) *DetachCaseRequestDataRelationships { + this := DetachCaseRequestDataRelationships{} + this.Findings = findings + return &this +} + +// NewDetachCaseRequestDataRelationshipsWithDefaults instantiates a new DetachCaseRequestDataRelationships object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewDetachCaseRequestDataRelationshipsWithDefaults() *DetachCaseRequestDataRelationships { + this := DetachCaseRequestDataRelationships{} + return &this +} + +// GetFindings returns the Findings field value. +func (o *DetachCaseRequestDataRelationships) GetFindings() Findings { + if o == nil { + var ret Findings + return ret + } + return o.Findings +} + +// GetFindingsOk returns a tuple with the Findings field value +// and a boolean to check if the value has been set. +func (o *DetachCaseRequestDataRelationships) GetFindingsOk() (*Findings, bool) { + if o == nil { + return nil, false + } + return &o.Findings, true +} + +// SetFindings sets field value. +func (o *DetachCaseRequestDataRelationships) SetFindings(v Findings) { + o.Findings = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o DetachCaseRequestDataRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["findings"] = o.Findings + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *DetachCaseRequestDataRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Findings *Findings `json:"findings"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Findings == nil { + return fmt.Errorf("required field findings missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"findings"}) + } else { + return err + } + + hasInvalidField := false + if all.Findings.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Findings = *all.Findings + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_finding_case_response.go b/api/datadogV2/model_finding_case_response.go new file mode 100644 index 00000000000..a01a3504f41 --- /dev/null +++ b/api/datadogV2/model_finding_case_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FindingCaseResponse Case response. +type FindingCaseResponse struct { + // Data of the case. + Data *FindingCaseResponseData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFindingCaseResponse instantiates a new FindingCaseResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFindingCaseResponse() *FindingCaseResponse { + this := FindingCaseResponse{} + return &this +} + +// NewFindingCaseResponseWithDefaults instantiates a new FindingCaseResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFindingCaseResponseWithDefaults() *FindingCaseResponse { + this := FindingCaseResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *FindingCaseResponse) GetData() FindingCaseResponseData { + if o == nil || o.Data == nil { + var ret FindingCaseResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponse) GetDataOk() (*FindingCaseResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *FindingCaseResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given FindingCaseResponseData and assigns it to the Data field. +func (o *FindingCaseResponse) SetData(v FindingCaseResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FindingCaseResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FindingCaseResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *FindingCaseResponseData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_finding_case_response_array.go b/api/datadogV2/model_finding_case_response_array.go new file mode 100644 index 00000000000..73f92849e4b --- /dev/null +++ b/api/datadogV2/model_finding_case_response_array.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FindingCaseResponseArray List of case responses. +type FindingCaseResponseArray struct { + // + Data []FindingCaseResponseData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFindingCaseResponseArray instantiates a new FindingCaseResponseArray object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFindingCaseResponseArray(data []FindingCaseResponseData) *FindingCaseResponseArray { + this := FindingCaseResponseArray{} + this.Data = data + return &this +} + +// NewFindingCaseResponseArrayWithDefaults instantiates a new FindingCaseResponseArray object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFindingCaseResponseArrayWithDefaults() *FindingCaseResponseArray { + this := FindingCaseResponseArray{} + return &this +} + +// GetData returns the Data field value. +func (o *FindingCaseResponseArray) GetData() []FindingCaseResponseData { + if o == nil { + var ret []FindingCaseResponseData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseArray) GetDataOk() (*[]FindingCaseResponseData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *FindingCaseResponseArray) SetData(v []FindingCaseResponseData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FindingCaseResponseArray) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FindingCaseResponseArray) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]FindingCaseResponseData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_finding_case_response_data.go b/api/datadogV2/model_finding_case_response_data.go new file mode 100644 index 00000000000..26d542a87dd --- /dev/null +++ b/api/datadogV2/model_finding_case_response_data.go @@ -0,0 +1,224 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FindingCaseResponseData Data of the case. +type FindingCaseResponseData struct { + // Attributes of the case. + Attributes *FindingCaseResponseDataAttributes `json:"attributes,omitempty"` + // The unique identifier of the case. + Id *string `json:"id,omitempty"` + // Relationships of the case. + Relationships *FindingCaseResponseDataRelationships `json:"relationships,omitempty"` + // Cases resource type. + Type CaseDataType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFindingCaseResponseData instantiates a new FindingCaseResponseData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFindingCaseResponseData(typeVar CaseDataType) *FindingCaseResponseData { + this := FindingCaseResponseData{} + this.Type = typeVar + return &this +} + +// NewFindingCaseResponseDataWithDefaults instantiates a new FindingCaseResponseData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFindingCaseResponseDataWithDefaults() *FindingCaseResponseData { + this := FindingCaseResponseData{} + var typeVar CaseDataType = CASEDATATYPE_CASES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *FindingCaseResponseData) GetAttributes() FindingCaseResponseDataAttributes { + if o == nil || o.Attributes == nil { + var ret FindingCaseResponseDataAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseData) GetAttributesOk() (*FindingCaseResponseDataAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *FindingCaseResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given FindingCaseResponseDataAttributes and assigns it to the Attributes field. +func (o *FindingCaseResponseData) SetAttributes(v FindingCaseResponseDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *FindingCaseResponseData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *FindingCaseResponseData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *FindingCaseResponseData) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *FindingCaseResponseData) GetRelationships() FindingCaseResponseDataRelationships { + if o == nil || o.Relationships == nil { + var ret FindingCaseResponseDataRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseData) GetRelationshipsOk() (*FindingCaseResponseDataRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *FindingCaseResponseData) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given FindingCaseResponseDataRelationships and assigns it to the Relationships field. +func (o *FindingCaseResponseData) SetRelationships(v FindingCaseResponseDataRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *FindingCaseResponseData) GetType() CaseDataType { + if o == nil { + var ret CaseDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseData) GetTypeOk() (*CaseDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *FindingCaseResponseData) SetType(v CaseDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FindingCaseResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FindingCaseResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *FindingCaseResponseDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *FindingCaseResponseDataRelationships `json:"relationships,omitempty"` + Type *CaseDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_finding_case_response_data_attributes.go b/api/datadogV2/model_finding_case_response_data_attributes.go new file mode 100644 index 00000000000..b3052c3aae4 --- /dev/null +++ b/api/datadogV2/model_finding_case_response_data_attributes.go @@ -0,0 +1,727 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FindingCaseResponseDataAttributes Attributes of the case. +type FindingCaseResponseDataAttributes struct { + // Timestamp of when the case was archived. + ArchivedAt *time.Time `json:"archived_at,omitempty"` + // Relationship to user. + AssignedTo *RelationshipToUser `json:"assigned_to,omitempty"` + // + Attributes map[string][]string `json:"attributes,omitempty"` + // Timestamp of when the case was closed. + ClosedAt *time.Time `json:"closed_at,omitempty"` + // Timestamp of when the case was created. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Source of the case creation. + CreationSource *string `json:"creation_source,omitempty"` + // Description of the case. + Description *string `json:"description,omitempty"` + // Due date of the case. + DueDate *string `json:"due_date,omitempty"` + // Insights of the case. + Insights []CaseInsightsItems `json:"insights,omitempty"` + // Jira issue associated with the case. + JiraIssue *FindingJiraIssue `json:"jira_issue,omitempty"` + // Key of the case. + Key *string `json:"key,omitempty"` + // Timestamp of when the case was last modified. + ModifiedAt *time.Time `json:"modified_at,omitempty"` + // Priority of the case. + Priority *string `json:"priority,omitempty"` + // Status of the case. + Status *string `json:"status,omitempty"` + // Status group of the case. + StatusGroup *string `json:"status_group,omitempty"` + // Status name of the case. + StatusName *string `json:"status_name,omitempty"` + // Title of the case. + Title *string `json:"title,omitempty"` + // Type of the case. For security cases, this is always "SECURITY". + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFindingCaseResponseDataAttributes instantiates a new FindingCaseResponseDataAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFindingCaseResponseDataAttributes() *FindingCaseResponseDataAttributes { + this := FindingCaseResponseDataAttributes{} + return &this +} + +// NewFindingCaseResponseDataAttributesWithDefaults instantiates a new FindingCaseResponseDataAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFindingCaseResponseDataAttributesWithDefaults() *FindingCaseResponseDataAttributes { + this := FindingCaseResponseDataAttributes{} + return &this +} + +// GetArchivedAt returns the ArchivedAt field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetArchivedAt() time.Time { + if o == nil || o.ArchivedAt == nil { + var ret time.Time + return ret + } + return *o.ArchivedAt +} + +// GetArchivedAtOk returns a tuple with the ArchivedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetArchivedAtOk() (*time.Time, bool) { + if o == nil || o.ArchivedAt == nil { + return nil, false + } + return o.ArchivedAt, true +} + +// HasArchivedAt returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasArchivedAt() bool { + return o != nil && o.ArchivedAt != nil +} + +// SetArchivedAt gets a reference to the given time.Time and assigns it to the ArchivedAt field. +func (o *FindingCaseResponseDataAttributes) SetArchivedAt(v time.Time) { + o.ArchivedAt = &v +} + +// GetAssignedTo returns the AssignedTo field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetAssignedTo() RelationshipToUser { + if o == nil || o.AssignedTo == nil { + var ret RelationshipToUser + return ret + } + return *o.AssignedTo +} + +// GetAssignedToOk returns a tuple with the AssignedTo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetAssignedToOk() (*RelationshipToUser, bool) { + if o == nil || o.AssignedTo == nil { + return nil, false + } + return o.AssignedTo, true +} + +// HasAssignedTo returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasAssignedTo() bool { + return o != nil && o.AssignedTo != nil +} + +// SetAssignedTo gets a reference to the given RelationshipToUser and assigns it to the AssignedTo field. +func (o *FindingCaseResponseDataAttributes) SetAssignedTo(v RelationshipToUser) { + o.AssignedTo = &v +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetAttributes() map[string][]string { + if o == nil || o.Attributes == nil { + var ret map[string][]string + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetAttributesOk() (*map[string][]string, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return &o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given map[string][]string and assigns it to the Attributes field. +func (o *FindingCaseResponseDataAttributes) SetAttributes(v map[string][]string) { + o.Attributes = v +} + +// GetClosedAt returns the ClosedAt field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetClosedAt() time.Time { + if o == nil || o.ClosedAt == nil { + var ret time.Time + return ret + } + return *o.ClosedAt +} + +// GetClosedAtOk returns a tuple with the ClosedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetClosedAtOk() (*time.Time, bool) { + if o == nil || o.ClosedAt == nil { + return nil, false + } + return o.ClosedAt, true +} + +// HasClosedAt returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasClosedAt() bool { + return o != nil && o.ClosedAt != nil +} + +// SetClosedAt gets a reference to the given time.Time and assigns it to the ClosedAt field. +func (o *FindingCaseResponseDataAttributes) SetClosedAt(v time.Time) { + o.ClosedAt = &v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasCreatedAt() bool { + return o != nil && o.CreatedAt != nil +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *FindingCaseResponseDataAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetCreationSource returns the CreationSource field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetCreationSource() string { + if o == nil || o.CreationSource == nil { + var ret string + return ret + } + return *o.CreationSource +} + +// GetCreationSourceOk returns a tuple with the CreationSource field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetCreationSourceOk() (*string, bool) { + if o == nil || o.CreationSource == nil { + return nil, false + } + return o.CreationSource, true +} + +// HasCreationSource returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasCreationSource() bool { + return o != nil && o.CreationSource != nil +} + +// SetCreationSource gets a reference to the given string and assigns it to the CreationSource field. +func (o *FindingCaseResponseDataAttributes) SetCreationSource(v string) { + o.CreationSource = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetDescription() string { + if o == nil || o.Description == nil { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetDescriptionOk() (*string, bool) { + if o == nil || o.Description == nil { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasDescription() bool { + return o != nil && o.Description != nil +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *FindingCaseResponseDataAttributes) SetDescription(v string) { + o.Description = &v +} + +// GetDueDate returns the DueDate field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetDueDate() string { + if o == nil || o.DueDate == nil { + var ret string + return ret + } + return *o.DueDate +} + +// GetDueDateOk returns a tuple with the DueDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetDueDateOk() (*string, bool) { + if o == nil || o.DueDate == nil { + return nil, false + } + return o.DueDate, true +} + +// HasDueDate returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasDueDate() bool { + return o != nil && o.DueDate != nil +} + +// SetDueDate gets a reference to the given string and assigns it to the DueDate field. +func (o *FindingCaseResponseDataAttributes) SetDueDate(v string) { + o.DueDate = &v +} + +// GetInsights returns the Insights field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetInsights() []CaseInsightsItems { + if o == nil || o.Insights == nil { + var ret []CaseInsightsItems + return ret + } + return o.Insights +} + +// GetInsightsOk returns a tuple with the Insights field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetInsightsOk() (*[]CaseInsightsItems, bool) { + if o == nil || o.Insights == nil { + return nil, false + } + return &o.Insights, true +} + +// HasInsights returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasInsights() bool { + return o != nil && o.Insights != nil +} + +// SetInsights gets a reference to the given []CaseInsightsItems and assigns it to the Insights field. +func (o *FindingCaseResponseDataAttributes) SetInsights(v []CaseInsightsItems) { + o.Insights = v +} + +// GetJiraIssue returns the JiraIssue field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetJiraIssue() FindingJiraIssue { + if o == nil || o.JiraIssue == nil { + var ret FindingJiraIssue + return ret + } + return *o.JiraIssue +} + +// GetJiraIssueOk returns a tuple with the JiraIssue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetJiraIssueOk() (*FindingJiraIssue, bool) { + if o == nil || o.JiraIssue == nil { + return nil, false + } + return o.JiraIssue, true +} + +// HasJiraIssue returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasJiraIssue() bool { + return o != nil && o.JiraIssue != nil +} + +// SetJiraIssue gets a reference to the given FindingJiraIssue and assigns it to the JiraIssue field. +func (o *FindingCaseResponseDataAttributes) SetJiraIssue(v FindingJiraIssue) { + o.JiraIssue = &v +} + +// GetKey returns the Key field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetKey() string { + if o == nil || o.Key == nil { + var ret string + return ret + } + return *o.Key +} + +// GetKeyOk returns a tuple with the Key field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetKeyOk() (*string, bool) { + if o == nil || o.Key == nil { + return nil, false + } + return o.Key, true +} + +// HasKey returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasKey() bool { + return o != nil && o.Key != nil +} + +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *FindingCaseResponseDataAttributes) SetKey(v string) { + o.Key = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasModifiedAt() bool { + return o != nil && o.ModifiedAt != nil +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *FindingCaseResponseDataAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetPriority returns the Priority field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetPriority() string { + if o == nil || o.Priority == nil { + var ret string + return ret + } + return *o.Priority +} + +// GetPriorityOk returns a tuple with the Priority field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetPriorityOk() (*string, bool) { + if o == nil || o.Priority == nil { + return nil, false + } + return o.Priority, true +} + +// HasPriority returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasPriority() bool { + return o != nil && o.Priority != nil +} + +// SetPriority gets a reference to the given string and assigns it to the Priority field. +func (o *FindingCaseResponseDataAttributes) SetPriority(v string) { + o.Priority = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasStatus() bool { + return o != nil && o.Status != nil +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *FindingCaseResponseDataAttributes) SetStatus(v string) { + o.Status = &v +} + +// GetStatusGroup returns the StatusGroup field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetStatusGroup() string { + if o == nil || o.StatusGroup == nil { + var ret string + return ret + } + return *o.StatusGroup +} + +// GetStatusGroupOk returns a tuple with the StatusGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetStatusGroupOk() (*string, bool) { + if o == nil || o.StatusGroup == nil { + return nil, false + } + return o.StatusGroup, true +} + +// HasStatusGroup returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasStatusGroup() bool { + return o != nil && o.StatusGroup != nil +} + +// SetStatusGroup gets a reference to the given string and assigns it to the StatusGroup field. +func (o *FindingCaseResponseDataAttributes) SetStatusGroup(v string) { + o.StatusGroup = &v +} + +// GetStatusName returns the StatusName field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetStatusName() string { + if o == nil || o.StatusName == nil { + var ret string + return ret + } + return *o.StatusName +} + +// GetStatusNameOk returns a tuple with the StatusName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetStatusNameOk() (*string, bool) { + if o == nil || o.StatusName == nil { + return nil, false + } + return o.StatusName, true +} + +// HasStatusName returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasStatusName() bool { + return o != nil && o.StatusName != nil +} + +// SetStatusName gets a reference to the given string and assigns it to the StatusName field. +func (o *FindingCaseResponseDataAttributes) SetStatusName(v string) { + o.StatusName = &v +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetTitle() string { + if o == nil || o.Title == nil { + var ret string + return ret + } + return *o.Title +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetTitleOk() (*string, bool) { + if o == nil || o.Title == nil { + return nil, false + } + return o.Title, true +} + +// HasTitle returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasTitle() bool { + return o != nil && o.Title != nil +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *FindingCaseResponseDataAttributes) SetTitle(v string) { + o.Title = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *FindingCaseResponseDataAttributes) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataAttributes) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *FindingCaseResponseDataAttributes) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *FindingCaseResponseDataAttributes) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FindingCaseResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ArchivedAt != nil { + if o.ArchivedAt.Nanosecond() == 0 { + toSerialize["archived_at"] = o.ArchivedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["archived_at"] = o.ArchivedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.AssignedTo != nil { + toSerialize["assigned_to"] = o.AssignedTo + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.ClosedAt != nil { + if o.ClosedAt.Nanosecond() == 0 { + toSerialize["closed_at"] = o.ClosedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["closed_at"] = o.ClosedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.CreationSource != nil { + toSerialize["creation_source"] = o.CreationSource + } + if o.Description != nil { + toSerialize["description"] = o.Description + } + if o.DueDate != nil { + toSerialize["due_date"] = o.DueDate + } + if o.Insights != nil { + toSerialize["insights"] = o.Insights + } + if o.JiraIssue != nil { + toSerialize["jira_issue"] = o.JiraIssue + } + if o.Key != nil { + toSerialize["key"] = o.Key + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Priority != nil { + toSerialize["priority"] = o.Priority + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + if o.StatusGroup != nil { + toSerialize["status_group"] = o.StatusGroup + } + if o.StatusName != nil { + toSerialize["status_name"] = o.StatusName + } + if o.Title != nil { + toSerialize["title"] = o.Title + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FindingCaseResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ArchivedAt *time.Time `json:"archived_at,omitempty"` + AssignedTo *RelationshipToUser `json:"assigned_to,omitempty"` + Attributes map[string][]string `json:"attributes,omitempty"` + ClosedAt *time.Time `json:"closed_at,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + CreationSource *string `json:"creation_source,omitempty"` + Description *string `json:"description,omitempty"` + DueDate *string `json:"due_date,omitempty"` + Insights []CaseInsightsItems `json:"insights,omitempty"` + JiraIssue *FindingJiraIssue `json:"jira_issue,omitempty"` + Key *string `json:"key,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + Priority *string `json:"priority,omitempty"` + Status *string `json:"status,omitempty"` + StatusGroup *string `json:"status_group,omitempty"` + StatusName *string `json:"status_name,omitempty"` + Title *string `json:"title,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"archived_at", "assigned_to", "attributes", "closed_at", "created_at", "creation_source", "description", "due_date", "insights", "jira_issue", "key", "modified_at", "priority", "status", "status_group", "status_name", "title", "type"}) + } else { + return err + } + + hasInvalidField := false + o.ArchivedAt = all.ArchivedAt + if all.AssignedTo != nil && all.AssignedTo.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.AssignedTo = all.AssignedTo + o.Attributes = all.Attributes + o.ClosedAt = all.ClosedAt + o.CreatedAt = all.CreatedAt + o.CreationSource = all.CreationSource + o.Description = all.Description + o.DueDate = all.DueDate + o.Insights = all.Insights + if all.JiraIssue != nil && all.JiraIssue.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.JiraIssue = all.JiraIssue + o.Key = all.Key + o.ModifiedAt = all.ModifiedAt + o.Priority = all.Priority + o.Status = all.Status + o.StatusGroup = all.StatusGroup + o.StatusName = all.StatusName + o.Title = all.Title + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_finding_case_response_data_relationships.go b/api/datadogV2/model_finding_case_response_data_relationships.go new file mode 100644 index 00000000000..c1b33d60a24 --- /dev/null +++ b/api/datadogV2/model_finding_case_response_data_relationships.go @@ -0,0 +1,187 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FindingCaseResponseDataRelationships Relationships of the case. +type FindingCaseResponseDataRelationships struct { + // Relationship to user. + CreatedBy *RelationshipToUser `json:"created_by,omitempty"` + // Relationship to user. + ModifiedBy *RelationshipToUser `json:"modified_by,omitempty"` + // Case management project. + Project *CaseManagementProject `json:"project,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFindingCaseResponseDataRelationships instantiates a new FindingCaseResponseDataRelationships object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFindingCaseResponseDataRelationships() *FindingCaseResponseDataRelationships { + this := FindingCaseResponseDataRelationships{} + return &this +} + +// NewFindingCaseResponseDataRelationshipsWithDefaults instantiates a new FindingCaseResponseDataRelationships object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFindingCaseResponseDataRelationshipsWithDefaults() *FindingCaseResponseDataRelationships { + this := FindingCaseResponseDataRelationships{} + return &this +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *FindingCaseResponseDataRelationships) GetCreatedBy() RelationshipToUser { + if o == nil || o.CreatedBy == nil { + var ret RelationshipToUser + return ret + } + return *o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataRelationships) GetCreatedByOk() (*RelationshipToUser, bool) { + if o == nil || o.CreatedBy == nil { + return nil, false + } + return o.CreatedBy, true +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *FindingCaseResponseDataRelationships) HasCreatedBy() bool { + return o != nil && o.CreatedBy != nil +} + +// SetCreatedBy gets a reference to the given RelationshipToUser and assigns it to the CreatedBy field. +func (o *FindingCaseResponseDataRelationships) SetCreatedBy(v RelationshipToUser) { + o.CreatedBy = &v +} + +// GetModifiedBy returns the ModifiedBy field value if set, zero value otherwise. +func (o *FindingCaseResponseDataRelationships) GetModifiedBy() RelationshipToUser { + if o == nil || o.ModifiedBy == nil { + var ret RelationshipToUser + return ret + } + return *o.ModifiedBy +} + +// GetModifiedByOk returns a tuple with the ModifiedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataRelationships) GetModifiedByOk() (*RelationshipToUser, bool) { + if o == nil || o.ModifiedBy == nil { + return nil, false + } + return o.ModifiedBy, true +} + +// HasModifiedBy returns a boolean if a field has been set. +func (o *FindingCaseResponseDataRelationships) HasModifiedBy() bool { + return o != nil && o.ModifiedBy != nil +} + +// SetModifiedBy gets a reference to the given RelationshipToUser and assigns it to the ModifiedBy field. +func (o *FindingCaseResponseDataRelationships) SetModifiedBy(v RelationshipToUser) { + o.ModifiedBy = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *FindingCaseResponseDataRelationships) GetProject() CaseManagementProject { + if o == nil || o.Project == nil { + var ret CaseManagementProject + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingCaseResponseDataRelationships) GetProjectOk() (*CaseManagementProject, bool) { + if o == nil || o.Project == nil { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *FindingCaseResponseDataRelationships) HasProject() bool { + return o != nil && o.Project != nil +} + +// SetProject gets a reference to the given CaseManagementProject and assigns it to the Project field. +func (o *FindingCaseResponseDataRelationships) SetProject(v CaseManagementProject) { + o.Project = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FindingCaseResponseDataRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CreatedBy != nil { + toSerialize["created_by"] = o.CreatedBy + } + if o.ModifiedBy != nil { + toSerialize["modified_by"] = o.ModifiedBy + } + if o.Project != nil { + toSerialize["project"] = o.Project + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FindingCaseResponseDataRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedBy *RelationshipToUser `json:"created_by,omitempty"` + ModifiedBy *RelationshipToUser `json:"modified_by,omitempty"` + Project *CaseManagementProject `json:"project,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_by", "modified_by", "project"}) + } else { + return err + } + + hasInvalidField := false + if all.CreatedBy != nil && all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CreatedBy = all.CreatedBy + if all.ModifiedBy != nil && all.ModifiedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ModifiedBy = all.ModifiedBy + if all.Project != nil && all.Project.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Project = all.Project + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_finding_data.go b/api/datadogV2/model_finding_data.go new file mode 100644 index 00000000000..642ba90f003 --- /dev/null +++ b/api/datadogV2/model_finding_data.go @@ -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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FindingData +type FindingData struct { + // The unique identifier of the security finding. + Id string `json:"id"` + // Security findings resource type. + Type FindingDataType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFindingData instantiates a new FindingData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFindingData(id string, typeVar FindingDataType) *FindingData { + this := FindingData{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewFindingDataWithDefaults instantiates a new FindingData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFindingDataWithDefaults() *FindingData { + this := FindingData{} + var typeVar FindingDataType = FINDINGDATATYPE_FINDINGS + this.Type = typeVar + return &this +} + +// GetId returns the Id field value. +func (o *FindingData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *FindingData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *FindingData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *FindingData) GetType() FindingDataType { + if o == nil { + var ret FindingDataType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *FindingData) GetTypeOk() (*FindingDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *FindingData) SetType(v FindingDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FindingData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FindingData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id"` + Type *FindingDataType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) + } else { + return err + } + + hasInvalidField := false + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_finding_data_type.go b/api/datadogV2/model_finding_data_type.go new file mode 100644 index 00000000000..26955486e5e --- /dev/null +++ b/api/datadogV2/model_finding_data_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FindingDataType Security findings resource type. +type FindingDataType string + +// List of FindingDataType. +const ( + FINDINGDATATYPE_FINDINGS FindingDataType = "findings" +) + +var allowedFindingDataTypeEnumValues = []FindingDataType{ + FINDINGDATATYPE_FINDINGS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *FindingDataType) GetAllowedValues() []FindingDataType { + return allowedFindingDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *FindingDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = FindingDataType(value) + return nil +} + +// NewFindingDataTypeFromValue returns a pointer to a valid FindingDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewFindingDataTypeFromValue(v string) (*FindingDataType, error) { + ev := FindingDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for FindingDataType: valid values are %v", v, allowedFindingDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v FindingDataType) IsValid() bool { + for _, existing := range allowedFindingDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FindingDataType value. +func (v FindingDataType) Ptr() *FindingDataType { + return &v +} diff --git a/api/datadogV2/model_finding_jira_issue.go b/api/datadogV2/model_finding_jira_issue.go new file mode 100644 index 00000000000..6fbde7ece0c --- /dev/null +++ b/api/datadogV2/model_finding_jira_issue.go @@ -0,0 +1,181 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FindingJiraIssue Jira issue associated with the case. +type FindingJiraIssue struct { + // The error message if the Jira issue creation failed. + ErrorMessage *string `json:"error_message,omitempty"` + // Result of the Jira issue creation. + Result *FindingJiraIssueResult `json:"result,omitempty"` + // The status of the Jira issue creation. Can be "COMPLETED" if the Jira issue was created successfully, or "FAILED" if the Jira issue creation failed. + Status *string `json:"status,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFindingJiraIssue instantiates a new FindingJiraIssue object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFindingJiraIssue() *FindingJiraIssue { + this := FindingJiraIssue{} + return &this +} + +// NewFindingJiraIssueWithDefaults instantiates a new FindingJiraIssue object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFindingJiraIssueWithDefaults() *FindingJiraIssue { + this := FindingJiraIssue{} + return &this +} + +// GetErrorMessage returns the ErrorMessage field value if set, zero value otherwise. +func (o *FindingJiraIssue) GetErrorMessage() string { + if o == nil || o.ErrorMessage == nil { + var ret string + return ret + } + return *o.ErrorMessage +} + +// GetErrorMessageOk returns a tuple with the ErrorMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingJiraIssue) GetErrorMessageOk() (*string, bool) { + if o == nil || o.ErrorMessage == nil { + return nil, false + } + return o.ErrorMessage, true +} + +// HasErrorMessage returns a boolean if a field has been set. +func (o *FindingJiraIssue) HasErrorMessage() bool { + return o != nil && o.ErrorMessage != nil +} + +// SetErrorMessage gets a reference to the given string and assigns it to the ErrorMessage field. +func (o *FindingJiraIssue) SetErrorMessage(v string) { + o.ErrorMessage = &v +} + +// GetResult returns the Result field value if set, zero value otherwise. +func (o *FindingJiraIssue) GetResult() FindingJiraIssueResult { + if o == nil || o.Result == nil { + var ret FindingJiraIssueResult + return ret + } + return *o.Result +} + +// GetResultOk returns a tuple with the Result field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingJiraIssue) GetResultOk() (*FindingJiraIssueResult, bool) { + if o == nil || o.Result == nil { + return nil, false + } + return o.Result, true +} + +// HasResult returns a boolean if a field has been set. +func (o *FindingJiraIssue) HasResult() bool { + return o != nil && o.Result != nil +} + +// SetResult gets a reference to the given FindingJiraIssueResult and assigns it to the Result field. +func (o *FindingJiraIssue) SetResult(v FindingJiraIssueResult) { + o.Result = &v +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *FindingJiraIssue) GetStatus() string { + if o == nil || o.Status == nil { + var ret string + return ret + } + return *o.Status +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingJiraIssue) GetStatusOk() (*string, bool) { + if o == nil || o.Status == nil { + return nil, false + } + return o.Status, true +} + +// HasStatus returns a boolean if a field has been set. +func (o *FindingJiraIssue) HasStatus() bool { + return o != nil && o.Status != nil +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *FindingJiraIssue) SetStatus(v string) { + o.Status = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FindingJiraIssue) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ErrorMessage != nil { + toSerialize["error_message"] = o.ErrorMessage + } + if o.Result != nil { + toSerialize["result"] = o.Result + } + if o.Status != nil { + toSerialize["status"] = o.Status + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FindingJiraIssue) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ErrorMessage *string `json:"error_message,omitempty"` + Result *FindingJiraIssueResult `json:"result,omitempty"` + Status *string `json:"status,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"error_message", "result", "status"}) + } else { + return err + } + + hasInvalidField := false + o.ErrorMessage = all.ErrorMessage + if all.Result != nil && all.Result.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Result = all.Result + o.Status = all.Status + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_finding_jira_issue_result.go b/api/datadogV2/model_finding_jira_issue_result.go new file mode 100644 index 00000000000..34ad824da1b --- /dev/null +++ b/api/datadogV2/model_finding_jira_issue_result.go @@ -0,0 +1,207 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// FindingJiraIssueResult Result of the Jira issue creation. +type FindingJiraIssueResult struct { + // The account ID of the Jira issue. + AccountId *string `json:"account_id,omitempty"` + // The unique identifier of the Jira issue. + IssueId *string `json:"issue_id,omitempty"` + // The key of the Jira issue. + IssueKey *string `json:"issue_key,omitempty"` + // The URL of the Jira issue. + IssueUrl *string `json:"issue_url,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFindingJiraIssueResult instantiates a new FindingJiraIssueResult object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFindingJiraIssueResult() *FindingJiraIssueResult { + this := FindingJiraIssueResult{} + return &this +} + +// NewFindingJiraIssueResultWithDefaults instantiates a new FindingJiraIssueResult object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFindingJiraIssueResultWithDefaults() *FindingJiraIssueResult { + this := FindingJiraIssueResult{} + return &this +} + +// GetAccountId returns the AccountId field value if set, zero value otherwise. +func (o *FindingJiraIssueResult) GetAccountId() string { + if o == nil || o.AccountId == nil { + var ret string + return ret + } + return *o.AccountId +} + +// GetAccountIdOk returns a tuple with the AccountId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingJiraIssueResult) GetAccountIdOk() (*string, bool) { + if o == nil || o.AccountId == nil { + return nil, false + } + return o.AccountId, true +} + +// HasAccountId returns a boolean if a field has been set. +func (o *FindingJiraIssueResult) HasAccountId() bool { + return o != nil && o.AccountId != nil +} + +// SetAccountId gets a reference to the given string and assigns it to the AccountId field. +func (o *FindingJiraIssueResult) SetAccountId(v string) { + o.AccountId = &v +} + +// GetIssueId returns the IssueId field value if set, zero value otherwise. +func (o *FindingJiraIssueResult) GetIssueId() string { + if o == nil || o.IssueId == nil { + var ret string + return ret + } + return *o.IssueId +} + +// GetIssueIdOk returns a tuple with the IssueId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingJiraIssueResult) GetIssueIdOk() (*string, bool) { + if o == nil || o.IssueId == nil { + return nil, false + } + return o.IssueId, true +} + +// HasIssueId returns a boolean if a field has been set. +func (o *FindingJiraIssueResult) HasIssueId() bool { + return o != nil && o.IssueId != nil +} + +// SetIssueId gets a reference to the given string and assigns it to the IssueId field. +func (o *FindingJiraIssueResult) SetIssueId(v string) { + o.IssueId = &v +} + +// GetIssueKey returns the IssueKey field value if set, zero value otherwise. +func (o *FindingJiraIssueResult) GetIssueKey() string { + if o == nil || o.IssueKey == nil { + var ret string + return ret + } + return *o.IssueKey +} + +// GetIssueKeyOk returns a tuple with the IssueKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingJiraIssueResult) GetIssueKeyOk() (*string, bool) { + if o == nil || o.IssueKey == nil { + return nil, false + } + return o.IssueKey, true +} + +// HasIssueKey returns a boolean if a field has been set. +func (o *FindingJiraIssueResult) HasIssueKey() bool { + return o != nil && o.IssueKey != nil +} + +// SetIssueKey gets a reference to the given string and assigns it to the IssueKey field. +func (o *FindingJiraIssueResult) SetIssueKey(v string) { + o.IssueKey = &v +} + +// GetIssueUrl returns the IssueUrl field value if set, zero value otherwise. +func (o *FindingJiraIssueResult) GetIssueUrl() string { + if o == nil || o.IssueUrl == nil { + var ret string + return ret + } + return *o.IssueUrl +} + +// GetIssueUrlOk returns a tuple with the IssueUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *FindingJiraIssueResult) GetIssueUrlOk() (*string, bool) { + if o == nil || o.IssueUrl == nil { + return nil, false + } + return o.IssueUrl, true +} + +// HasIssueUrl returns a boolean if a field has been set. +func (o *FindingJiraIssueResult) HasIssueUrl() bool { + return o != nil && o.IssueUrl != nil +} + +// SetIssueUrl gets a reference to the given string and assigns it to the IssueUrl field. +func (o *FindingJiraIssueResult) SetIssueUrl(v string) { + o.IssueUrl = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o FindingJiraIssueResult) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AccountId != nil { + toSerialize["account_id"] = o.AccountId + } + if o.IssueId != nil { + toSerialize["issue_id"] = o.IssueId + } + if o.IssueKey != nil { + toSerialize["issue_key"] = o.IssueKey + } + if o.IssueUrl != nil { + toSerialize["issue_url"] = o.IssueUrl + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *FindingJiraIssueResult) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AccountId *string `json:"account_id,omitempty"` + IssueId *string `json:"issue_id,omitempty"` + IssueKey *string `json:"issue_key,omitempty"` + IssueUrl *string `json:"issue_url,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"account_id", "issue_id", "issue_key", "issue_url"}) + } else { + return err + } + o.AccountId = all.AccountId + o.IssueId = all.IssueId + o.IssueKey = all.IssueKey + o.IssueUrl = all.IssueUrl + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_findings.go b/api/datadogV2/model_findings.go new file mode 100644 index 00000000000..7c0941a90c6 --- /dev/null +++ b/api/datadogV2/model_findings.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// Findings A list of security findings. +type Findings struct { + // + Data []FindingData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewFindings instantiates a new Findings object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewFindings() *Findings { + this := Findings{} + return &this +} + +// NewFindingsWithDefaults instantiates a new Findings object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewFindingsWithDefaults() *Findings { + this := Findings{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *Findings) GetData() []FindingData { + if o == nil || o.Data == nil { + var ret []FindingData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Findings) GetDataOk() (*[]FindingData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *Findings) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []FindingData and assigns it to the Data field. +func (o *Findings) SetData(v []FindingData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o Findings) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *Findings) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data []FindingData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_jira_issues_data_type.go b/api/datadogV2/model_jira_issues_data_type.go new file mode 100644 index 00000000000..7cb6b8bffad --- /dev/null +++ b/api/datadogV2/model_jira_issues_data_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// JiraIssuesDataType Jira issues resource type. +type JiraIssuesDataType string + +// List of JiraIssuesDataType. +const ( + JIRAISSUESDATATYPE_JIRA_ISSUES JiraIssuesDataType = "jira_issues" +) + +var allowedJiraIssuesDataTypeEnumValues = []JiraIssuesDataType{ + JIRAISSUESDATATYPE_JIRA_ISSUES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *JiraIssuesDataType) GetAllowedValues() []JiraIssuesDataType { + return allowedJiraIssuesDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *JiraIssuesDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = JiraIssuesDataType(value) + return nil +} + +// NewJiraIssuesDataTypeFromValue returns a pointer to a valid JiraIssuesDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewJiraIssuesDataTypeFromValue(v string) (*JiraIssuesDataType, error) { + ev := JiraIssuesDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for JiraIssuesDataType: valid values are %v", v, allowedJiraIssuesDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v JiraIssuesDataType) IsValid() bool { + for _, existing := range allowedJiraIssuesDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to JiraIssuesDataType value. +func (v JiraIssuesDataType) Ptr() *JiraIssuesDataType { + return &v +} diff --git a/api/datadogV2/model_relationship_to_user_team_permission.go b/api/datadogV2/model_relationship_to_user_team_permission.go index ea13a1344f6..30dbb638065 100644 --- a/api/datadogV2/model_relationship_to_user_team_permission.go +++ b/api/datadogV2/model_relationship_to_user_team_permission.go @@ -11,7 +11,7 @@ import ( // RelationshipToUserTeamPermission Relationship between a user team permission and a team type RelationshipToUserTeamPermission struct { // Related user team permission data - Data *RelationshipToUserTeamPermissionData `json:"data,omitempty"` + Data NullableRelationshipToUserTeamPermissionData `json:"data,omitempty"` // Links attributes. Links *TeamRelationshipsLinks `json:"links,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct @@ -36,32 +36,43 @@ func NewRelationshipToUserTeamPermissionWithDefaults() *RelationshipToUserTeamPe return &this } -// GetData returns the Data field value if set, zero value otherwise. +// GetData returns the Data field value if set, zero value otherwise (both if not set or set to explicit null). func (o *RelationshipToUserTeamPermission) GetData() RelationshipToUserTeamPermissionData { - if o == nil || o.Data == nil { + if o == nil || o.Data.Get() == nil { var ret RelationshipToUserTeamPermissionData return ret } - return *o.Data + return *o.Data.Get() } // GetDataOk returns a tuple with the Data field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. func (o *RelationshipToUserTeamPermission) GetDataOk() (*RelationshipToUserTeamPermissionData, bool) { - if o == nil || o.Data == nil { + if o == nil { return nil, false } - return o.Data, true + return o.Data.Get(), o.Data.IsSet() } // HasData returns a boolean if a field has been set. func (o *RelationshipToUserTeamPermission) HasData() bool { - return o != nil && o.Data != nil + return o != nil && o.Data.IsSet() } -// SetData gets a reference to the given RelationshipToUserTeamPermissionData and assigns it to the Data field. +// SetData gets a reference to the given NullableRelationshipToUserTeamPermissionData and assigns it to the Data field. func (o *RelationshipToUserTeamPermission) SetData(v RelationshipToUserTeamPermissionData) { - o.Data = &v + o.Data.Set(&v) +} + +// SetDataNil sets the value for Data to be an explicit nil. +func (o *RelationshipToUserTeamPermission) SetDataNil() { + o.Data.Set(nil) +} + +// UnsetData ensures that no value is present for Data, not even an explicit nil. +func (o *RelationshipToUserTeamPermission) UnsetData() { + o.Data.Unset() } // GetLinks returns the Links field value if set, zero value otherwise. @@ -98,8 +109,8 @@ func (o RelationshipToUserTeamPermission) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } - if o.Data != nil { - toSerialize["data"] = o.Data + if o.Data.IsSet() { + toSerialize["data"] = o.Data.Get() } if o.Links != nil { toSerialize["links"] = o.Links @@ -114,8 +125,8 @@ func (o RelationshipToUserTeamPermission) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToUserTeamPermission) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Data *RelationshipToUserTeamPermissionData `json:"data,omitempty"` - Links *TeamRelationshipsLinks `json:"links,omitempty"` + Data NullableRelationshipToUserTeamPermissionData `json:"data,omitempty"` + Links *TeamRelationshipsLinks `json:"links,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) @@ -128,9 +139,6 @@ func (o *RelationshipToUserTeamPermission) UnmarshalJSON(bytes []byte) (err erro } hasInvalidField := false - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } o.Data = all.Data if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true diff --git a/api/datadogV2/model_relationship_to_user_team_permission_data.go b/api/datadogV2/model_relationship_to_user_team_permission_data.go index 1573862c013..b7527ca83c3 100644 --- a/api/datadogV2/model_relationship_to_user_team_permission_data.go +++ b/api/datadogV2/model_relationship_to_user_team_permission_data.go @@ -143,3 +143,53 @@ func (o *RelationshipToUserTeamPermissionData) UnmarshalJSON(bytes []byte) (err return nil } + +// NullableRelationshipToUserTeamPermissionData handles when a null is used for RelationshipToUserTeamPermissionData. +type NullableRelationshipToUserTeamPermissionData struct { + value *RelationshipToUserTeamPermissionData + isSet bool +} + +// Get returns the associated value. +func (v NullableRelationshipToUserTeamPermissionData) Get() *RelationshipToUserTeamPermissionData { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableRelationshipToUserTeamPermissionData) Set(val *RelationshipToUserTeamPermissionData) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableRelationshipToUserTeamPermissionData) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableRelationshipToUserTeamPermissionData) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableRelationshipToUserTeamPermissionData initializes the struct as if Set has been called. +func NewNullableRelationshipToUserTeamPermissionData(val *RelationshipToUserTeamPermissionData) *NullableRelationshipToUserTeamPermissionData { + return &NullableRelationshipToUserTeamPermissionData{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableRelationshipToUserTeamPermissionData) MarshalJSON() ([]byte, error) { + return datadog.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableRelationshipToUserTeamPermissionData) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return datadog.Unmarshal(src, &v.value) +} diff --git a/api/datadogV2/model_team_attributes.go b/api/datadogV2/model_team_attributes.go index f212fc66acc..04cde898aa0 100644 --- a/api/datadogV2/model_team_attributes.go +++ b/api/datadogV2/model_team_attributes.go @@ -24,7 +24,9 @@ type TeamAttributes struct { // The team's identifier Handle string `json:"handle"` // Collection of hidden modules for the team - HiddenModules []string `json:"hidden_modules,omitempty"` + HiddenModules datadog.NullableList[string] `json:"hidden_modules,omitempty"` + // Whether the team is managed from an external source + IsManaged *bool `json:"is_managed,omitempty"` // The number of links belonging to the team LinkCount *int32 `json:"link_count,omitempty"` // Modification date of the team @@ -36,7 +38,7 @@ type TeamAttributes struct { // The number of users belonging to the team UserCount *int32 `json:"user_count,omitempty"` // Collection of visible modules for the team - VisibleModules []string `json:"visible_modules,omitempty"` + VisibleModules datadog.NullableList[string] `json:"visible_modules,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -229,32 +231,71 @@ func (o *TeamAttributes) SetHandle(v string) { o.Handle = v } -// GetHiddenModules returns the HiddenModules field value if set, zero value otherwise. +// GetHiddenModules returns the HiddenModules field value if set, zero value otherwise (both if not set or set to explicit null). func (o *TeamAttributes) GetHiddenModules() []string { - if o == nil || o.HiddenModules == nil { + if o == nil || o.HiddenModules.Get() == nil { var ret []string return ret } - return o.HiddenModules + return *o.HiddenModules.Get() } // GetHiddenModulesOk returns a tuple with the HiddenModules field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. func (o *TeamAttributes) GetHiddenModulesOk() (*[]string, bool) { - if o == nil || o.HiddenModules == nil { + if o == nil { return nil, false } - return &o.HiddenModules, true + return o.HiddenModules.Get(), o.HiddenModules.IsSet() } // HasHiddenModules returns a boolean if a field has been set. func (o *TeamAttributes) HasHiddenModules() bool { - return o != nil && o.HiddenModules != nil + return o != nil && o.HiddenModules.IsSet() } -// SetHiddenModules gets a reference to the given []string and assigns it to the HiddenModules field. +// SetHiddenModules gets a reference to the given datadog.NullableList[string] and assigns it to the HiddenModules field. func (o *TeamAttributes) SetHiddenModules(v []string) { - o.HiddenModules = v + o.HiddenModules.Set(&v) +} + +// SetHiddenModulesNil sets the value for HiddenModules to be an explicit nil. +func (o *TeamAttributes) SetHiddenModulesNil() { + o.HiddenModules.Set(nil) +} + +// UnsetHiddenModules ensures that no value is present for HiddenModules, not even an explicit nil. +func (o *TeamAttributes) UnsetHiddenModules() { + o.HiddenModules.Unset() +} + +// GetIsManaged returns the IsManaged field value if set, zero value otherwise. +func (o *TeamAttributes) GetIsManaged() bool { + if o == nil || o.IsManaged == nil { + var ret bool + return ret + } + return *o.IsManaged +} + +// GetIsManagedOk returns a tuple with the IsManaged field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamAttributes) GetIsManagedOk() (*bool, bool) { + if o == nil || o.IsManaged == nil { + return nil, false + } + return o.IsManaged, true +} + +// HasIsManaged returns a boolean if a field has been set. +func (o *TeamAttributes) HasIsManaged() bool { + return o != nil && o.IsManaged != nil +} + +// SetIsManaged gets a reference to the given bool and assigns it to the IsManaged field. +func (o *TeamAttributes) SetIsManaged(v bool) { + o.IsManaged = &v } // GetLinkCount returns the LinkCount field value if set, zero value otherwise. @@ -403,32 +444,43 @@ func (o *TeamAttributes) SetUserCount(v int32) { o.UserCount = &v } -// GetVisibleModules returns the VisibleModules field value if set, zero value otherwise. +// GetVisibleModules returns the VisibleModules field value if set, zero value otherwise (both if not set or set to explicit null). func (o *TeamAttributes) GetVisibleModules() []string { - if o == nil || o.VisibleModules == nil { + if o == nil || o.VisibleModules.Get() == nil { var ret []string return ret } - return o.VisibleModules + return *o.VisibleModules.Get() } // GetVisibleModulesOk returns a tuple with the VisibleModules field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. func (o *TeamAttributes) GetVisibleModulesOk() (*[]string, bool) { - if o == nil || o.VisibleModules == nil { + if o == nil { return nil, false } - return &o.VisibleModules, true + return o.VisibleModules.Get(), o.VisibleModules.IsSet() } // HasVisibleModules returns a boolean if a field has been set. func (o *TeamAttributes) HasVisibleModules() bool { - return o != nil && o.VisibleModules != nil + return o != nil && o.VisibleModules.IsSet() } -// SetVisibleModules gets a reference to the given []string and assigns it to the VisibleModules field. +// SetVisibleModules gets a reference to the given datadog.NullableList[string] and assigns it to the VisibleModules field. func (o *TeamAttributes) SetVisibleModules(v []string) { - o.VisibleModules = v + o.VisibleModules.Set(&v) +} + +// SetVisibleModulesNil sets the value for VisibleModules to be an explicit nil. +func (o *TeamAttributes) SetVisibleModulesNil() { + o.VisibleModules.Set(nil) +} + +// UnsetVisibleModules ensures that no value is present for VisibleModules, not even an explicit nil. +func (o *TeamAttributes) UnsetVisibleModules() { + o.VisibleModules.Unset() } // MarshalJSON serializes the struct using spec logic. @@ -454,8 +506,11 @@ func (o TeamAttributes) MarshalJSON() ([]byte, error) { toSerialize["description"] = o.Description.Get() } toSerialize["handle"] = o.Handle - if o.HiddenModules != nil { - toSerialize["hidden_modules"] = o.HiddenModules + if o.HiddenModules.IsSet() { + toSerialize["hidden_modules"] = o.HiddenModules.Get() + } + if o.IsManaged != nil { + toSerialize["is_managed"] = o.IsManaged } if o.LinkCount != nil { toSerialize["link_count"] = o.LinkCount @@ -474,8 +529,8 @@ func (o TeamAttributes) MarshalJSON() ([]byte, error) { if o.UserCount != nil { toSerialize["user_count"] = o.UserCount } - if o.VisibleModules != nil { - toSerialize["visible_modules"] = o.VisibleModules + if o.VisibleModules.IsSet() { + toSerialize["visible_modules"] = o.VisibleModules.Get() } for key, value := range o.AdditionalProperties { @@ -487,18 +542,19 @@ func (o TeamAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Avatar datadog.NullableString `json:"avatar,omitempty"` - Banner datadog.NullableInt64 `json:"banner,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - Description datadog.NullableString `json:"description,omitempty"` - Handle *string `json:"handle"` - HiddenModules []string `json:"hidden_modules,omitempty"` - LinkCount *int32 `json:"link_count,omitempty"` - ModifiedAt *time.Time `json:"modified_at,omitempty"` - Name *string `json:"name"` - Summary datadog.NullableString `json:"summary,omitempty"` - UserCount *int32 `json:"user_count,omitempty"` - VisibleModules []string `json:"visible_modules,omitempty"` + Avatar datadog.NullableString `json:"avatar,omitempty"` + Banner datadog.NullableInt64 `json:"banner,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Description datadog.NullableString `json:"description,omitempty"` + Handle *string `json:"handle"` + HiddenModules datadog.NullableList[string] `json:"hidden_modules,omitempty"` + IsManaged *bool `json:"is_managed,omitempty"` + LinkCount *int32 `json:"link_count,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + Name *string `json:"name"` + Summary datadog.NullableString `json:"summary,omitempty"` + UserCount *int32 `json:"user_count,omitempty"` + VisibleModules datadog.NullableList[string] `json:"visible_modules,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) @@ -511,7 +567,7 @@ func (o *TeamAttributes) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"avatar", "banner", "created_at", "description", "handle", "hidden_modules", "link_count", "modified_at", "name", "summary", "user_count", "visible_modules"}) + datadog.DeleteKeys(additionalProperties, &[]string{"avatar", "banner", "created_at", "description", "handle", "hidden_modules", "is_managed", "link_count", "modified_at", "name", "summary", "user_count", "visible_modules"}) } else { return err } @@ -521,6 +577,7 @@ func (o *TeamAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Description = all.Description o.Handle = *all.Handle o.HiddenModules = all.HiddenModules + o.IsManaged = all.IsManaged o.LinkCount = all.LinkCount o.ModifiedAt = all.ModifiedAt o.Name = *all.Name diff --git a/api/datadogV2/model_team_hierarchy_link.go b/api/datadogV2/model_team_hierarchy_link.go new file mode 100644 index 00000000000..a8d1beda72e --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link.go @@ -0,0 +1,218 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLink Team hierarchy link +type TeamHierarchyLink struct { + // Team hierarchy link attributes + Attributes TeamHierarchyLinkAttributes `json:"attributes"` + // The team hierarchy link's identifier + Id string `json:"id"` + // Team hierarchy link relationships + Relationships *TeamHierarchyLinkRelationships `json:"relationships,omitempty"` + // Team hierarchy link type + Type TeamHierarchyLinkType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewTeamHierarchyLink instantiates a new TeamHierarchyLink object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewTeamHierarchyLink(attributes TeamHierarchyLinkAttributes, id string, typeVar TeamHierarchyLinkType) *TeamHierarchyLink { + this := TeamHierarchyLink{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewTeamHierarchyLinkWithDefaults instantiates a new TeamHierarchyLink object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewTeamHierarchyLinkWithDefaults() *TeamHierarchyLink { + this := TeamHierarchyLink{} + var typeVar TeamHierarchyLinkType = TEAMHIERARCHYLINKTYPE_TEAM_HIERARCHY_LINKS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *TeamHierarchyLink) GetAttributes() TeamHierarchyLinkAttributes { + if o == nil { + var ret TeamHierarchyLinkAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLink) GetAttributesOk() (*TeamHierarchyLinkAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *TeamHierarchyLink) SetAttributes(v TeamHierarchyLinkAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *TeamHierarchyLink) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLink) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *TeamHierarchyLink) SetId(v string) { + o.Id = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *TeamHierarchyLink) GetRelationships() TeamHierarchyLinkRelationships { + if o == nil || o.Relationships == nil { + var ret TeamHierarchyLinkRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLink) GetRelationshipsOk() (*TeamHierarchyLinkRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *TeamHierarchyLink) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given TeamHierarchyLinkRelationships and assigns it to the Relationships field. +func (o *TeamHierarchyLink) SetRelationships(v TeamHierarchyLinkRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *TeamHierarchyLink) GetType() TeamHierarchyLinkType { + if o == nil { + var ret TeamHierarchyLinkType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLink) GetTypeOk() (*TeamHierarchyLinkType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *TeamHierarchyLink) SetType(v TeamHierarchyLinkType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLink) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLink) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *TeamHierarchyLinkAttributes `json:"attributes"` + Id *string `json:"id"` + Relationships *TeamHierarchyLinkRelationships `json:"relationships,omitempty"` + Type *TeamHierarchyLinkType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_attributes.go b/api/datadogV2/model_team_hierarchy_link_attributes.go new file mode 100644 index 00000000000..b8727633357 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_attributes.go @@ -0,0 +1,138 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkAttributes Team hierarchy link attributes +type TeamHierarchyLinkAttributes struct { + // Timestamp when the team hierarchy link was created + CreatedAt time.Time `json:"created_at"` + // The provisioner of the team hierarchy link + ProvisionedBy string `json:"provisioned_by"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewTeamHierarchyLinkAttributes instantiates a new TeamHierarchyLinkAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewTeamHierarchyLinkAttributes(createdAt time.Time, provisionedBy string) *TeamHierarchyLinkAttributes { + this := TeamHierarchyLinkAttributes{} + this.CreatedAt = createdAt + this.ProvisionedBy = provisionedBy + return &this +} + +// NewTeamHierarchyLinkAttributesWithDefaults instantiates a new TeamHierarchyLinkAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewTeamHierarchyLinkAttributesWithDefaults() *TeamHierarchyLinkAttributes { + this := TeamHierarchyLinkAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value. +func (o *TeamHierarchyLinkAttributes) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value. +func (o *TeamHierarchyLinkAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetProvisionedBy returns the ProvisionedBy field value. +func (o *TeamHierarchyLinkAttributes) GetProvisionedBy() string { + if o == nil { + var ret string + return ret + } + return o.ProvisionedBy +} + +// GetProvisionedByOk returns a tuple with the ProvisionedBy field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkAttributes) GetProvisionedByOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ProvisionedBy, true +} + +// SetProvisionedBy sets field value. +func (o *TeamHierarchyLinkAttributes) SetProvisionedBy(v string) { + o.ProvisionedBy = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + toSerialize["provisioned_by"] = o.ProvisionedBy + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedAt *time.Time `json:"created_at"` + ProvisionedBy *string `json:"provisioned_by"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.CreatedAt == nil { + return fmt.Errorf("required field created_at missing") + } + if all.ProvisionedBy == nil { + return fmt.Errorf("required field provisioned_by missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "provisioned_by"}) + } else { + return err + } + o.CreatedAt = *all.CreatedAt + o.ProvisionedBy = *all.ProvisionedBy + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_create.go b/api/datadogV2/model_team_hierarchy_link_create.go new file mode 100644 index 00000000000..29b09947f62 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_create.go @@ -0,0 +1,148 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkCreate Data provided when creating a team hierarchy link +type TeamHierarchyLinkCreate struct { + // The related teams that will be connected by the team hierarchy link + Relationships TeamHierarchyLinkCreateRelationships `json:"relationships"` + // Team hierarchy link type + Type TeamHierarchyLinkType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewTeamHierarchyLinkCreate instantiates a new TeamHierarchyLinkCreate object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewTeamHierarchyLinkCreate(relationships TeamHierarchyLinkCreateRelationships, typeVar TeamHierarchyLinkType) *TeamHierarchyLinkCreate { + this := TeamHierarchyLinkCreate{} + this.Relationships = relationships + this.Type = typeVar + return &this +} + +// NewTeamHierarchyLinkCreateWithDefaults instantiates a new TeamHierarchyLinkCreate object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewTeamHierarchyLinkCreateWithDefaults() *TeamHierarchyLinkCreate { + this := TeamHierarchyLinkCreate{} + var typeVar TeamHierarchyLinkType = TEAMHIERARCHYLINKTYPE_TEAM_HIERARCHY_LINKS + this.Type = typeVar + return &this +} + +// GetRelationships returns the Relationships field value. +func (o *TeamHierarchyLinkCreate) GetRelationships() TeamHierarchyLinkCreateRelationships { + if o == nil { + var ret TeamHierarchyLinkCreateRelationships + return ret + } + return o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkCreate) GetRelationshipsOk() (*TeamHierarchyLinkCreateRelationships, bool) { + if o == nil { + return nil, false + } + return &o.Relationships, true +} + +// SetRelationships sets field value. +func (o *TeamHierarchyLinkCreate) SetRelationships(v TeamHierarchyLinkCreateRelationships) { + o.Relationships = v +} + +// GetType returns the Type field value. +func (o *TeamHierarchyLinkCreate) GetType() TeamHierarchyLinkType { + if o == nil { + var ret TeamHierarchyLinkType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkCreate) GetTypeOk() (*TeamHierarchyLinkType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *TeamHierarchyLinkCreate) SetType(v TeamHierarchyLinkType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkCreate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["relationships"] = o.Relationships + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkCreate) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Relationships *TeamHierarchyLinkCreateRelationships `json:"relationships"` + Type *TeamHierarchyLinkType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Relationships == nil { + return fmt.Errorf("required field relationships missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = *all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_create_relationships.go b/api/datadogV2/model_team_hierarchy_link_create_relationships.go new file mode 100644 index 00000000000..fa55a43e5a7 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_create_relationships.go @@ -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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkCreateRelationships The related teams that will be connected by the team hierarchy link +type TeamHierarchyLinkCreateRelationships struct { + // Data about each team that will be connected by the team hierarchy link + ParentTeam TeamHierarchyLinkCreateTeamRelationship `json:"parent_team"` + // Data about each team that will be connected by the team hierarchy link + SubTeam TeamHierarchyLinkCreateTeamRelationship `json:"sub_team"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewTeamHierarchyLinkCreateRelationships instantiates a new TeamHierarchyLinkCreateRelationships object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewTeamHierarchyLinkCreateRelationships(parentTeam TeamHierarchyLinkCreateTeamRelationship, subTeam TeamHierarchyLinkCreateTeamRelationship) *TeamHierarchyLinkCreateRelationships { + this := TeamHierarchyLinkCreateRelationships{} + this.ParentTeam = parentTeam + this.SubTeam = subTeam + return &this +} + +// NewTeamHierarchyLinkCreateRelationshipsWithDefaults instantiates a new TeamHierarchyLinkCreateRelationships object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewTeamHierarchyLinkCreateRelationshipsWithDefaults() *TeamHierarchyLinkCreateRelationships { + this := TeamHierarchyLinkCreateRelationships{} + return &this +} + +// GetParentTeam returns the ParentTeam field value. +func (o *TeamHierarchyLinkCreateRelationships) GetParentTeam() TeamHierarchyLinkCreateTeamRelationship { + if o == nil { + var ret TeamHierarchyLinkCreateTeamRelationship + return ret + } + return o.ParentTeam +} + +// GetParentTeamOk returns a tuple with the ParentTeam field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkCreateRelationships) GetParentTeamOk() (*TeamHierarchyLinkCreateTeamRelationship, bool) { + if o == nil { + return nil, false + } + return &o.ParentTeam, true +} + +// SetParentTeam sets field value. +func (o *TeamHierarchyLinkCreateRelationships) SetParentTeam(v TeamHierarchyLinkCreateTeamRelationship) { + o.ParentTeam = v +} + +// GetSubTeam returns the SubTeam field value. +func (o *TeamHierarchyLinkCreateRelationships) GetSubTeam() TeamHierarchyLinkCreateTeamRelationship { + if o == nil { + var ret TeamHierarchyLinkCreateTeamRelationship + return ret + } + return o.SubTeam +} + +// GetSubTeamOk returns a tuple with the SubTeam field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkCreateRelationships) GetSubTeamOk() (*TeamHierarchyLinkCreateTeamRelationship, bool) { + if o == nil { + return nil, false + } + return &o.SubTeam, true +} + +// SetSubTeam sets field value. +func (o *TeamHierarchyLinkCreateRelationships) SetSubTeam(v TeamHierarchyLinkCreateTeamRelationship) { + o.SubTeam = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkCreateRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["parent_team"] = o.ParentTeam + toSerialize["sub_team"] = o.SubTeam + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkCreateRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ParentTeam *TeamHierarchyLinkCreateTeamRelationship `json:"parent_team"` + SubTeam *TeamHierarchyLinkCreateTeamRelationship `json:"sub_team"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ParentTeam == nil { + return fmt.Errorf("required field parent_team missing") + } + if all.SubTeam == nil { + return fmt.Errorf("required field sub_team missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"parent_team", "sub_team"}) + } else { + return err + } + + hasInvalidField := false + if all.ParentTeam.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ParentTeam = *all.ParentTeam + if all.SubTeam.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.SubTeam = *all.SubTeam + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_create_request.go b/api/datadogV2/model_team_hierarchy_link_create_request.go new file mode 100644 index 00000000000..60e8b75423f --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_create_request.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkCreateRequest Request to create a team hierarchy link +type TeamHierarchyLinkCreateRequest struct { + // Data provided when creating a team hierarchy link + Data TeamHierarchyLinkCreate `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewTeamHierarchyLinkCreateRequest instantiates a new TeamHierarchyLinkCreateRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewTeamHierarchyLinkCreateRequest(data TeamHierarchyLinkCreate) *TeamHierarchyLinkCreateRequest { + this := TeamHierarchyLinkCreateRequest{} + this.Data = data + return &this +} + +// NewTeamHierarchyLinkCreateRequestWithDefaults instantiates a new TeamHierarchyLinkCreateRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewTeamHierarchyLinkCreateRequestWithDefaults() *TeamHierarchyLinkCreateRequest { + this := TeamHierarchyLinkCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *TeamHierarchyLinkCreateRequest) GetData() TeamHierarchyLinkCreate { + if o == nil { + var ret TeamHierarchyLinkCreate + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkCreateRequest) GetDataOk() (*TeamHierarchyLinkCreate, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *TeamHierarchyLinkCreateRequest) SetData(v TeamHierarchyLinkCreate) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *TeamHierarchyLinkCreate `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_create_team.go b/api/datadogV2/model_team_hierarchy_link_create_team.go new file mode 100644 index 00000000000..e2659f5612d --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_create_team.go @@ -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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkCreateTeam This schema defines the attributes about each team that has to be provided when creating a team hierarchy link +type TeamHierarchyLinkCreateTeam struct { + // The team's identifier + Id string `json:"id"` + // Team type + Type TeamType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewTeamHierarchyLinkCreateTeam instantiates a new TeamHierarchyLinkCreateTeam object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewTeamHierarchyLinkCreateTeam(id string, typeVar TeamType) *TeamHierarchyLinkCreateTeam { + this := TeamHierarchyLinkCreateTeam{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewTeamHierarchyLinkCreateTeamWithDefaults instantiates a new TeamHierarchyLinkCreateTeam object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewTeamHierarchyLinkCreateTeamWithDefaults() *TeamHierarchyLinkCreateTeam { + this := TeamHierarchyLinkCreateTeam{} + var typeVar TeamType = TEAMTYPE_TEAM + this.Type = typeVar + return &this +} + +// GetId returns the Id field value. +func (o *TeamHierarchyLinkCreateTeam) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkCreateTeam) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *TeamHierarchyLinkCreateTeam) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *TeamHierarchyLinkCreateTeam) GetType() TeamType { + if o == nil { + var ret TeamType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkCreateTeam) GetTypeOk() (*TeamType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *TeamHierarchyLinkCreateTeam) SetType(v TeamType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkCreateTeam) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkCreateTeam) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id"` + Type *TeamType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) + } else { + return err + } + + hasInvalidField := false + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_create_team_relationship.go b/api/datadogV2/model_team_hierarchy_link_create_team_relationship.go new file mode 100644 index 00000000000..31119c144b0 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_create_team_relationship.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkCreateTeamRelationship Data about each team that will be connected by the team hierarchy link +type TeamHierarchyLinkCreateTeamRelationship struct { + // This schema defines the attributes about each team that has to be provided when creating a team hierarchy link + Data TeamHierarchyLinkCreateTeam `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewTeamHierarchyLinkCreateTeamRelationship instantiates a new TeamHierarchyLinkCreateTeamRelationship object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewTeamHierarchyLinkCreateTeamRelationship(data TeamHierarchyLinkCreateTeam) *TeamHierarchyLinkCreateTeamRelationship { + this := TeamHierarchyLinkCreateTeamRelationship{} + this.Data = data + return &this +} + +// NewTeamHierarchyLinkCreateTeamRelationshipWithDefaults instantiates a new TeamHierarchyLinkCreateTeamRelationship object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewTeamHierarchyLinkCreateTeamRelationshipWithDefaults() *TeamHierarchyLinkCreateTeamRelationship { + this := TeamHierarchyLinkCreateTeamRelationship{} + return &this +} + +// GetData returns the Data field value. +func (o *TeamHierarchyLinkCreateTeamRelationship) GetData() TeamHierarchyLinkCreateTeam { + if o == nil { + var ret TeamHierarchyLinkCreateTeam + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkCreateTeamRelationship) GetDataOk() (*TeamHierarchyLinkCreateTeam, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *TeamHierarchyLinkCreateTeamRelationship) SetData(v TeamHierarchyLinkCreateTeam) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkCreateTeamRelationship) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkCreateTeamRelationship) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *TeamHierarchyLinkCreateTeam `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_relationships.go b/api/datadogV2/model_team_hierarchy_link_relationships.go new file mode 100644 index 00000000000..61d02aabbc0 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_relationships.go @@ -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 datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkRelationships Team hierarchy link relationships +type TeamHierarchyLinkRelationships struct { + // Team hierarchy link team relationship + ParentTeam TeamHierarchyLinkTeamRelationship `json:"parent_team"` + // Team hierarchy link team relationship + SubTeam TeamHierarchyLinkTeamRelationship `json:"sub_team"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewTeamHierarchyLinkRelationships instantiates a new TeamHierarchyLinkRelationships object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewTeamHierarchyLinkRelationships(parentTeam TeamHierarchyLinkTeamRelationship, subTeam TeamHierarchyLinkTeamRelationship) *TeamHierarchyLinkRelationships { + this := TeamHierarchyLinkRelationships{} + this.ParentTeam = parentTeam + this.SubTeam = subTeam + return &this +} + +// NewTeamHierarchyLinkRelationshipsWithDefaults instantiates a new TeamHierarchyLinkRelationships object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewTeamHierarchyLinkRelationshipsWithDefaults() *TeamHierarchyLinkRelationships { + this := TeamHierarchyLinkRelationships{} + return &this +} + +// GetParentTeam returns the ParentTeam field value. +func (o *TeamHierarchyLinkRelationships) GetParentTeam() TeamHierarchyLinkTeamRelationship { + if o == nil { + var ret TeamHierarchyLinkTeamRelationship + return ret + } + return o.ParentTeam +} + +// GetParentTeamOk returns a tuple with the ParentTeam field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkRelationships) GetParentTeamOk() (*TeamHierarchyLinkTeamRelationship, bool) { + if o == nil { + return nil, false + } + return &o.ParentTeam, true +} + +// SetParentTeam sets field value. +func (o *TeamHierarchyLinkRelationships) SetParentTeam(v TeamHierarchyLinkTeamRelationship) { + o.ParentTeam = v +} + +// GetSubTeam returns the SubTeam field value. +func (o *TeamHierarchyLinkRelationships) GetSubTeam() TeamHierarchyLinkTeamRelationship { + if o == nil { + var ret TeamHierarchyLinkTeamRelationship + return ret + } + return o.SubTeam +} + +// GetSubTeamOk returns a tuple with the SubTeam field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkRelationships) GetSubTeamOk() (*TeamHierarchyLinkTeamRelationship, bool) { + if o == nil { + return nil, false + } + return &o.SubTeam, true +} + +// SetSubTeam sets field value. +func (o *TeamHierarchyLinkRelationships) SetSubTeam(v TeamHierarchyLinkTeamRelationship) { + o.SubTeam = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["parent_team"] = o.ParentTeam + toSerialize["sub_team"] = o.SubTeam + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ParentTeam *TeamHierarchyLinkTeamRelationship `json:"parent_team"` + SubTeam *TeamHierarchyLinkTeamRelationship `json:"sub_team"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ParentTeam == nil { + return fmt.Errorf("required field parent_team missing") + } + if all.SubTeam == nil { + return fmt.Errorf("required field sub_team missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"parent_team", "sub_team"}) + } else { + return err + } + + hasInvalidField := false + if all.ParentTeam.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ParentTeam = *all.ParentTeam + if all.SubTeam.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.SubTeam = *all.SubTeam + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_response.go b/api/datadogV2/model_team_hierarchy_link_response.go new file mode 100644 index 00000000000..540431895f3 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_response.go @@ -0,0 +1,184 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkResponse Team hierarchy link response +type TeamHierarchyLinkResponse struct { + // Team hierarchy link + Data *TeamHierarchyLink `json:"data,omitempty"` + // Included teams + Included []TeamHierarchyLinkTeam `json:"included,omitempty"` + // When querying team hierarchy links, a set of links for navigation between different pages is included + Links *TeamsHierarchyLinksResponseLinks `json:"links,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewTeamHierarchyLinkResponse instantiates a new TeamHierarchyLinkResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewTeamHierarchyLinkResponse() *TeamHierarchyLinkResponse { + this := TeamHierarchyLinkResponse{} + return &this +} + +// NewTeamHierarchyLinkResponseWithDefaults instantiates a new TeamHierarchyLinkResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewTeamHierarchyLinkResponseWithDefaults() *TeamHierarchyLinkResponse { + this := TeamHierarchyLinkResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *TeamHierarchyLinkResponse) GetData() TeamHierarchyLink { + if o == nil || o.Data == nil { + var ret TeamHierarchyLink + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkResponse) GetDataOk() (*TeamHierarchyLink, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *TeamHierarchyLinkResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given TeamHierarchyLink and assigns it to the Data field. +func (o *TeamHierarchyLinkResponse) SetData(v TeamHierarchyLink) { + o.Data = &v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *TeamHierarchyLinkResponse) GetIncluded() []TeamHierarchyLinkTeam { + if o == nil || o.Included == nil { + var ret []TeamHierarchyLinkTeam + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkResponse) GetIncludedOk() (*[]TeamHierarchyLinkTeam, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *TeamHierarchyLinkResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []TeamHierarchyLinkTeam and assigns it to the Included field. +func (o *TeamHierarchyLinkResponse) SetIncluded(v []TeamHierarchyLinkTeam) { + o.Included = v +} + +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *TeamHierarchyLinkResponse) GetLinks() TeamsHierarchyLinksResponseLinks { + if o == nil || o.Links == nil { + var ret TeamsHierarchyLinksResponseLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkResponse) GetLinksOk() (*TeamsHierarchyLinksResponseLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *TeamHierarchyLinkResponse) HasLinks() bool { + return o != nil && o.Links != nil +} + +// SetLinks gets a reference to the given TeamsHierarchyLinksResponseLinks and assigns it to the Links field. +func (o *TeamHierarchyLinkResponse) SetLinks(v TeamsHierarchyLinksResponseLinks) { + o.Links = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Included != nil { + toSerialize["included"] = o.Included + } + if o.Links != nil { + toSerialize["links"] = o.Links + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *TeamHierarchyLink `json:"data,omitempty"` + Included []TeamHierarchyLinkTeam `json:"included,omitempty"` + Links *TeamsHierarchyLinksResponseLinks `json:"links,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included", "links"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + o.Included = all.Included + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Links = all.Links + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_team.go b/api/datadogV2/model_team_hierarchy_link_team.go new file mode 100644 index 00000000000..1ce3a3d305d --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_team.go @@ -0,0 +1,183 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkTeam Team hierarchy links connect different teams. This represents team objects that are connected by the team hierarchy link. +type TeamHierarchyLinkTeam struct { + // Team hierarchy links connect different teams. This represents attributes from teams that are connected by the team hierarchy link. + Attributes *TeamHierarchyLinkTeamAttributes `json:"attributes,omitempty"` + // The team's identifier + Id string `json:"id"` + // Team type + Type TeamType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewTeamHierarchyLinkTeam instantiates a new TeamHierarchyLinkTeam object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewTeamHierarchyLinkTeam(id string, typeVar TeamType) *TeamHierarchyLinkTeam { + this := TeamHierarchyLinkTeam{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewTeamHierarchyLinkTeamWithDefaults instantiates a new TeamHierarchyLinkTeam object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewTeamHierarchyLinkTeamWithDefaults() *TeamHierarchyLinkTeam { + this := TeamHierarchyLinkTeam{} + var typeVar TeamType = TEAMTYPE_TEAM + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *TeamHierarchyLinkTeam) GetAttributes() TeamHierarchyLinkTeamAttributes { + if o == nil || o.Attributes == nil { + var ret TeamHierarchyLinkTeamAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeam) GetAttributesOk() (*TeamHierarchyLinkTeamAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *TeamHierarchyLinkTeam) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given TeamHierarchyLinkTeamAttributes and assigns it to the Attributes field. +func (o *TeamHierarchyLinkTeam) SetAttributes(v TeamHierarchyLinkTeamAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *TeamHierarchyLinkTeam) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeam) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *TeamHierarchyLinkTeam) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *TeamHierarchyLinkTeam) GetType() TeamType { + if o == nil { + var ret TeamType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeam) GetTypeOk() (*TeamType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *TeamHierarchyLinkTeam) SetType(v TeamType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkTeam) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkTeam) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *TeamHierarchyLinkTeamAttributes `json:"attributes,omitempty"` + Id *string `json:"id"` + Type *TeamType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_team_attributes.go b/api/datadogV2/model_team_hierarchy_link_team_attributes.go new file mode 100644 index 00000000000..a96a7849817 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_team_attributes.go @@ -0,0 +1,400 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkTeamAttributes Team hierarchy links connect different teams. This represents attributes from teams that are connected by the team hierarchy link. +type TeamHierarchyLinkTeamAttributes struct { + // The team's avatar + Avatar datadog.NullableString `json:"avatar,omitempty"` + // The team's banner + Banner *int64 `json:"banner,omitempty"` + // The team's handle + Handle string `json:"handle"` + // Whether the team is managed + IsManaged *bool `json:"is_managed,omitempty"` + // Whether the team has open membership + IsOpenMembership *bool `json:"is_open_membership,omitempty"` + // The number of links for the team + LinkCount *int64 `json:"link_count,omitempty"` + // The team's name + Name string `json:"name"` + // The team's summary + Summary datadog.NullableString `json:"summary,omitempty"` + // The number of users in the team + UserCount *int64 `json:"user_count,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewTeamHierarchyLinkTeamAttributes instantiates a new TeamHierarchyLinkTeamAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewTeamHierarchyLinkTeamAttributes(handle string, name string) *TeamHierarchyLinkTeamAttributes { + this := TeamHierarchyLinkTeamAttributes{} + this.Handle = handle + this.Name = name + return &this +} + +// NewTeamHierarchyLinkTeamAttributesWithDefaults instantiates a new TeamHierarchyLinkTeamAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewTeamHierarchyLinkTeamAttributesWithDefaults() *TeamHierarchyLinkTeamAttributes { + this := TeamHierarchyLinkTeamAttributes{} + return &this +} + +// GetAvatar returns the Avatar field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamHierarchyLinkTeamAttributes) GetAvatar() string { + if o == nil || o.Avatar.Get() == nil { + var ret string + return ret + } + return *o.Avatar.Get() +} + +// GetAvatarOk returns a tuple with the Avatar field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamHierarchyLinkTeamAttributes) GetAvatarOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Avatar.Get(), o.Avatar.IsSet() +} + +// HasAvatar returns a boolean if a field has been set. +func (o *TeamHierarchyLinkTeamAttributes) HasAvatar() bool { + return o != nil && o.Avatar.IsSet() +} + +// SetAvatar gets a reference to the given datadog.NullableString and assigns it to the Avatar field. +func (o *TeamHierarchyLinkTeamAttributes) SetAvatar(v string) { + o.Avatar.Set(&v) +} + +// SetAvatarNil sets the value for Avatar to be an explicit nil. +func (o *TeamHierarchyLinkTeamAttributes) SetAvatarNil() { + o.Avatar.Set(nil) +} + +// UnsetAvatar ensures that no value is present for Avatar, not even an explicit nil. +func (o *TeamHierarchyLinkTeamAttributes) UnsetAvatar() { + o.Avatar.Unset() +} + +// GetBanner returns the Banner field value if set, zero value otherwise. +func (o *TeamHierarchyLinkTeamAttributes) GetBanner() int64 { + if o == nil || o.Banner == nil { + var ret int64 + return ret + } + return *o.Banner +} + +// GetBannerOk returns a tuple with the Banner field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeamAttributes) GetBannerOk() (*int64, bool) { + if o == nil || o.Banner == nil { + return nil, false + } + return o.Banner, true +} + +// HasBanner returns a boolean if a field has been set. +func (o *TeamHierarchyLinkTeamAttributes) HasBanner() bool { + return o != nil && o.Banner != nil +} + +// SetBanner gets a reference to the given int64 and assigns it to the Banner field. +func (o *TeamHierarchyLinkTeamAttributes) SetBanner(v int64) { + o.Banner = &v +} + +// GetHandle returns the Handle field value. +func (o *TeamHierarchyLinkTeamAttributes) GetHandle() string { + if o == nil { + var ret string + return ret + } + return o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeamAttributes) GetHandleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Handle, true +} + +// SetHandle sets field value. +func (o *TeamHierarchyLinkTeamAttributes) SetHandle(v string) { + o.Handle = v +} + +// GetIsManaged returns the IsManaged field value if set, zero value otherwise. +func (o *TeamHierarchyLinkTeamAttributes) GetIsManaged() bool { + if o == nil || o.IsManaged == nil { + var ret bool + return ret + } + return *o.IsManaged +} + +// GetIsManagedOk returns a tuple with the IsManaged field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeamAttributes) GetIsManagedOk() (*bool, bool) { + if o == nil || o.IsManaged == nil { + return nil, false + } + return o.IsManaged, true +} + +// HasIsManaged returns a boolean if a field has been set. +func (o *TeamHierarchyLinkTeamAttributes) HasIsManaged() bool { + return o != nil && o.IsManaged != nil +} + +// SetIsManaged gets a reference to the given bool and assigns it to the IsManaged field. +func (o *TeamHierarchyLinkTeamAttributes) SetIsManaged(v bool) { + o.IsManaged = &v +} + +// GetIsOpenMembership returns the IsOpenMembership field value if set, zero value otherwise. +func (o *TeamHierarchyLinkTeamAttributes) GetIsOpenMembership() bool { + if o == nil || o.IsOpenMembership == nil { + var ret bool + return ret + } + return *o.IsOpenMembership +} + +// GetIsOpenMembershipOk returns a tuple with the IsOpenMembership field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeamAttributes) GetIsOpenMembershipOk() (*bool, bool) { + if o == nil || o.IsOpenMembership == nil { + return nil, false + } + return o.IsOpenMembership, true +} + +// HasIsOpenMembership returns a boolean if a field has been set. +func (o *TeamHierarchyLinkTeamAttributes) HasIsOpenMembership() bool { + return o != nil && o.IsOpenMembership != nil +} + +// SetIsOpenMembership gets a reference to the given bool and assigns it to the IsOpenMembership field. +func (o *TeamHierarchyLinkTeamAttributes) SetIsOpenMembership(v bool) { + o.IsOpenMembership = &v +} + +// GetLinkCount returns the LinkCount field value if set, zero value otherwise. +func (o *TeamHierarchyLinkTeamAttributes) GetLinkCount() int64 { + if o == nil || o.LinkCount == nil { + var ret int64 + return ret + } + return *o.LinkCount +} + +// GetLinkCountOk returns a tuple with the LinkCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeamAttributes) GetLinkCountOk() (*int64, bool) { + if o == nil || o.LinkCount == nil { + return nil, false + } + return o.LinkCount, true +} + +// HasLinkCount returns a boolean if a field has been set. +func (o *TeamHierarchyLinkTeamAttributes) HasLinkCount() bool { + return o != nil && o.LinkCount != nil +} + +// SetLinkCount gets a reference to the given int64 and assigns it to the LinkCount field. +func (o *TeamHierarchyLinkTeamAttributes) SetLinkCount(v int64) { + o.LinkCount = &v +} + +// GetName returns the Name field value. +func (o *TeamHierarchyLinkTeamAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeamAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *TeamHierarchyLinkTeamAttributes) SetName(v string) { + o.Name = v +} + +// GetSummary returns the Summary field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamHierarchyLinkTeamAttributes) GetSummary() string { + if o == nil || o.Summary.Get() == nil { + var ret string + return ret + } + return *o.Summary.Get() +} + +// GetSummaryOk returns a tuple with the Summary field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamHierarchyLinkTeamAttributes) GetSummaryOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Summary.Get(), o.Summary.IsSet() +} + +// HasSummary returns a boolean if a field has been set. +func (o *TeamHierarchyLinkTeamAttributes) HasSummary() bool { + return o != nil && o.Summary.IsSet() +} + +// SetSummary gets a reference to the given datadog.NullableString and assigns it to the Summary field. +func (o *TeamHierarchyLinkTeamAttributes) SetSummary(v string) { + o.Summary.Set(&v) +} + +// SetSummaryNil sets the value for Summary to be an explicit nil. +func (o *TeamHierarchyLinkTeamAttributes) SetSummaryNil() { + o.Summary.Set(nil) +} + +// UnsetSummary ensures that no value is present for Summary, not even an explicit nil. +func (o *TeamHierarchyLinkTeamAttributes) UnsetSummary() { + o.Summary.Unset() +} + +// GetUserCount returns the UserCount field value if set, zero value otherwise. +func (o *TeamHierarchyLinkTeamAttributes) GetUserCount() int64 { + if o == nil || o.UserCount == nil { + var ret int64 + return ret + } + return *o.UserCount +} + +// GetUserCountOk returns a tuple with the UserCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeamAttributes) GetUserCountOk() (*int64, bool) { + if o == nil || o.UserCount == nil { + return nil, false + } + return o.UserCount, true +} + +// HasUserCount returns a boolean if a field has been set. +func (o *TeamHierarchyLinkTeamAttributes) HasUserCount() bool { + return o != nil && o.UserCount != nil +} + +// SetUserCount gets a reference to the given int64 and assigns it to the UserCount field. +func (o *TeamHierarchyLinkTeamAttributes) SetUserCount(v int64) { + o.UserCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkTeamAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Avatar.IsSet() { + toSerialize["avatar"] = o.Avatar.Get() + } + if o.Banner != nil { + toSerialize["banner"] = o.Banner + } + toSerialize["handle"] = o.Handle + if o.IsManaged != nil { + toSerialize["is_managed"] = o.IsManaged + } + if o.IsOpenMembership != nil { + toSerialize["is_open_membership"] = o.IsOpenMembership + } + if o.LinkCount != nil { + toSerialize["link_count"] = o.LinkCount + } + toSerialize["name"] = o.Name + if o.Summary.IsSet() { + toSerialize["summary"] = o.Summary.Get() + } + if o.UserCount != nil { + toSerialize["user_count"] = o.UserCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkTeamAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Avatar datadog.NullableString `json:"avatar,omitempty"` + Banner *int64 `json:"banner,omitempty"` + Handle *string `json:"handle"` + IsManaged *bool `json:"is_managed,omitempty"` + IsOpenMembership *bool `json:"is_open_membership,omitempty"` + LinkCount *int64 `json:"link_count,omitempty"` + Name *string `json:"name"` + Summary datadog.NullableString `json:"summary,omitempty"` + UserCount *int64 `json:"user_count,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Handle == nil { + return fmt.Errorf("required field handle missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"avatar", "banner", "handle", "is_managed", "is_open_membership", "link_count", "name", "summary", "user_count"}) + } else { + return err + } + o.Avatar = all.Avatar + o.Banner = all.Banner + o.Handle = *all.Handle + o.IsManaged = all.IsManaged + o.IsOpenMembership = all.IsOpenMembership + o.LinkCount = all.LinkCount + o.Name = *all.Name + o.Summary = all.Summary + o.UserCount = all.UserCount + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_team_relationship.go b/api/datadogV2/model_team_hierarchy_link_team_relationship.go new file mode 100644 index 00000000000..7c4aab533c5 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_team_relationship.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkTeamRelationship Team hierarchy link team relationship +type TeamHierarchyLinkTeamRelationship struct { + // Team hierarchy links connect different teams. This represents team objects that are connected by the team hierarchy link. + Data TeamHierarchyLinkTeam `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewTeamHierarchyLinkTeamRelationship instantiates a new TeamHierarchyLinkTeamRelationship object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewTeamHierarchyLinkTeamRelationship(data TeamHierarchyLinkTeam) *TeamHierarchyLinkTeamRelationship { + this := TeamHierarchyLinkTeamRelationship{} + this.Data = data + return &this +} + +// NewTeamHierarchyLinkTeamRelationshipWithDefaults instantiates a new TeamHierarchyLinkTeamRelationship object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewTeamHierarchyLinkTeamRelationshipWithDefaults() *TeamHierarchyLinkTeamRelationship { + this := TeamHierarchyLinkTeamRelationship{} + return &this +} + +// GetData returns the Data field value. +func (o *TeamHierarchyLinkTeamRelationship) GetData() TeamHierarchyLinkTeam { + if o == nil { + var ret TeamHierarchyLinkTeam + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeamRelationship) GetDataOk() (*TeamHierarchyLinkTeam, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *TeamHierarchyLinkTeamRelationship) SetData(v TeamHierarchyLinkTeam) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkTeamRelationship) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkTeamRelationship) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *TeamHierarchyLinkTeam `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_type.go b/api/datadogV2/model_team_hierarchy_link_type.go new file mode 100644 index 00000000000..c2c5de6c679 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkType Team hierarchy link type +type TeamHierarchyLinkType string + +// List of TeamHierarchyLinkType. +const ( + TEAMHIERARCHYLINKTYPE_TEAM_HIERARCHY_LINKS TeamHierarchyLinkType = "team_hierarchy_links" +) + +var allowedTeamHierarchyLinkTypeEnumValues = []TeamHierarchyLinkType{ + TEAMHIERARCHYLINKTYPE_TEAM_HIERARCHY_LINKS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *TeamHierarchyLinkType) GetAllowedValues() []TeamHierarchyLinkType { + return allowedTeamHierarchyLinkTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *TeamHierarchyLinkType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = TeamHierarchyLinkType(value) + return nil +} + +// NewTeamHierarchyLinkTypeFromValue returns a pointer to a valid TeamHierarchyLinkType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewTeamHierarchyLinkTypeFromValue(v string) (*TeamHierarchyLinkType, error) { + ev := TeamHierarchyLinkType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for TeamHierarchyLinkType: valid values are %v", v, allowedTeamHierarchyLinkTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v TeamHierarchyLinkType) IsValid() bool { + for _, existing := range allowedTeamHierarchyLinkTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TeamHierarchyLinkType value. +func (v TeamHierarchyLinkType) Ptr() *TeamHierarchyLinkType { + return &v +} diff --git a/api/datadogV2/model_team_hierarchy_links_response.go b/api/datadogV2/model_team_hierarchy_links_response.go new file mode 100644 index 00000000000..095ea9e312c --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_links_response.go @@ -0,0 +1,219 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinksResponse Team hierarchy links response +type TeamHierarchyLinksResponse struct { + // Team hierarchy links response data + Data []TeamHierarchyLink `json:"data,omitempty"` + // Included teams + Included []TeamHierarchyLinkTeam `json:"included,omitempty"` + // When querying team hierarchy links, a set of links for navigation between different pages is included + Links *TeamsHierarchyLinksResponseLinks `json:"links,omitempty"` + // Metadata that is included in the response when querying the team hierarchy links + Meta *TeamsHierarchyLinksResponseMeta `json:"meta,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewTeamHierarchyLinksResponse instantiates a new TeamHierarchyLinksResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewTeamHierarchyLinksResponse() *TeamHierarchyLinksResponse { + this := TeamHierarchyLinksResponse{} + return &this +} + +// NewTeamHierarchyLinksResponseWithDefaults instantiates a new TeamHierarchyLinksResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewTeamHierarchyLinksResponseWithDefaults() *TeamHierarchyLinksResponse { + this := TeamHierarchyLinksResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *TeamHierarchyLinksResponse) GetData() []TeamHierarchyLink { + if o == nil || o.Data == nil { + var ret []TeamHierarchyLink + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinksResponse) GetDataOk() (*[]TeamHierarchyLink, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *TeamHierarchyLinksResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []TeamHierarchyLink and assigns it to the Data field. +func (o *TeamHierarchyLinksResponse) SetData(v []TeamHierarchyLink) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *TeamHierarchyLinksResponse) GetIncluded() []TeamHierarchyLinkTeam { + if o == nil || o.Included == nil { + var ret []TeamHierarchyLinkTeam + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinksResponse) GetIncludedOk() (*[]TeamHierarchyLinkTeam, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *TeamHierarchyLinksResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []TeamHierarchyLinkTeam and assigns it to the Included field. +func (o *TeamHierarchyLinksResponse) SetIncluded(v []TeamHierarchyLinkTeam) { + o.Included = v +} + +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *TeamHierarchyLinksResponse) GetLinks() TeamsHierarchyLinksResponseLinks { + if o == nil || o.Links == nil { + var ret TeamsHierarchyLinksResponseLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinksResponse) GetLinksOk() (*TeamsHierarchyLinksResponseLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *TeamHierarchyLinksResponse) HasLinks() bool { + return o != nil && o.Links != nil +} + +// SetLinks gets a reference to the given TeamsHierarchyLinksResponseLinks and assigns it to the Links field. +func (o *TeamHierarchyLinksResponse) SetLinks(v TeamsHierarchyLinksResponseLinks) { + o.Links = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *TeamHierarchyLinksResponse) GetMeta() TeamsHierarchyLinksResponseMeta { + if o == nil || o.Meta == nil { + var ret TeamsHierarchyLinksResponseMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinksResponse) GetMetaOk() (*TeamsHierarchyLinksResponseMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *TeamHierarchyLinksResponse) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given TeamsHierarchyLinksResponseMeta and assigns it to the Meta field. +func (o *TeamHierarchyLinksResponse) SetMeta(v TeamsHierarchyLinksResponseMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinksResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Included != nil { + toSerialize["included"] = o.Included + } + if o.Links != nil { + toSerialize["links"] = o.Links + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinksResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data []TeamHierarchyLink `json:"data,omitempty"` + Included []TeamHierarchyLinkTeam `json:"included,omitempty"` + Links *TeamsHierarchyLinksResponseLinks `json:"links,omitempty"` + Meta *TeamsHierarchyLinksResponseMeta `json:"meta,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data", "included", "links", "meta"}) + } else { + return err + } + + hasInvalidField := false + o.Data = all.Data + o.Included = all.Included + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Links = all.Links + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_teams_hierarchy_links_response_links.go b/api/datadogV2/model_teams_hierarchy_links_response_links.go new file mode 100644 index 00000000000..34882c7516e --- /dev/null +++ b/api/datadogV2/model_teams_hierarchy_links_response_links.go @@ -0,0 +1,286 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamsHierarchyLinksResponseLinks When querying team hierarchy links, a set of links for navigation between different pages is included +type TeamsHierarchyLinksResponseLinks struct { + // Link to the first page. + First datadog.NullableString `json:"first,omitempty"` + // Link to the last page. + Last datadog.NullableString `json:"last,omitempty"` + // Link to the next page. + Next datadog.NullableString `json:"next,omitempty"` + // Link to the previous page. + Prev datadog.NullableString `json:"prev,omitempty"` + // Link to the current object. + Self *string `json:"self,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewTeamsHierarchyLinksResponseLinks instantiates a new TeamsHierarchyLinksResponseLinks object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewTeamsHierarchyLinksResponseLinks() *TeamsHierarchyLinksResponseLinks { + this := TeamsHierarchyLinksResponseLinks{} + return &this +} + +// NewTeamsHierarchyLinksResponseLinksWithDefaults instantiates a new TeamsHierarchyLinksResponseLinks object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewTeamsHierarchyLinksResponseLinksWithDefaults() *TeamsHierarchyLinksResponseLinks { + this := TeamsHierarchyLinksResponseLinks{} + return &this +} + +// GetFirst returns the First field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamsHierarchyLinksResponseLinks) GetFirst() string { + if o == nil || o.First.Get() == nil { + var ret string + return ret + } + return *o.First.Get() +} + +// GetFirstOk returns a tuple with the First field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamsHierarchyLinksResponseLinks) GetFirstOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.First.Get(), o.First.IsSet() +} + +// HasFirst returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseLinks) HasFirst() bool { + return o != nil && o.First.IsSet() +} + +// SetFirst gets a reference to the given datadog.NullableString and assigns it to the First field. +func (o *TeamsHierarchyLinksResponseLinks) SetFirst(v string) { + o.First.Set(&v) +} + +// SetFirstNil sets the value for First to be an explicit nil. +func (o *TeamsHierarchyLinksResponseLinks) SetFirstNil() { + o.First.Set(nil) +} + +// UnsetFirst ensures that no value is present for First, not even an explicit nil. +func (o *TeamsHierarchyLinksResponseLinks) UnsetFirst() { + o.First.Unset() +} + +// GetLast returns the Last field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamsHierarchyLinksResponseLinks) GetLast() string { + if o == nil || o.Last.Get() == nil { + var ret string + return ret + } + return *o.Last.Get() +} + +// GetLastOk returns a tuple with the Last field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamsHierarchyLinksResponseLinks) GetLastOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Last.Get(), o.Last.IsSet() +} + +// HasLast returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseLinks) HasLast() bool { + return o != nil && o.Last.IsSet() +} + +// SetLast gets a reference to the given datadog.NullableString and assigns it to the Last field. +func (o *TeamsHierarchyLinksResponseLinks) SetLast(v string) { + o.Last.Set(&v) +} + +// SetLastNil sets the value for Last to be an explicit nil. +func (o *TeamsHierarchyLinksResponseLinks) SetLastNil() { + o.Last.Set(nil) +} + +// UnsetLast ensures that no value is present for Last, not even an explicit nil. +func (o *TeamsHierarchyLinksResponseLinks) UnsetLast() { + o.Last.Unset() +} + +// GetNext returns the Next field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamsHierarchyLinksResponseLinks) GetNext() string { + if o == nil || o.Next.Get() == nil { + var ret string + return ret + } + return *o.Next.Get() +} + +// GetNextOk returns a tuple with the Next field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamsHierarchyLinksResponseLinks) GetNextOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Next.Get(), o.Next.IsSet() +} + +// HasNext returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseLinks) HasNext() bool { + return o != nil && o.Next.IsSet() +} + +// SetNext gets a reference to the given datadog.NullableString and assigns it to the Next field. +func (o *TeamsHierarchyLinksResponseLinks) SetNext(v string) { + o.Next.Set(&v) +} + +// SetNextNil sets the value for Next to be an explicit nil. +func (o *TeamsHierarchyLinksResponseLinks) SetNextNil() { + o.Next.Set(nil) +} + +// UnsetNext ensures that no value is present for Next, not even an explicit nil. +func (o *TeamsHierarchyLinksResponseLinks) UnsetNext() { + o.Next.Unset() +} + +// GetPrev returns the Prev field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamsHierarchyLinksResponseLinks) GetPrev() string { + if o == nil || o.Prev.Get() == nil { + var ret string + return ret + } + return *o.Prev.Get() +} + +// GetPrevOk returns a tuple with the Prev field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamsHierarchyLinksResponseLinks) GetPrevOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Prev.Get(), o.Prev.IsSet() +} + +// HasPrev returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseLinks) HasPrev() bool { + return o != nil && o.Prev.IsSet() +} + +// SetPrev gets a reference to the given datadog.NullableString and assigns it to the Prev field. +func (o *TeamsHierarchyLinksResponseLinks) SetPrev(v string) { + o.Prev.Set(&v) +} + +// SetPrevNil sets the value for Prev to be an explicit nil. +func (o *TeamsHierarchyLinksResponseLinks) SetPrevNil() { + o.Prev.Set(nil) +} + +// UnsetPrev ensures that no value is present for Prev, not even an explicit nil. +func (o *TeamsHierarchyLinksResponseLinks) UnsetPrev() { + o.Prev.Unset() +} + +// GetSelf returns the Self field value if set, zero value otherwise. +func (o *TeamsHierarchyLinksResponseLinks) GetSelf() string { + if o == nil || o.Self == nil { + var ret string + return ret + } + return *o.Self +} + +// GetSelfOk returns a tuple with the Self field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsHierarchyLinksResponseLinks) GetSelfOk() (*string, bool) { + if o == nil || o.Self == nil { + return nil, false + } + return o.Self, true +} + +// HasSelf returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseLinks) HasSelf() bool { + return o != nil && o.Self != nil +} + +// SetSelf gets a reference to the given string and assigns it to the Self field. +func (o *TeamsHierarchyLinksResponseLinks) SetSelf(v string) { + o.Self = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamsHierarchyLinksResponseLinks) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.First.IsSet() { + toSerialize["first"] = o.First.Get() + } + if o.Last.IsSet() { + toSerialize["last"] = o.Last.Get() + } + if o.Next.IsSet() { + toSerialize["next"] = o.Next.Get() + } + if o.Prev.IsSet() { + toSerialize["prev"] = o.Prev.Get() + } + if o.Self != nil { + toSerialize["self"] = o.Self + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamsHierarchyLinksResponseLinks) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + First datadog.NullableString `json:"first,omitempty"` + Last datadog.NullableString `json:"last,omitempty"` + Next datadog.NullableString `json:"next,omitempty"` + Prev datadog.NullableString `json:"prev,omitempty"` + Self *string `json:"self,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"first", "last", "next", "prev", "self"}) + } else { + return err + } + o.First = all.First + o.Last = all.Last + o.Next = all.Next + o.Prev = all.Prev + o.Self = all.Self + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_teams_hierarchy_links_response_meta.go b/api/datadogV2/model_teams_hierarchy_links_response_meta.go new file mode 100644 index 00000000000..6c225865ed7 --- /dev/null +++ b/api/datadogV2/model_teams_hierarchy_links_response_meta.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamsHierarchyLinksResponseMeta Metadata that is included in the response when querying the team hierarchy links +type TeamsHierarchyLinksResponseMeta struct { + // Metadata related to paging information that is included in the response when querying the team hierarchy links + Page *TeamsHierarchyLinksResponseMetaPage `json:"page,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewTeamsHierarchyLinksResponseMeta instantiates a new TeamsHierarchyLinksResponseMeta object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewTeamsHierarchyLinksResponseMeta() *TeamsHierarchyLinksResponseMeta { + this := TeamsHierarchyLinksResponseMeta{} + return &this +} + +// NewTeamsHierarchyLinksResponseMetaWithDefaults instantiates a new TeamsHierarchyLinksResponseMeta object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewTeamsHierarchyLinksResponseMetaWithDefaults() *TeamsHierarchyLinksResponseMeta { + this := TeamsHierarchyLinksResponseMeta{} + return &this +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *TeamsHierarchyLinksResponseMeta) GetPage() TeamsHierarchyLinksResponseMetaPage { + if o == nil || o.Page == nil { + var ret TeamsHierarchyLinksResponseMetaPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsHierarchyLinksResponseMeta) GetPageOk() (*TeamsHierarchyLinksResponseMetaPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMeta) HasPage() bool { + return o != nil && o.Page != nil +} + +// SetPage gets a reference to the given TeamsHierarchyLinksResponseMetaPage and assigns it to the Page field. +func (o *TeamsHierarchyLinksResponseMeta) SetPage(v TeamsHierarchyLinksResponseMetaPage) { + o.Page = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamsHierarchyLinksResponseMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamsHierarchyLinksResponseMeta) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Page *TeamsHierarchyLinksResponseMetaPage `json:"page,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"page"}) + } else { + return err + } + + hasInvalidField := false + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Page = all.Page + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_teams_hierarchy_links_response_meta_page.go b/api/datadogV2/model_teams_hierarchy_links_response_meta_page.go new file mode 100644 index 00000000000..8776e9f3d32 --- /dev/null +++ b/api/datadogV2/model_teams_hierarchy_links_response_meta_page.go @@ -0,0 +1,369 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamsHierarchyLinksResponseMetaPage Metadata related to paging information that is included in the response when querying the team hierarchy links +type TeamsHierarchyLinksResponseMetaPage struct { + // First page number. + FirstNumber *int64 `json:"first_number,omitempty"` + // Last page number. + LastNumber *int64 `json:"last_number,omitempty"` + // Next page number. + NextNumber datadog.NullableInt64 `json:"next_number,omitempty"` + // Page number. + Number *int64 `json:"number,omitempty"` + // Previous page number. + PrevNumber datadog.NullableInt64 `json:"prev_number,omitempty"` + // Page size. + Size *int64 `json:"size,omitempty"` + // Total number of results. + Total *int64 `json:"total,omitempty"` + // Pagination type. + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewTeamsHierarchyLinksResponseMetaPage instantiates a new TeamsHierarchyLinksResponseMetaPage object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewTeamsHierarchyLinksResponseMetaPage() *TeamsHierarchyLinksResponseMetaPage { + this := TeamsHierarchyLinksResponseMetaPage{} + return &this +} + +// NewTeamsHierarchyLinksResponseMetaPageWithDefaults instantiates a new TeamsHierarchyLinksResponseMetaPage object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewTeamsHierarchyLinksResponseMetaPageWithDefaults() *TeamsHierarchyLinksResponseMetaPage { + this := TeamsHierarchyLinksResponseMetaPage{} + return &this +} + +// GetFirstNumber returns the FirstNumber field value if set, zero value otherwise. +func (o *TeamsHierarchyLinksResponseMetaPage) GetFirstNumber() int64 { + if o == nil || o.FirstNumber == nil { + var ret int64 + return ret + } + return *o.FirstNumber +} + +// GetFirstNumberOk returns a tuple with the FirstNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) GetFirstNumberOk() (*int64, bool) { + if o == nil || o.FirstNumber == nil { + return nil, false + } + return o.FirstNumber, true +} + +// HasFirstNumber returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) HasFirstNumber() bool { + return o != nil && o.FirstNumber != nil +} + +// SetFirstNumber gets a reference to the given int64 and assigns it to the FirstNumber field. +func (o *TeamsHierarchyLinksResponseMetaPage) SetFirstNumber(v int64) { + o.FirstNumber = &v +} + +// GetLastNumber returns the LastNumber field value if set, zero value otherwise. +func (o *TeamsHierarchyLinksResponseMetaPage) GetLastNumber() int64 { + if o == nil || o.LastNumber == nil { + var ret int64 + return ret + } + return *o.LastNumber +} + +// GetLastNumberOk returns a tuple with the LastNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) GetLastNumberOk() (*int64, bool) { + if o == nil || o.LastNumber == nil { + return nil, false + } + return o.LastNumber, true +} + +// HasLastNumber returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) HasLastNumber() bool { + return o != nil && o.LastNumber != nil +} + +// SetLastNumber gets a reference to the given int64 and assigns it to the LastNumber field. +func (o *TeamsHierarchyLinksResponseMetaPage) SetLastNumber(v int64) { + o.LastNumber = &v +} + +// GetNextNumber returns the NextNumber field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamsHierarchyLinksResponseMetaPage) GetNextNumber() int64 { + if o == nil || o.NextNumber.Get() == nil { + var ret int64 + return ret + } + return *o.NextNumber.Get() +} + +// GetNextNumberOk returns a tuple with the NextNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamsHierarchyLinksResponseMetaPage) GetNextNumberOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.NextNumber.Get(), o.NextNumber.IsSet() +} + +// HasNextNumber returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) HasNextNumber() bool { + return o != nil && o.NextNumber.IsSet() +} + +// SetNextNumber gets a reference to the given datadog.NullableInt64 and assigns it to the NextNumber field. +func (o *TeamsHierarchyLinksResponseMetaPage) SetNextNumber(v int64) { + o.NextNumber.Set(&v) +} + +// SetNextNumberNil sets the value for NextNumber to be an explicit nil. +func (o *TeamsHierarchyLinksResponseMetaPage) SetNextNumberNil() { + o.NextNumber.Set(nil) +} + +// UnsetNextNumber ensures that no value is present for NextNumber, not even an explicit nil. +func (o *TeamsHierarchyLinksResponseMetaPage) UnsetNextNumber() { + o.NextNumber.Unset() +} + +// GetNumber returns the Number field value if set, zero value otherwise. +func (o *TeamsHierarchyLinksResponseMetaPage) GetNumber() int64 { + if o == nil || o.Number == nil { + var ret int64 + return ret + } + return *o.Number +} + +// GetNumberOk returns a tuple with the Number field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) GetNumberOk() (*int64, bool) { + if o == nil || o.Number == nil { + return nil, false + } + return o.Number, true +} + +// HasNumber returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) HasNumber() bool { + return o != nil && o.Number != nil +} + +// SetNumber gets a reference to the given int64 and assigns it to the Number field. +func (o *TeamsHierarchyLinksResponseMetaPage) SetNumber(v int64) { + o.Number = &v +} + +// GetPrevNumber returns the PrevNumber field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamsHierarchyLinksResponseMetaPage) GetPrevNumber() int64 { + if o == nil || o.PrevNumber.Get() == nil { + var ret int64 + return ret + } + return *o.PrevNumber.Get() +} + +// GetPrevNumberOk returns a tuple with the PrevNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamsHierarchyLinksResponseMetaPage) GetPrevNumberOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.PrevNumber.Get(), o.PrevNumber.IsSet() +} + +// HasPrevNumber returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) HasPrevNumber() bool { + return o != nil && o.PrevNumber.IsSet() +} + +// SetPrevNumber gets a reference to the given datadog.NullableInt64 and assigns it to the PrevNumber field. +func (o *TeamsHierarchyLinksResponseMetaPage) SetPrevNumber(v int64) { + o.PrevNumber.Set(&v) +} + +// SetPrevNumberNil sets the value for PrevNumber to be an explicit nil. +func (o *TeamsHierarchyLinksResponseMetaPage) SetPrevNumberNil() { + o.PrevNumber.Set(nil) +} + +// UnsetPrevNumber ensures that no value is present for PrevNumber, not even an explicit nil. +func (o *TeamsHierarchyLinksResponseMetaPage) UnsetPrevNumber() { + o.PrevNumber.Unset() +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *TeamsHierarchyLinksResponseMetaPage) GetSize() int64 { + if o == nil || o.Size == nil { + var ret int64 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) GetSizeOk() (*int64, bool) { + if o == nil || o.Size == nil { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) HasSize() bool { + return o != nil && o.Size != nil +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *TeamsHierarchyLinksResponseMetaPage) SetSize(v int64) { + o.Size = &v +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *TeamsHierarchyLinksResponseMetaPage) GetTotal() int64 { + if o == nil || o.Total == nil { + var ret int64 + return ret + } + return *o.Total +} + +// GetTotalOk returns a tuple with the Total field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) GetTotalOk() (*int64, bool) { + if o == nil || o.Total == nil { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) HasTotal() bool { + return o != nil && o.Total != nil +} + +// SetTotal gets a reference to the given int64 and assigns it to the Total field. +func (o *TeamsHierarchyLinksResponseMetaPage) SetTotal(v int64) { + o.Total = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *TeamsHierarchyLinksResponseMetaPage) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *TeamsHierarchyLinksResponseMetaPage) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamsHierarchyLinksResponseMetaPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.FirstNumber != nil { + toSerialize["first_number"] = o.FirstNumber + } + if o.LastNumber != nil { + toSerialize["last_number"] = o.LastNumber + } + if o.NextNumber.IsSet() { + toSerialize["next_number"] = o.NextNumber.Get() + } + if o.Number != nil { + toSerialize["number"] = o.Number + } + if o.PrevNumber.IsSet() { + toSerialize["prev_number"] = o.PrevNumber.Get() + } + if o.Size != nil { + toSerialize["size"] = o.Size + } + if o.Total != nil { + toSerialize["total"] = o.Total + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamsHierarchyLinksResponseMetaPage) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + FirstNumber *int64 `json:"first_number,omitempty"` + LastNumber *int64 `json:"last_number,omitempty"` + NextNumber datadog.NullableInt64 `json:"next_number,omitempty"` + Number *int64 `json:"number,omitempty"` + PrevNumber datadog.NullableInt64 `json:"prev_number,omitempty"` + Size *int64 `json:"size,omitempty"` + Total *int64 `json:"total,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"first_number", "last_number", "next_number", "number", "prev_number", "size", "total", "type"}) + } else { + return err + } + o.FirstNumber = all.FirstNumber + o.LastNumber = all.LastNumber + o.NextNumber = all.NextNumber + o.Number = all.Number + o.PrevNumber = all.PrevNumber + o.Size = all.Size + o.Total = all.Total + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/examples/v2/security-monitoring/AttachCase.go b/examples/v2/security-monitoring/AttachCase.go new file mode 100644 index 00000000000..2dc307fada0 --- /dev/null +++ b/examples/v2/security-monitoring/AttachCase.go @@ -0,0 +1,49 @@ +// Attach security findings to a case returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.AttachCaseRequest{ + Data: &datadogV2.AttachCaseRequestData{ + Id: "7d16945b-baf8-411e-ab2a-20fe43af1ea3", + Relationships: &datadogV2.AttachCaseRequestDataRelationships{ + Findings: datadogV2.Findings{ + Data: []datadogV2.FindingData{ + { + Id: "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=", + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + }, + { + Id: "MmUzMzZkODQ2YTI3NDU0OTk4NDk3NzhkOTY5YjU2Zjh-YWJjZGI1ODI4OTYzNWM3ZmUwZTBlOWRkYTRiMGUyOGQ=", + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + }, + }, + }, + }, + Type: datadogV2.CASEDATATYPE_CASES, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + resp, r, err := api.AttachCase(ctx, "7d16945b-baf8-411e-ab2a-20fe43af1ea3", body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.AttachCase`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.AttachCase`:\n%s\n", responseContent) +} diff --git a/examples/v2/security-monitoring/AttachCase_897782765.go b/examples/v2/security-monitoring/AttachCase_897782765.go new file mode 100644 index 00000000000..0e7889441de --- /dev/null +++ b/examples/v2/security-monitoring/AttachCase_897782765.go @@ -0,0 +1,45 @@ +// Attach security finding to a case returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.AttachCaseRequest{ + Data: &datadogV2.AttachCaseRequestData{ + Id: "7d16945b-baf8-411e-ab2a-20fe43af1ea3", + Relationships: &datadogV2.AttachCaseRequestDataRelationships{ + Findings: datadogV2.Findings{ + Data: []datadogV2.FindingData{ + { + Id: "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=", + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + }, + }, + }, + }, + Type: datadogV2.CASEDATATYPE_CASES, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + resp, r, err := api.AttachCase(ctx, "7d16945b-baf8-411e-ab2a-20fe43af1ea3", body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.AttachCase`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.AttachCase`:\n%s\n", responseContent) +} diff --git a/examples/v2/security-monitoring/AttachJiraIssue.go b/examples/v2/security-monitoring/AttachJiraIssue.go new file mode 100644 index 00000000000..e1c9cd8d0c2 --- /dev/null +++ b/examples/v2/security-monitoring/AttachJiraIssue.go @@ -0,0 +1,57 @@ +// Attach security findings to a Jira issue returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.AttachJiraIssueRequest{ + Data: &datadogV2.AttachJiraIssueRequestData{ + Attributes: &datadogV2.AttachJiraIssueRequestDataAttributes{ + JiraIssueUrl: "https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476", + }, + Relationships: &datadogV2.AttachJiraIssueRequestDataRelationships{ + Findings: datadogV2.Findings{ + Data: []datadogV2.FindingData{ + { + Id: "OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI=", + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + }, + { + Id: "MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM=", + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + }, + }, + }, + Project: datadogV2.CaseManagementProject{ + Data: datadogV2.CaseManagementProjectData{ + Id: "959a6f71-bac8-4027-b1d3-2264f569296f", + Type: datadogV2.CASEMANAGEMENTPROJECTDATATYPE_PROJECTS, + }, + }, + }, + Type: datadogV2.JIRAISSUESDATATYPE_JIRA_ISSUES, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + resp, r, err := api.AttachJiraIssue(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.AttachJiraIssue`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.AttachJiraIssue`:\n%s\n", responseContent) +} diff --git a/examples/v2/security-monitoring/AttachJiraIssue_3042842144.go b/examples/v2/security-monitoring/AttachJiraIssue_3042842144.go new file mode 100644 index 00000000000..5adb0862aff --- /dev/null +++ b/examples/v2/security-monitoring/AttachJiraIssue_3042842144.go @@ -0,0 +1,53 @@ +// Attach security finding to a Jira issue returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.AttachJiraIssueRequest{ + Data: &datadogV2.AttachJiraIssueRequestData{ + Attributes: &datadogV2.AttachJiraIssueRequestDataAttributes{ + JiraIssueUrl: "https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476", + }, + Relationships: &datadogV2.AttachJiraIssueRequestDataRelationships{ + Findings: datadogV2.Findings{ + Data: []datadogV2.FindingData{ + { + Id: "OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI=", + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + }, + }, + }, + Project: datadogV2.CaseManagementProject{ + Data: datadogV2.CaseManagementProjectData{ + Id: "959a6f71-bac8-4027-b1d3-2264f569296f", + Type: datadogV2.CASEMANAGEMENTPROJECTDATATYPE_PROJECTS, + }, + }, + }, + Type: datadogV2.JIRAISSUESDATATYPE_JIRA_ISSUES, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + resp, r, err := api.AttachJiraIssue(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.AttachJiraIssue`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.AttachJiraIssue`:\n%s\n", responseContent) +} diff --git a/examples/v2/security-monitoring/CreateCases.go b/examples/v2/security-monitoring/CreateCases.go new file mode 100644 index 00000000000..8466fa3b633 --- /dev/null +++ b/examples/v2/security-monitoring/CreateCases.go @@ -0,0 +1,79 @@ +// Create cases for security findings returns "Created" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.CreateCaseRequestArray{ + Data: []datadogV2.CreateCaseRequestData{ + { + Attributes: &datadogV2.CreateCaseRequestDataAttributes{ + Title: datadog.PtrString("A title"), + Description: datadog.PtrString("A description"), + }, + Relationships: &datadogV2.CreateCaseRequestDataRelationships{ + Findings: datadogV2.Findings{ + Data: []datadogV2.FindingData{ + { + Id: "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=", + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + }, + }, + }, + Project: datadogV2.CaseManagementProject{ + Data: datadogV2.CaseManagementProjectData{ + Id: "959a6f71-bac8-4027-b1d3-2264f569296f", + Type: datadogV2.CASEMANAGEMENTPROJECTDATATYPE_PROJECTS, + }, + }, + }, + Type: datadogV2.CASEDATATYPE_CASES, + }, + { + Attributes: &datadogV2.CreateCaseRequestDataAttributes{ + Title: datadog.PtrString("A title"), + Description: datadog.PtrString("A description"), + }, + Relationships: &datadogV2.CreateCaseRequestDataRelationships{ + Findings: datadogV2.Findings{ + Data: []datadogV2.FindingData{ + { + Id: "MzZkNTMxODNmOGZlZmJiYzIyMDg4NzhmM2QyMDExZjB-ZmY5NzUwNDQzYTE0MGIyNDM1MTg4YjkxZDNmMDU4OGU=", + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + }, + }, + }, + Project: datadogV2.CaseManagementProject{ + Data: datadogV2.CaseManagementProjectData{ + Id: "959a6f71-bac8-4027-b1d3-2264f569296f", + Type: datadogV2.CASEMANAGEMENTPROJECTDATATYPE_PROJECTS, + }, + }, + }, + Type: datadogV2.CASEDATATYPE_CASES, + }, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + resp, r, err := api.CreateCases(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.CreateCases`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.CreateCases`:\n%s\n", responseContent) +} diff --git a/examples/v2/security-monitoring/CreateCases_2385516013.go b/examples/v2/security-monitoring/CreateCases_2385516013.go new file mode 100644 index 00000000000..fd861f21ed7 --- /dev/null +++ b/examples/v2/security-monitoring/CreateCases_2385516013.go @@ -0,0 +1,56 @@ +// Create case for security finding returns "Created" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.CreateCaseRequestArray{ + Data: []datadogV2.CreateCaseRequestData{ + { + Attributes: &datadogV2.CreateCaseRequestDataAttributes{ + Title: datadog.PtrString("A title"), + Description: datadog.PtrString("A description"), + }, + Relationships: &datadogV2.CreateCaseRequestDataRelationships{ + Findings: datadogV2.Findings{ + Data: []datadogV2.FindingData{ + { + Id: "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=", + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + }, + }, + }, + Project: datadogV2.CaseManagementProject{ + Data: datadogV2.CaseManagementProjectData{ + Id: "959a6f71-bac8-4027-b1d3-2264f569296f", + Type: datadogV2.CASEMANAGEMENTPROJECTDATATYPE_PROJECTS, + }, + }, + }, + Type: datadogV2.CASEDATATYPE_CASES, + }, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + resp, r, err := api.CreateCases(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.CreateCases`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.CreateCases`:\n%s\n", responseContent) +} diff --git a/examples/v2/security-monitoring/CreateCases_2798851680.go b/examples/v2/security-monitoring/CreateCases_2798851680.go new file mode 100644 index 00000000000..5530985d6e4 --- /dev/null +++ b/examples/v2/security-monitoring/CreateCases_2798851680.go @@ -0,0 +1,60 @@ +// Create case for security findings returns "Created" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.CreateCaseRequestArray{ + Data: []datadogV2.CreateCaseRequestData{ + { + Attributes: &datadogV2.CreateCaseRequestDataAttributes{ + Title: datadog.PtrString("A title"), + Description: datadog.PtrString("A description"), + }, + Relationships: &datadogV2.CreateCaseRequestDataRelationships{ + Findings: datadogV2.Findings{ + Data: []datadogV2.FindingData{ + { + Id: "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=", + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + }, + { + Id: "MzZkNTMxODNmOGZlZmJiYzIyMDg4NzhmM2QyMDExZjB-ZmY5NzUwNDQzYTE0MGIyNDM1MTg4YjkxZDNmMDU4OGU=", + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + }, + }, + }, + Project: datadogV2.CaseManagementProject{ + Data: datadogV2.CaseManagementProjectData{ + Id: "959a6f71-bac8-4027-b1d3-2264f569296f", + Type: datadogV2.CASEMANAGEMENTPROJECTDATATYPE_PROJECTS, + }, + }, + }, + Type: datadogV2.CASEDATATYPE_CASES, + }, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + resp, r, err := api.CreateCases(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.CreateCases`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.CreateCases`:\n%s\n", responseContent) +} diff --git a/examples/v2/security-monitoring/CreateJiraIssues.go b/examples/v2/security-monitoring/CreateJiraIssues.go new file mode 100644 index 00000000000..7d6af95cc26 --- /dev/null +++ b/examples/v2/security-monitoring/CreateJiraIssues.go @@ -0,0 +1,124 @@ +// Create Jira issues for security findings returns "Created" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.CreateJiraIssueRequestArray{ + Data: []datadogV2.CreateJiraIssueRequestData{ + { + Type: datadogV2.JIRAISSUESDATATYPE_JIRA_ISSUES, + Attributes: &datadogV2.CreateJiraIssueRequestDataAttributes{}, + Relationships: &datadogV2.CreateJiraIssueRequestDataRelationships{ + Case: datadogV2.CreateJiraIssueRequestDataRelationshipsCase{ + Data: datadogV2.CreateJiraIssueRequestDataRelationshipsCaseData{ + Type: datadogV2.CASEDATATYPE_CASES, + Id: "53e242c6-a7d6-46ad-9680-b8d14753f716", + }, + }, + }, + }, + { + Type: datadogV2.JIRAISSUESDATATYPE_JIRA_ISSUES, + Attributes: &datadogV2.CreateJiraIssueRequestDataAttributes{}, + Relationships: &datadogV2.CreateJiraIssueRequestDataRelationships{ + Case: datadogV2.CreateJiraIssueRequestDataRelationshipsCase{ + Data: datadogV2.CreateJiraIssueRequestDataRelationshipsCaseData{ + Type: datadogV2.CASEDATATYPE_CASES, + Id: "195772b2-1f53-41d2-b81e-48c8e6c21d33", + }, + }, + }, + }, + }, + Included: []datadogV2.CreateJiraIssueRequestArrayIncluded{ + datadogV2.CreateJiraIssueRequestArrayIncluded{ + CreateCaseRequestData: &datadogV2.CreateCaseRequestData{ + Type: datadogV2.CASEDATATYPE_CASES, + Attributes: &datadogV2.CreateCaseRequestDataAttributes{ + Title: datadog.PtrString("A title"), + Description: datadog.PtrString("A description"), + }, + Relationships: &datadogV2.CreateCaseRequestDataRelationships{ + Project: datadogV2.CaseManagementProject{ + Data: datadogV2.CaseManagementProjectData{ + Type: datadogV2.CASEMANAGEMENTPROJECTDATATYPE_PROJECTS, + Id: "959a6f71-bac8-4027-b1d3-2264f569296f", + }, + }, + Findings: datadogV2.Findings{ + Data: []datadogV2.FindingData{ + { + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + Id: "OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI=", + }, + }, + }, + }, + Id: datadog.PtrString("53e242c6-a7d6-46ad-9680-b8d14753f716"), + }}, + datadogV2.CreateJiraIssueRequestArrayIncluded{ + CreateCaseRequestData: &datadogV2.CreateCaseRequestData{ + Type: datadogV2.CASEDATATYPE_CASES, + Attributes: &datadogV2.CreateCaseRequestDataAttributes{ + Title: datadog.PtrString("A title"), + Description: datadog.PtrString("A description"), + }, + Relationships: &datadogV2.CreateCaseRequestDataRelationships{ + Project: datadogV2.CaseManagementProject{ + Data: datadogV2.CaseManagementProjectData{ + Type: datadogV2.CASEMANAGEMENTPROJECTDATATYPE_PROJECTS, + Id: "959a6f71-bac8-4027-b1d3-2264f569296f", + }, + }, + Findings: datadogV2.Findings{ + Data: []datadogV2.FindingData{ + { + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + Id: "MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM=", + }, + }, + }, + }, + Id: datadog.PtrString("195772b2-1f53-41d2-b81e-48c8e6c21d33"), + }}, + datadogV2.CreateJiraIssueRequestArrayIncluded{ + CaseManagementProjectData: &datadogV2.CaseManagementProjectData{ + Type: datadogV2.CASEMANAGEMENTPROJECTDATATYPE_PROJECTS, + Id: "959a6f71-bac8-4027-b1d3-2264f569296f", + }}, + datadogV2.CreateJiraIssueRequestArrayIncluded{ + FindingData: &datadogV2.FindingData{ + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + Id: "OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI=", + }}, + datadogV2.CreateJiraIssueRequestArrayIncluded{ + FindingData: &datadogV2.FindingData{ + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + Id: "MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM=", + }}, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + resp, r, err := api.CreateJiraIssues(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.CreateJiraIssues`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.CreateJiraIssues`:\n%s\n", responseContent) +} diff --git a/examples/v2/security-monitoring/CreateJiraIssues_379590688.go b/examples/v2/security-monitoring/CreateJiraIssues_379590688.go new file mode 100644 index 00000000000..0c8429a2fec --- /dev/null +++ b/examples/v2/security-monitoring/CreateJiraIssues_379590688.go @@ -0,0 +1,82 @@ +// Create Jira issue for security finding returns "Created" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.CreateJiraIssueRequestArray{ + Data: []datadogV2.CreateJiraIssueRequestData{ + { + Type: datadogV2.JIRAISSUESDATATYPE_JIRA_ISSUES, + Attributes: &datadogV2.CreateJiraIssueRequestDataAttributes{}, + Relationships: &datadogV2.CreateJiraIssueRequestDataRelationships{ + Case: datadogV2.CreateJiraIssueRequestDataRelationshipsCase{ + Data: datadogV2.CreateJiraIssueRequestDataRelationshipsCaseData{ + Type: datadogV2.CASEDATATYPE_CASES, + Id: "6a773295-8729-4034-aada-53b64cbe02e7", + }, + }, + }, + }, + }, + Included: []datadogV2.CreateJiraIssueRequestArrayIncluded{ + datadogV2.CreateJiraIssueRequestArrayIncluded{ + CreateCaseRequestData: &datadogV2.CreateCaseRequestData{ + Type: datadogV2.CASEDATATYPE_CASES, + Attributes: &datadogV2.CreateCaseRequestDataAttributes{ + Title: datadog.PtrString("A title"), + Description: datadog.PtrString("A description"), + }, + Relationships: &datadogV2.CreateCaseRequestDataRelationships{ + Project: datadogV2.CaseManagementProject{ + Data: datadogV2.CaseManagementProjectData{ + Type: datadogV2.CASEMANAGEMENTPROJECTDATATYPE_PROJECTS, + Id: "959a6f71-bac8-4027-b1d3-2264f569296f", + }, + }, + Findings: datadogV2.Findings{ + Data: []datadogV2.FindingData{ + { + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + Id: "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=", + }, + }, + }, + }, + Id: datadog.PtrString("6a773295-8729-4034-aada-53b64cbe02e7"), + }}, + datadogV2.CreateJiraIssueRequestArrayIncluded{ + CaseManagementProjectData: &datadogV2.CaseManagementProjectData{ + Type: datadogV2.CASEMANAGEMENTPROJECTDATATYPE_PROJECTS, + Id: "959a6f71-bac8-4027-b1d3-2264f569296f", + }}, + datadogV2.CreateJiraIssueRequestArrayIncluded{ + FindingData: &datadogV2.FindingData{ + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + Id: "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=", + }}, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + resp, r, err := api.CreateJiraIssues(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.CreateJiraIssues`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.CreateJiraIssues`:\n%s\n", responseContent) +} diff --git a/examples/v2/security-monitoring/CreateJiraIssues_829823123.go b/examples/v2/security-monitoring/CreateJiraIssues_829823123.go new file mode 100644 index 00000000000..eb275859694 --- /dev/null +++ b/examples/v2/security-monitoring/CreateJiraIssues_829823123.go @@ -0,0 +1,91 @@ +// Create Jira issue for security findings returns "Created" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.CreateJiraIssueRequestArray{ + Data: []datadogV2.CreateJiraIssueRequestData{ + { + Type: datadogV2.JIRAISSUESDATATYPE_JIRA_ISSUES, + Attributes: &datadogV2.CreateJiraIssueRequestDataAttributes{}, + Relationships: &datadogV2.CreateJiraIssueRequestDataRelationships{ + Case: datadogV2.CreateJiraIssueRequestDataRelationshipsCase{ + Data: datadogV2.CreateJiraIssueRequestDataRelationshipsCaseData{ + Type: datadogV2.CASEDATATYPE_CASES, + Id: "e469ceda-957a-4557-a607-9ff25032e9ca", + }, + }, + }, + }, + }, + Included: []datadogV2.CreateJiraIssueRequestArrayIncluded{ + datadogV2.CreateJiraIssueRequestArrayIncluded{ + CreateCaseRequestData: &datadogV2.CreateCaseRequestData{ + Type: datadogV2.CASEDATATYPE_CASES, + Attributes: &datadogV2.CreateCaseRequestDataAttributes{ + Title: datadog.PtrString("A title"), + Description: datadog.PtrString("A description"), + }, + Relationships: &datadogV2.CreateCaseRequestDataRelationships{ + Project: datadogV2.CaseManagementProject{ + Data: datadogV2.CaseManagementProjectData{ + Type: datadogV2.CASEMANAGEMENTPROJECTDATATYPE_PROJECTS, + Id: "959a6f71-bac8-4027-b1d3-2264f569296f", + }, + }, + Findings: datadogV2.Findings{ + Data: []datadogV2.FindingData{ + { + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + Id: "MzUxMDI4OWYyYWEyODRhYjQ0Zjg2YjY2ZTFmNjRjYzd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY=", + }, + { + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + Id: "ZjE2ZGI5YjdmYTQyYzhhMDQ3Nzc3YjM1NGQ2Y2NmZTd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY=", + }, + }, + }, + }, + Id: datadog.PtrString("e469ceda-957a-4557-a607-9ff25032e9ca"), + }}, + datadogV2.CreateJiraIssueRequestArrayIncluded{ + CaseManagementProjectData: &datadogV2.CaseManagementProjectData{ + Type: datadogV2.CASEMANAGEMENTPROJECTDATATYPE_PROJECTS, + Id: "959a6f71-bac8-4027-b1d3-2264f569296f", + }}, + datadogV2.CreateJiraIssueRequestArrayIncluded{ + FindingData: &datadogV2.FindingData{ + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + Id: "MzUxMDI4OWYyYWEyODRhYjQ0Zjg2YjY2ZTFmNjRjYzd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY=", + }}, + datadogV2.CreateJiraIssueRequestArrayIncluded{ + FindingData: &datadogV2.FindingData{ + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + Id: "ZjE2ZGI5YjdmYTQyYzhhMDQ3Nzc3YjM1NGQ2Y2NmZTd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY=", + }}, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + resp, r, err := api.CreateJiraIssues(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.CreateJiraIssues`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.CreateJiraIssues`:\n%s\n", responseContent) +} diff --git a/examples/v2/security-monitoring/DetachCase.go b/examples/v2/security-monitoring/DetachCase.go new file mode 100644 index 00000000000..6f16934d13c --- /dev/null +++ b/examples/v2/security-monitoring/DetachCase.go @@ -0,0 +1,40 @@ +// Detach security findings from their case returns "No Content" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.DetachCaseRequest{ + Data: &datadogV2.DetachCaseRequestData{ + Relationships: &datadogV2.DetachCaseRequestDataRelationships{ + Findings: datadogV2.Findings{ + Data: []datadogV2.FindingData{ + { + Id: "YzM2MTFjYzcyNmY0Zjg4MTAxZmRlNjQ1MWU1ZGQwYzR-YzI5NzE5Y2Y4MzU4ZjliNzhkNjYxNTY0ODIzZDQ2YTM=", + Type: datadogV2.FINDINGDATATYPE_FINDINGS, + }, + }, + }, + }, + Type: datadogV2.CASEDATATYPE_CASES, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + r, err := api.DetachCase(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.DetachCase`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/teams/AddTeamHierarchyLink.go b/examples/v2/teams/AddTeamHierarchyLink.go new file mode 100644 index 00000000000..470c1d5506e --- /dev/null +++ b/examples/v2/teams/AddTeamHierarchyLink.go @@ -0,0 +1,54 @@ +// Create a team hierarchy link returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "dd_team" in the system + DdTeamDataID := os.Getenv("DD_TEAM_DATA_ID") + + // there is a valid "dd_team_2" in the system + DdTeam2DataID := os.Getenv("DD_TEAM_2_DATA_ID") + + body := datadogV2.TeamHierarchyLinkCreateRequest{ + Data: datadogV2.TeamHierarchyLinkCreate{ + Relationships: datadogV2.TeamHierarchyLinkCreateRelationships{ + ParentTeam: datadogV2.TeamHierarchyLinkCreateTeamRelationship{ + Data: datadogV2.TeamHierarchyLinkCreateTeam{ + Id: DdTeamDataID, + Type: datadogV2.TEAMTYPE_TEAM, + }, + }, + SubTeam: datadogV2.TeamHierarchyLinkCreateTeamRelationship{ + Data: datadogV2.TeamHierarchyLinkCreateTeam{ + Id: DdTeam2DataID, + Type: datadogV2.TEAMTYPE_TEAM, + }, + }, + }, + Type: datadogV2.TEAMHIERARCHYLINKTYPE_TEAM_HIERARCHY_LINKS, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewTeamsApi(apiClient) + resp, r, err := api.AddTeamHierarchyLink(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TeamsApi.AddTeamHierarchyLink`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `TeamsApi.AddTeamHierarchyLink`:\n%s\n", responseContent) +} diff --git a/examples/v2/teams/GetTeamHierarchyLink.go b/examples/v2/teams/GetTeamHierarchyLink.go new file mode 100644 index 00000000000..8b2a9b035a6 --- /dev/null +++ b/examples/v2/teams/GetTeamHierarchyLink.go @@ -0,0 +1,32 @@ +// Get a team hierarchy link returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "team_hierarchy_link" in the system + TeamHierarchyLinkDataID := os.Getenv("TEAM_HIERARCHY_LINK_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewTeamsApi(apiClient) + resp, r, err := api.GetTeamHierarchyLink(ctx, TeamHierarchyLinkDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TeamsApi.GetTeamHierarchyLink`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `TeamsApi.GetTeamHierarchyLink`:\n%s\n", responseContent) +} diff --git a/examples/v2/teams/ListTeamHierarchyLinks.go b/examples/v2/teams/ListTeamHierarchyLinks.go new file mode 100644 index 00000000000..2467c2fa849 --- /dev/null +++ b/examples/v2/teams/ListTeamHierarchyLinks.go @@ -0,0 +1,33 @@ +// Get team hierarchy links returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "team_hierarchy_link" in the system + TeamHierarchyLinkDataRelationshipsParentTeamDataID := os.Getenv("TEAM_HIERARCHY_LINK_DATA_RELATIONSHIPS_PARENT_TEAM_DATA_ID") + TeamHierarchyLinkDataRelationshipsSubTeamDataID := os.Getenv("TEAM_HIERARCHY_LINK_DATA_RELATIONSHIPS_SUB_TEAM_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewTeamsApi(apiClient) + resp, r, err := api.ListTeamHierarchyLinks(ctx, *datadogV2.NewListTeamHierarchyLinksOptionalParameters().WithFilterParentTeam(TeamHierarchyLinkDataRelationshipsParentTeamDataID).WithFilterSubTeam(TeamHierarchyLinkDataRelationshipsSubTeamDataID).WithPageNumber(0).WithPageSize(100)) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TeamsApi.ListTeamHierarchyLinks`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `TeamsApi.ListTeamHierarchyLinks`:\n%s\n", responseContent) +} diff --git a/examples/v2/teams/ListTeamHierarchyLinks_3360757486.go b/examples/v2/teams/ListTeamHierarchyLinks_3360757486.go new file mode 100644 index 00000000000..2100f34fa5c --- /dev/null +++ b/examples/v2/teams/ListTeamHierarchyLinks_3360757486.go @@ -0,0 +1,29 @@ +// Get team hierarchy links returns "OK" response with pagination + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewTeamsApi(apiClient) + resp, _ := api.ListTeamHierarchyLinksWithPagination(ctx, *datadogV2.NewListTeamHierarchyLinksOptionalParameters()) + + for paginationResult := range resp { + if paginationResult.Error != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TeamsApi.ListTeamHierarchyLinks`: %v\n", paginationResult.Error) + } + responseContent, _ := json.MarshalIndent(paginationResult.Item, "", " ") + fmt.Fprintf(os.Stdout, "%s\n", responseContent) + } +} diff --git a/examples/v2/teams/RemoveTeamHierarchyLink.go b/examples/v2/teams/RemoveTeamHierarchyLink.go new file mode 100644 index 00000000000..d6690982165 --- /dev/null +++ b/examples/v2/teams/RemoveTeamHierarchyLink.go @@ -0,0 +1,28 @@ +// Remove a team hierarchy link returns "No Content" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "team_hierarchy_link" in the system + TeamHierarchyLinkDataID := os.Getenv("TEAM_HIERARCHY_LINK_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewTeamsApi(apiClient) + r, err := api.RemoveTeamHierarchyLink(ctx, TeamHierarchyLinkDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TeamsApi.RemoveTeamHierarchyLink`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_finding_to_a_Jira_issue_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_finding_to_a_Jira_issue_returns_OK_response.freeze new file mode 100644 index 00000000000..e21d532e446 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_finding_to_a_Jira_issue_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-20T15:49:48.969Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_finding_to_a_Jira_issue_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_finding_to_a_Jira_issue_returns_OK_response.yaml new file mode 100644 index 00000000000..8897f351e46 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_finding_to_a_Jira_issue_returns_OK_response.yaml @@ -0,0 +1,24 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"jira_issue_url":"https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476"},"relationships":{"findings":{"data":[{"id":"OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI=","type":"findings"}]},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}},"type":"jira_issues"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/security/findings/jira_issues + response: + body: '{"data":{"id":"9efb1118-ed9c-4b02-b13b-f3acf8415f7c","type":"cases","attributes":{"created_at":"2025-11-20T15:22:44.644286Z","creation_source":"CS_SECURITY_FINDING","description":"A + description","insights":[{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/94762d2f0123331575cd81095e450f09?detection=static","resource_id":"OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI="}],"jira_issue":{"status":"COMPLETED","result":{"issue_id":"2404808","issue_key":"CSMSEC-105476","issue_url":"https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476","account_id":"fdcffa62-24ab-4914-a195-a22bdc607030"}},"key":"CSMINV-463","modified_at":"2025-11-20T15:49:53.272293Z","priority":"NOT_DEFINED","status":"OPEN","status_group":"SG_OPEN","status_name":"Open","title":"A + title","type":"SECURITY"},"relationships":{"created_by":{"data":{"id":"dc09afab-6ae7-11ef-92b1-828dac1b0195","type":"users"}},"modified_by":{"data":{"id":"dc09afab-6ae7-11ef-92b1-828dac1b0195","type":"users"}},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_finding_to_a_case_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_finding_to_a_case_returns_OK_response.freeze new file mode 100644 index 00000000000..24c38af62ef --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_finding_to_a_case_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-19T16:20:46.726Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_finding_to_a_case_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_finding_to_a_case_returns_OK_response.yaml new file mode 100644 index 00000000000..74ea573576d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_finding_to_a_case_returns_OK_response.yaml @@ -0,0 +1,24 @@ +interactions: +- request: + body: | + {"data":{"id":"7d16945b-baf8-411e-ab2a-20fe43af1ea3","relationships":{"findings":{"data":[{"id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=","type":"findings"}]}},"type":"cases"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/security/findings/cases/7d16945b-baf8-411e-ab2a-20fe43af1ea3 + response: + body: '{"data":{"id":"7d16945b-baf8-411e-ab2a-20fe43af1ea3","type":"cases","attributes":{"created_at":"2025-11-19T13:54:23.634063Z","creation_source":"CS_SECURITY_FINDING","description":"A + description","insights":[{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/dfa027f7c037b2f77159adc027fecb56?detection=static","resource_id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y="}],"key":"CSMINV-459","modified_at":"2025-11-19T16:20:51.754979Z","priority":"NOT_DEFINED","status":"OPEN","status_group":"SG_OPEN","status_name":"Open","title":"A + title","type":"SECURITY"},"relationships":{"created_by":{"data":{"id":"dc09afab-6ae7-11ef-92b1-828dac1b0195","type":"users"}},"modified_by":{"data":{"id":"dc09afab-6ae7-11ef-92b1-828dac1b0195","type":"users"}},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..7b6703448ac --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-11-20T15:53:19.037Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..fcb04e59a9d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_Bad_Request_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"jira_issue_url":"https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476"},"relationships":{"findings":{"data":[]},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}},"type":"jira_issues"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/security/findings/jira_issues + response: + body: '{"errors":[{"status":"400","title":"Bad Request","detail":"no finding provided"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..4495f3bf05a --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-11-20T15:59:56.064Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..b695a866494 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_Not_Found_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"jira_issue_url":"https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476"},"relationships":{"findings":{"data":[{"id":"wrong-finding-id","type":"findings"}]},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}},"type":"jira_issues"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/security/findings/jira_issues + response: + body: '{"errors":[{"status":"404","title":"Not Found","detail":"finding not found"}]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_OK_response.freeze new file mode 100644 index 00000000000..8a74e023fa9 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-20T15:52:21.664Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_OK_response.yaml new file mode 100644 index 00000000000..b75d3f83931 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_Jira_issue_returns_OK_response.yaml @@ -0,0 +1,24 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"jira_issue_url":"https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476"},"relationships":{"findings":{"data":[{"id":"OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI=","type":"findings"},{"id":"MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM=","type":"findings"}]},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}},"type":"jira_issues"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/security/findings/jira_issues + response: + body: '{"data":{"id":"9efb1118-ed9c-4b02-b13b-f3acf8415f7c","type":"cases","attributes":{"created_at":"2025-11-20T15:22:44.644286Z","creation_source":"CS_SECURITY_FINDING","description":"A + description","insights":[{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/94762d2f0123331575cd81095e450f09?detection=static","resource_id":"OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI="},{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/13c7ffac3021be5d1bd4c5e07b575fca?detection=static","resource_id":"MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM="}],"jira_issue":{"status":"COMPLETED","result":{"issue_id":"2404808","issue_key":"CSMSEC-105476","issue_url":"https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476","account_id":"fdcffa62-24ab-4914-a195-a22bdc607030"}},"key":"CSMINV-463","modified_at":"2025-11-20T15:52:25.368628Z","priority":"NOT_DEFINED","status":"OPEN","status_group":"SG_OPEN","status_name":"Open","title":"A + title","type":"SECURITY"},"relationships":{"created_by":{"data":{"id":"dc09afab-6ae7-11ef-92b1-828dac1b0195","type":"users"}},"modified_by":{"data":{"id":"dc09afab-6ae7-11ef-92b1-828dac1b0195","type":"users"}},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..1adeacaf476 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-11-19T16:16:38.781Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..b866aa1a208 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_Bad_Request_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: | + {"data":{"id":"7d16945b-baf8-411e-ab2a-20fe43af1ea3","relationships":{"findings":{"data":[]}},"type":"cases"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/security/findings/cases/7d16945b-baf8-411e-ab2a-20fe43af1ea3 + response: + body: '{"errors":[{"status":"400","title":"Bad Request","detail":"no finding provided"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..ed7d98397fd --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-11-19T16:17:49.938Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..3ba9e861ac3 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_Not_Found_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + {"data":{"id":"wrong-case-id","relationships":{"findings":{"data":[{"id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=","type":"findings"}]}},"type":"cases"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/security/findings/cases/wrong-case-id + response: + body: '{"errors":[{"status":"404","title":"Not Found","detail":"failed to get + case: case not found"}]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_OK_response.freeze new file mode 100644 index 00000000000..376033b3d93 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-19T16:23:42.957Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_OK_response.yaml new file mode 100644 index 00000000000..2daaca2d6e9 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Attach_security_findings_to_a_case_returns_OK_response.yaml @@ -0,0 +1,24 @@ +interactions: +- request: + body: | + {"data":{"id":"7d16945b-baf8-411e-ab2a-20fe43af1ea3","relationships":{"findings":{"data":[{"id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=","type":"findings"},{"id":"MmUzMzZkODQ2YTI3NDU0OTk4NDk3NzhkOTY5YjU2Zjh-YWJjZGI1ODI4OTYzNWM3ZmUwZTBlOWRkYTRiMGUyOGQ=","type":"findings"}]}},"type":"cases"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: PATCH + url: https://api.datadoghq.com/api/v2/security/findings/cases/7d16945b-baf8-411e-ab2a-20fe43af1ea3 + response: + body: '{"data":{"id":"7d16945b-baf8-411e-ab2a-20fe43af1ea3","type":"cases","attributes":{"created_at":"2025-11-19T13:54:23.634063Z","creation_source":"CS_SECURITY_FINDING","description":"A + description","insights":[{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/dfa027f7c037b2f77159adc027fecb56?detection=static","resource_id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y="},{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/36d53183f8fefbbc2208878f3d2011f0?detection=static","resource_id":"MzZkNTMxODNmOGZlZmJiYzIyMDg4NzhmM2QyMDExZjB-ZmY5NzUwNDQzYTE0MGIyNDM1MTg4YjkxZDNmMDU4OGU="},{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/2e336d846a2745499849778d969b56f8?detection=static","resource_id":"MmUzMzZkODQ2YTI3NDU0OTk4NDk3NzhkOTY5YjU2Zjh-YWJjZGI1ODI4OTYzNWM3ZmUwZTBlOWRkYTRiMGUyOGQ="}],"key":"CSMINV-459","modified_at":"2025-11-19T16:23:22.109092Z","priority":"NOT_DEFINED","status":"OPEN","status_group":"SG_OPEN","status_name":"Open","title":"A + title","type":"SECURITY"},"relationships":{"created_by":{"data":{"id":"dc09afab-6ae7-11ef-92b1-828dac1b0195","type":"users"}},"modified_by":{"data":{"id":"dc09afab-6ae7-11ef-92b1-828dac1b0195","type":"users"}},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issue_for_security_finding_returns_Created_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issue_for_security_finding_returns_Created_response.freeze new file mode 100644 index 00000000000..6c188712b92 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issue_for_security_finding_returns_Created_response.freeze @@ -0,0 +1 @@ +2025-11-19T17:01:11.179Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issue_for_security_finding_returns_Created_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issue_for_security_finding_returns_Created_response.yaml new file mode 100644 index 00000000000..7bfe982708d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issue_for_security_finding_returns_Created_response.yaml @@ -0,0 +1,42 @@ +interactions: +- request: + body: | + {"data":[{"attributes":{},"relationships":{"case":{"data":{"id":"6a773295-8729-4034-aada-53b64cbe02e7","type":"cases"}}},"type":"jira_issues"}],"included":[{"attributes":{"description":"A description","title":"A title"},"id":"6a773295-8729-4034-aada-53b64cbe02e7","relationships":{"findings":{"data":[{"id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=","type":"findings"}]},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}},"type":"cases"},{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"},{"id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=","type":"findings"}]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/security/findings/jira_issues + response: + body: '{"data":[{"id":"6a773295-8729-4034-aada-53b64cbe02e7","type":"cases","attributes":{"created_at":"2025-11-19T17:01:15.21452Z","creation_source":"CS_SECURITY_FINDING","description":"A + description","insights":[{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/dfa027f7c037b2f77159adc027fecb56?detection=static","resource_id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y="}],"jira_issue":{"status":"COMPLETED","result":{"issue_id":"2402037","issue_key":"CSMSEC-105473","issue_url":"https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105473","account_id":"fdcffa62-24ab-4914-a195-a22bdc607030"}},"key":"CSMINV-461","modified_at":"2025-11-19T17:01:16.621974Z","priority":"NOT_DEFINED","status":"OPEN","status_group":"SG_OPEN","status_name":"Open","title":"A + title","type":"SECURITY"},"relationships":{"created_by":{"data":{"id":"dc09afab-6ae7-11ef-92b1-828dac1b0195","type":"users"}},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}}}]}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"id":"6a773295-8729-4034-aada-53b64cbe02e7","relationships":{"findings":{"data":[{"id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=","type":"findings"}]}},"type":"cases"}} + form: {} + headers: + Accept: + - '*/*' + Content-Type: + - application/json + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/security/findings/cases + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issue_for_security_findings_returns_Created_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issue_for_security_findings_returns_Created_response.freeze new file mode 100644 index 00000000000..8bb7a59bf99 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issue_for_security_findings_returns_Created_response.freeze @@ -0,0 +1 @@ +2025-11-21T14:49:30.001Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issue_for_security_findings_returns_Created_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issue_for_security_findings_returns_Created_response.yaml new file mode 100644 index 00000000000..1680610cd9b --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issue_for_security_findings_returns_Created_response.yaml @@ -0,0 +1,42 @@ +interactions: +- request: + body: | + {"data":[{"attributes":{},"relationships":{"case":{"data":{"id":"e469ceda-957a-4557-a607-9ff25032e9ca","type":"cases"}}},"type":"jira_issues"}],"included":[{"attributes":{"description":"A description","title":"A title"},"id":"e469ceda-957a-4557-a607-9ff25032e9ca","relationships":{"findings":{"data":[{"id":"MzUxMDI4OWYyYWEyODRhYjQ0Zjg2YjY2ZTFmNjRjYzd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY=","type":"findings"},{"id":"ZjE2ZGI5YjdmYTQyYzhhMDQ3Nzc3YjM1NGQ2Y2NmZTd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY=","type":"findings"}]},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}},"type":"cases"},{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"},{"id":"MzUxMDI4OWYyYWEyODRhYjQ0Zjg2YjY2ZTFmNjRjYzd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY=","type":"findings"},{"id":"ZjE2ZGI5YjdmYTQyYzhhMDQ3Nzc3YjM1NGQ2Y2NmZTd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY=","type":"findings"}]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/security/findings/jira_issues + response: + body: '{"data":[{"id":"e469ceda-957a-4557-a607-9ff25032e9ca","type":"cases","attributes":{"created_at":"2025-11-21T14:49:32.034826Z","creation_source":"CS_SECURITY_FINDING","description":"A + description","insights":[{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/f16db9b7fa42c8a047777b354d6ccfe7?detection=static","resource_id":"ZjE2ZGI5YjdmYTQyYzhhMDQ3Nzc3YjM1NGQ2Y2NmZTd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY="},{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/3510289f2aa284ab44f86b66e1f64cc7?detection=static","resource_id":"MzUxMDI4OWYyYWEyODRhYjQ0Zjg2YjY2ZTFmNjRjYzd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY="}],"jira_issue":{"status":"COMPLETED","result":{"issue_id":"2407744","issue_key":"CSMSEC-105481","issue_url":"https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105481","account_id":"fdcffa62-24ab-4914-a195-a22bdc607030"}},"key":"CSMINV-468","modified_at":"2025-11-21T14:49:33.306003Z","priority":"NOT_DEFINED","status":"OPEN","status_group":"SG_OPEN","status_name":"Open","title":"A + title","type":"SECURITY"},"relationships":{"created_by":{"data":{"id":"dc09afab-6ae7-11ef-92b1-828dac1b0195","type":"users"}},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}}}]}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"id":"e469ceda-957a-4557-a607-9ff25032e9ca","relationships":{"findings":{"data":[{"id":"ZjE2ZGI5YjdmYTQyYzhhMDQ3Nzc3YjM1NGQ2Y2NmZTd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY=","type":"findings"}]}},"type":"cases"}} + form: {} + headers: + Accept: + - '*/*' + Content-Type: + - application/json + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/security/findings/cases + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..ff98ffb1a13 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-11-20T12:01:47.295Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..33932496cb9 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Bad_Request_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: | + {"data":[{"attributes":{},"relationships":{"case":{"data":{"id":"a7c38bab-ae98-4113-878c-c98799f914c2","type":"cases"}}},"type":"jira_issues"}],"included":[{"id":"a7c38bab-ae98-4113-878c-c98799f914c2","relationships":{"findings":{"data":[]},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}},"type":"cases"},{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/security/findings/jira_issues + response: + body: '{"errors":[{"status":"400","title":"Bad Request","detail":"no finding provided"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Created_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Created_response.freeze new file mode 100644 index 00000000000..e5b6d0d76b3 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Created_response.freeze @@ -0,0 +1 @@ +2025-11-20T15:32:21.828Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Created_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Created_response.yaml new file mode 100644 index 00000000000..f20a803a0a2 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Created_response.yaml @@ -0,0 +1,44 @@ +interactions: +- request: + body: | + {"data":[{"attributes":{},"relationships":{"case":{"data":{"id":"53e242c6-a7d6-46ad-9680-b8d14753f716","type":"cases"}}},"type":"jira_issues"},{"attributes":{},"relationships":{"case":{"data":{"id":"195772b2-1f53-41d2-b81e-48c8e6c21d33","type":"cases"}}},"type":"jira_issues"}],"included":[{"attributes":{"description":"A description","title":"A title"},"id":"53e242c6-a7d6-46ad-9680-b8d14753f716","relationships":{"findings":{"data":[{"id":"OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI=","type":"findings"}]},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}},"type":"cases"},{"attributes":{"description":"A description","title":"A title"},"id":"195772b2-1f53-41d2-b81e-48c8e6c21d33","relationships":{"findings":{"data":[{"id":"MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM=","type":"findings"}]},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}},"type":"cases"},{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"},{"id":"OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI=","type":"findings"},{"id":"MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM=","type":"findings"}]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/security/findings/jira_issues + response: + body: '{"data":[{"id":"53e242c6-a7d6-46ad-9680-b8d14753f716","type":"cases","attributes":{"created_at":"2025-11-20T15:32:23.777159Z","creation_source":"CS_SECURITY_FINDING","description":"A + description","insights":[{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/94762d2f0123331575cd81095e450f09?detection=static","resource_id":"OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI="}],"jira_issue":{"status":"COMPLETED","result":{"issue_id":"2404837","issue_key":"CSMSEC-105480","issue_url":"https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105480","account_id":"fdcffa62-24ab-4914-a195-a22bdc607030"}},"key":"CSMINV-467","modified_at":"2025-11-20T15:32:25.088199Z","priority":"NOT_DEFINED","status":"OPEN","status_group":"SG_OPEN","status_name":"Open","title":"A + title","type":"SECURITY"},"relationships":{"created_by":{"data":{"id":"dc09afab-6ae7-11ef-92b1-828dac1b0195","type":"users"}},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}}},{"id":"195772b2-1f53-41d2-b81e-48c8e6c21d33","type":"cases","attributes":{"created_at":"2025-11-20T15:32:23.776904Z","creation_source":"CS_SECURITY_FINDING","description":"A + description","insights":[{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/13c7ffac3021be5d1bd4c5e07b575fca?detection=static","resource_id":"MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM="}],"jira_issue":{"status":"COMPLETED","result":{"issue_id":"2404836","issue_key":"CSMSEC-105479","issue_url":"https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105479","account_id":"fdcffa62-24ab-4914-a195-a22bdc607030"}},"key":"CSMINV-466","modified_at":"2025-11-20T15:32:24.96456Z","priority":"NOT_DEFINED","status":"OPEN","status_group":"SG_OPEN","status_name":"Open","title":"A + title","type":"SECURITY"},"relationships":{"created_by":{"data":{"id":"dc09afab-6ae7-11ef-92b1-828dac1b0195","type":"users"}},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}}}]}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"id":"53e242c6-a7d6-46ad-9680-b8d14753f716","relationships":{"findings":{"data":[{"id":"OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI=","type":"findings"}]}},"type":"cases"}} + form: {} + headers: + Accept: + - '*/*' + Content-Type: + - application/json + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/security/findings/cases + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..f0ed0dd3f18 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-11-20T15:42:51.100Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..850ae9475c1 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_Jira_issues_for_security_findings_returns_Not_Found_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: | + {"data":[{"attributes":{},"relationships":{"case":{"data":{"id":"6ed1d7c2-e1a3-4369-b92b-a38d3cc75cf3","type":"cases"}}},"type":"jira_issues"}],"included":[{"attributes":{"description":"A description","title":"A title"},"id":"6ed1d7c2-e1a3-4369-b92b-a38d3cc75cf3","relationships":{"findings":{"data":[{"id":"YzM2MTFjYzcyNmY0Zjg4MTAxZmRlNjQ1MWU1ZGQwYzR-YzI5NzE5Y2Y4MzU4ZjliNzhkNjYxNTY0ODIzZDQ2YTM=","type":"findings"}]},"project":{"data":{"id":"00000000-0000-0000-0000-000000000000","type":"projects"}}},"type":"cases"},{"id":"00000000-0000-0000-0000-000000000000","type":"projects"},{"id":"YzM2MTFjYzcyNmY0Zjg4MTAxZmRlNjQ1MWU1ZGQwYzR-YzI5NzE5Y2Y4MzU4ZjliNzhkNjYxNTY0ODIzZDQ2YTM=","type":"findings"}]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/security/findings/jira_issues + response: + body: '{"errors":[{"status":"404","title":"Not Found","detail":"project not found"}]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_case_for_security_finding_returns_Created_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_case_for_security_finding_returns_Created_response.freeze new file mode 100644 index 00000000000..a6ccca66ab5 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_case_for_security_finding_returns_Created_response.freeze @@ -0,0 +1 @@ +2025-11-19T13:45:48.321Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_case_for_security_finding_returns_Created_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_case_for_security_finding_returns_Created_response.yaml new file mode 100644 index 00000000000..51cd29cc7fd --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_case_for_security_finding_returns_Created_response.yaml @@ -0,0 +1,42 @@ +interactions: +- request: + body: | + {"data":[{"attributes":{"description":"A description","title":"A title"},"relationships":{"findings":{"data":[{"id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=","type":"findings"}]},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}},"type":"cases"}]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/security/findings/cases + response: + body: '{"data":[{"id":"639c5df7-2352-4fc6-9d39-7dc8bdb8af14","type":"cases","attributes":{"created_at":"2025-11-19T13:45:50.295906Z","creation_source":"CS_SECURITY_FINDING","description":"A + description","insights":[{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/dfa027f7c037b2f77159adc027fecb56?detection=static","resource_id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y="}],"key":"CSMINV-454","priority":"NOT_DEFINED","status":"OPEN","status_group":"SG_OPEN","status_name":"Open","title":"A + title","type":"SECURITY"},"relationships":{"created_by":{"data":{"id":"dc09afab-6ae7-11ef-92b1-828dac1b0195","type":"users"}},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}}}]}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"id":"639c5df7-2352-4fc6-9d39-7dc8bdb8af14","relationships":{"findings":{"data":[{"id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=","type":"findings"}]}},"type":"cases"}} + form: {} + headers: + Accept: + - '*/*' + Content-Type: + - application/json + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/security/findings/cases + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_case_for_security_findings_returns_Created_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_case_for_security_findings_returns_Created_response.freeze new file mode 100644 index 00000000000..11d711428d3 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_case_for_security_findings_returns_Created_response.freeze @@ -0,0 +1 @@ +2025-11-19T13:46:07.661Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_case_for_security_findings_returns_Created_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_case_for_security_findings_returns_Created_response.yaml new file mode 100644 index 00000000000..8bf85139cf1 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_case_for_security_findings_returns_Created_response.yaml @@ -0,0 +1,42 @@ +interactions: +- request: + body: | + {"data":[{"attributes":{"description":"A description","title":"A title"},"relationships":{"findings":{"data":[{"id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=","type":"findings"},{"id":"MzZkNTMxODNmOGZlZmJiYzIyMDg4NzhmM2QyMDExZjB-ZmY5NzUwNDQzYTE0MGIyNDM1MTg4YjkxZDNmMDU4OGU=","type":"findings"}]},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}},"type":"cases"}]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/security/findings/cases + response: + body: '{"data":[{"id":"2c1ac0c4-e8cf-4699-8781-09077b10d2a0","type":"cases","attributes":{"created_at":"2025-11-19T13:46:09.874194Z","creation_source":"CS_SECURITY_FINDING","description":"A + description","insights":[{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/36d53183f8fefbbc2208878f3d2011f0?detection=static","resource_id":"MzZkNTMxODNmOGZlZmJiYzIyMDg4NzhmM2QyMDExZjB-ZmY5NzUwNDQzYTE0MGIyNDM1MTg4YjkxZDNmMDU4OGU="},{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/dfa027f7c037b2f77159adc027fecb56?detection=static","resource_id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y="}],"key":"CSMINV-455","priority":"NOT_DEFINED","status":"OPEN","status_group":"SG_OPEN","status_name":"Open","title":"A + title","type":"SECURITY"},"relationships":{"created_by":{"data":{"id":"dc09afab-6ae7-11ef-92b1-828dac1b0195","type":"users"}},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}}}]}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"id":"2c1ac0c4-e8cf-4699-8781-09077b10d2a0","relationships":{"findings":{"data":[{"id":"MzZkNTMxODNmOGZlZmJiYzIyMDg4NzhmM2QyMDExZjB-ZmY5NzUwNDQzYTE0MGIyNDM1MTg4YjkxZDNmMDU4OGU=","type":"findings"}]}},"type":"cases"}} + form: {} + headers: + Accept: + - '*/*' + Content-Type: + - application/json + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/security/findings/cases + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..03dcf162312 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-11-19T13:46:49.148Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..3d3469d18b6 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Bad_Request_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: | + {"data":[{"attributes":{},"relationships":{"findings":{"data":[]},"project":{"data":{"id":"7f198869-c7ef-4afc-97cf-da5cdc13b5c3","type":"projects"}}},"type":"cases"}]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/security/findings/cases + response: + body: '{"errors":[{"status":"400","title":"Bad Request","detail":"no finding provided"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Created_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Created_response.freeze new file mode 100644 index 00000000000..d1e05ac25c0 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Created_response.freeze @@ -0,0 +1 @@ +2025-11-19T13:54:20.603Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Created_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Created_response.yaml new file mode 100644 index 00000000000..a0058ebddf5 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Created_response.yaml @@ -0,0 +1,44 @@ +interactions: +- request: + body: | + {"data":[{"attributes":{"description":"A description","title":"A title"},"relationships":{"findings":{"data":[{"id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=","type":"findings"}]},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}},"type":"cases"},{"attributes":{"description":"A description","title":"A title"},"relationships":{"findings":{"data":[{"id":"MzZkNTMxODNmOGZlZmJiYzIyMDg4NzhmM2QyMDExZjB-ZmY5NzUwNDQzYTE0MGIyNDM1MTg4YjkxZDNmMDU4OGU=","type":"findings"}]},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}},"type":"cases"}]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/security/findings/cases + response: + body: '{"data":[{"id":"7d16945b-baf8-411e-ab2a-20fe43af1ea3","type":"cases","attributes":{"created_at":"2025-11-19T13:54:23.634063Z","creation_source":"CS_SECURITY_FINDING","description":"A + description","insights":[{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/dfa027f7c037b2f77159adc027fecb56?detection=static","resource_id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y="}],"key":"CSMINV-459","priority":"NOT_DEFINED","status":"OPEN","status_group":"SG_OPEN","status_name":"Open","title":"A + title","type":"SECURITY"},"relationships":{"created_by":{"data":{"id":"dc09afab-6ae7-11ef-92b1-828dac1b0195","type":"users"}},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}}},{"id":"601cab78-ef04-4bdf-901a-55533afbde0b","type":"cases","attributes":{"created_at":"2025-11-19T13:54:23.634552Z","creation_source":"CS_SECURITY_FINDING","description":"A + description","insights":[{"type":"SECURITY_FINDING","ref":"/security/appsec/vm/library/vulnerability/36d53183f8fefbbc2208878f3d2011f0?detection=static","resource_id":"MzZkNTMxODNmOGZlZmJiYzIyMDg4NzhmM2QyMDExZjB-ZmY5NzUwNDQzYTE0MGIyNDM1MTg4YjkxZDNmMDU4OGU="}],"key":"CSMINV-458","priority":"NOT_DEFINED","status":"OPEN","status_group":"SG_OPEN","status_name":"Open","title":"A + title","type":"SECURITY"},"relationships":{"created_by":{"data":{"id":"dc09afab-6ae7-11ef-92b1-828dac1b0195","type":"users"}},"project":{"data":{"id":"959a6f71-bac8-4027-b1d3-2264f569296f","type":"projects"}}}}]}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"id":"7d16945b-baf8-411e-ab2a-20fe43af1ea3","relationships":{"findings":{"data":[{"id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=","type":"findings"}]}},"type":"cases"}} + form: {} + headers: + Accept: + - '*/*' + Content-Type: + - application/json + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/security/findings/cases + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..331897b6e2e --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-11-19T13:47:19.797Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..2bc2eb92db7 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Create_cases_for_security_findings_returns_Not_Found_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: | + {"data":[{"attributes":{},"relationships":{"findings":{"data":[{"id":"ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=","type":"findings"}]},"project":{"data":{"id":"00000000-0000-0000-0000-000000000000","type":"projects"}}},"type":"cases"}]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/security/findings/cases + response: + body: '{"errors":[{"status":"404","title":"Not Found","detail":"project not found"}]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..48119112e5d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-11-20T16:07:27.292Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..cf17d08685c --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_Bad_Request_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: | + {"data":{"relationships":{"findings":{"data":[]}},"type":"cases"}} + form: {} + headers: + Accept: + - '*/*' + Content-Type: + - application/json + id: 0 + method: DELETE + url: https://api.datadoghq.com/api/v2/security/findings/cases + response: + body: '{"errors":[{"status":"400","title":"Bad Request","detail":"no finding provided"}]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_No_Content_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_No_Content_response.freeze new file mode 100644 index 00000000000..3e388493c63 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_No_Content_response.freeze @@ -0,0 +1 @@ +2025-11-21T13:41:10.798Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_No_Content_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_No_Content_response.yaml new file mode 100644 index 00000000000..b024aeccaba --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_No_Content_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: | + {"data":{"relationships":{"findings":{"data":[{"id":"YzM2MTFjYzcyNmY0Zjg4MTAxZmRlNjQ1MWU1ZGQwYzR-YzI5NzE5Y2Y4MzU4ZjliNzhkNjYxNTY0ODIzZDQ2YTM=","type":"findings"}]}},"type":"cases"}} + form: {} + headers: + Accept: + - '*/*' + Content-Type: + - application/json + id: 0 + method: DELETE + url: https://api.datadoghq.com/api/v2/security/findings/cases + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..72e1b275efe --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-11-20T16:06:53.415Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..0b1dfca6227 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Security_Monitoring/Scenario_Detach_security_findings_from_their_case_returns_Not_Found_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: | + {"data":{"relationships":{"findings":{"data":[{"id":"wrong-finding-id","type":"findings"}]}},"type":"cases"}} + form: {} + headers: + Accept: + - '*/*' + Content-Type: + - application/json + id: 0 + method: DELETE + url: https://api.datadoghq.com/api/v2/security/findings/cases + response: + body: '{"errors":[{"status":"404","title":"Not Found","detail":"finding not found"}]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_CREATED_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_CREATED_response.freeze new file mode 100644 index 00000000000..5ca151ab8b7 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_CREATED_response.freeze @@ -0,0 +1 @@ +2025-11-24T14:29:58.684Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_CREATED_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_CREATED_response.yaml new file mode 100644 index 00000000000..92f23b8097f --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_CREATED_response.yaml @@ -0,0 +1,107 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-34095e00d70ee50a","name":"test-name-34095e00d70ee50a"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"551c947a-0f0f-4ff0-8c41-0ceddabe3551","type":"team","attributes":{"avatar":null,"banner":3,"created_at":"2025-11-24T14:29:59.195740+00:00","description":null,"handle":"test-handle-34095e00d70ee50a","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T14:29:59.195740+00:00","name":"test-name-34095e00d70ee50a","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/551c947a-0f0f-4ff0-8c41-0ceddabe3551/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/551c947a-0f0f-4ff0-8c41-0ceddabe3551/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-2-34095e00d70ee50a","name":"test-name-2-34095e00d70ee50a"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"e1c6ab08-0325-4df7-aea1-6bec76692d55","type":"team","attributes":{"avatar":null,"banner":14,"created_at":"2025-11-24T14:29:59.754699+00:00","description":null,"handle":"test-handle-2-34095e00d70ee50a","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T14:29:59.754699+00:00","name":"test-name-2-34095e00d70ee50a","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/e1c6ab08-0325-4df7-aea1-6bec76692d55/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/e1c6ab08-0325-4df7-aea1-6bec76692d55/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"relationships":{"parent_team":{"data":{"id":"551c947a-0f0f-4ff0-8c41-0ceddabe3551","type":"team"}},"sub_team":{"data":{"id":"e1c6ab08-0325-4df7-aea1-6bec76692d55","type":"team"}}},"type":"team_hierarchy_links"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: POST + url: https://api.datadoghq.com/api/v2/team-hierarchy-links + response: + body: '{"data":{"id":"c53bed14-1c0a-4895-b845-1c04be086ba0","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T14:30:00.032477595Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"551c947a-0f0f-4ff0-8c41-0ceddabe3551","type":"team"}},"sub_team":{"data":{"id":"e1c6ab08-0325-4df7-aea1-6bec76692d55","type":"team"}}}},"included":[{"id":"551c947a-0f0f-4ff0-8c41-0ceddabe3551","type":"team","attributes":{"avatar":null,"banner":3,"handle":"test-handle-34095e00d70ee50a","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-34095e00d70ee50a","summary":null,"user_count":0}},{"id":"e1c6ab08-0325-4df7-aea1-6bec76692d55","type":"team","attributes":{"avatar":null,"banner":14,"handle":"test-handle-2-34095e00d70ee50a","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-2-34095e00d70ee50a","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/c53bed14-1c0a-4895-b845-1c04be086ba0 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/e1c6ab08-0325-4df7-aea1-6bec76692d55 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 5 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/551c947a-0f0f-4ff0-8c41-0ceddabe3551 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_Conflict_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_Conflict_response.freeze new file mode 100644 index 00000000000..4da94657eeb --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_Conflict_response.freeze @@ -0,0 +1 @@ +2025-11-24T17:06:46.856Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_Conflict_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_Conflict_response.yaml new file mode 100644 index 00000000000..9fe1272ea99 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_Conflict_response.yaml @@ -0,0 +1,130 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-6c891437b748aea8","name":"test-name-6c891437b748aea8"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87","type":"team","attributes":{"avatar":null,"banner":0,"created_at":"2025-11-24T17:06:47.453319+00:00","description":null,"handle":"test-handle-6c891437b748aea8","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T17:06:47.453319+00:00","name":"test-name-6c891437b748aea8","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-2-6c891437b748aea8","name":"test-name-2-6c891437b748aea8"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"21296c73-c9e2-4889-a33f-417d2974b2bd","type":"team","attributes":{"avatar":null,"banner":2,"created_at":"2025-11-24T17:06:48.020887+00:00","description":null,"handle":"test-handle-2-6c891437b748aea8","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T17:06:48.020887+00:00","name":"test-name-2-6c891437b748aea8","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/21296c73-c9e2-4889-a33f-417d2974b2bd/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/21296c73-c9e2-4889-a33f-417d2974b2bd/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"relationships":{"parent_team":{"data":{"id":"4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87","type":"team"}},"sub_team":{"data":{"id":"21296c73-c9e2-4889-a33f-417d2974b2bd","type":"team"}}},"type":"team_hierarchy_links"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: POST + url: https://api.datadoghq.com/api/v2/team-hierarchy-links + response: + body: '{"data":{"id":"e980108e-d535-4bdf-84ca-5e8f84a68480","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T17:06:48.279316439Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87","type":"team"}},"sub_team":{"data":{"id":"21296c73-c9e2-4889-a33f-417d2974b2bd","type":"team"}}}},"included":[{"id":"4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87","type":"team","attributes":{"avatar":null,"banner":0,"handle":"test-handle-6c891437b748aea8","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-6c891437b748aea8","summary":null,"user_count":0}},{"id":"21296c73-c9e2-4889-a33f-417d2974b2bd","type":"team","attributes":{"avatar":null,"banner":2,"handle":"test-handle-2-6c891437b748aea8","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-2-6c891437b748aea8","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"relationships":{"parent_team":{"data":{"id":"4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87","type":"team"}},"sub_team":{"data":{"id":"21296c73-c9e2-4889-a33f-417d2974b2bd","type":"team"}}},"type":"team_hierarchy_links"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 3 + method: POST + url: https://api.datadoghq.com/api/v2/team-hierarchy-links + response: + body: '{"errors":["Conflict: could not add team 21296c73-c9e2-4889-a33f-417d2974b2bd + as a member team of team 4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87 in org 321813: + team hierarchy link between super team 4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87 + and member team 21296c73-c9e2-4889-a33f-417d2974b2bd already exists in org 321813"]}' + code: 409 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 409 Conflict +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/e980108e-d535-4bdf-84ca-5e8f84a68480 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 5 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/21296c73-c9e2-4889-a33f-417d2974b2bd + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 6 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_OK_response.freeze new file mode 100644 index 00000000000..bf8a8d4fa45 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-24T16:01:16.053Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_OK_response.yaml new file mode 100644 index 00000000000..4646c15d807 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_OK_response.yaml @@ -0,0 +1,107 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-4d8084da4dfa4ed8","name":"test-name-4d8084da4dfa4ed8"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"d5b049f4-59f1-474d-ad98-5a7342a8961f","type":"team","attributes":{"avatar":null,"banner":11,"created_at":"2025-11-24T16:01:16.149673+00:00","description":null,"handle":"test-handle-4d8084da4dfa4ed8","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T16:01:16.149673+00:00","name":"test-name-4d8084da4dfa4ed8","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/d5b049f4-59f1-474d-ad98-5a7342a8961f/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/d5b049f4-59f1-474d-ad98-5a7342a8961f/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-2-4d8084da4dfa4ed8","name":"test-name-2-4d8084da4dfa4ed8"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"790428f6-10bc-427d-bf36-f53ca3c197e0","type":"team","attributes":{"avatar":null,"banner":4,"created_at":"2025-11-24T16:01:16.315013+00:00","description":null,"handle":"test-handle-2-4d8084da4dfa4ed8","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T16:01:16.315013+00:00","name":"test-name-2-4d8084da4dfa4ed8","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/790428f6-10bc-427d-bf36-f53ca3c197e0/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/790428f6-10bc-427d-bf36-f53ca3c197e0/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"relationships":{"parent_team":{"data":{"id":"d5b049f4-59f1-474d-ad98-5a7342a8961f","type":"team"}},"sub_team":{"data":{"id":"790428f6-10bc-427d-bf36-f53ca3c197e0","type":"team"}}},"type":"team_hierarchy_links"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: POST + url: https://api.datadoghq.com/api/v2/team-hierarchy-links + response: + body: '{"data":{"id":"6cf86539-2c6e-497e-8cef-0b285ff05514","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T16:01:16.460042023Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"d5b049f4-59f1-474d-ad98-5a7342a8961f","type":"team"}},"sub_team":{"data":{"id":"790428f6-10bc-427d-bf36-f53ca3c197e0","type":"team"}}}},"included":[{"id":"d5b049f4-59f1-474d-ad98-5a7342a8961f","type":"team","attributes":{"avatar":null,"banner":11,"handle":"test-handle-4d8084da4dfa4ed8","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-4d8084da4dfa4ed8","summary":null,"user_count":0}},{"id":"790428f6-10bc-427d-bf36-f53ca3c197e0","type":"team","attributes":{"avatar":null,"banner":4,"handle":"test-handle-2-4d8084da4dfa4ed8","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-2-4d8084da4dfa4ed8","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/6cf86539-2c6e-497e-8cef-0b285ff05514 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/790428f6-10bc-427d-bf36-f53ca3c197e0 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 5 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/d5b049f4-59f1-474d-ad98-5a7342a8961f + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_SUCCESS_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_SUCCESS_response.freeze new file mode 100644 index 00000000000..e4ed51cc867 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_SUCCESS_response.freeze @@ -0,0 +1 @@ +2025-11-24T15:48:39.900Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_SUCCESS_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_SUCCESS_response.yaml new file mode 100644 index 00000000000..3a4677e53a9 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_SUCCESS_response.yaml @@ -0,0 +1,107 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-a75ee0b8b483d66f","name":"test-name-a75ee0b8b483d66f"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"b85e63cd-1d9f-4b71-a47c-f5a99d4a4afd","type":"team","attributes":{"avatar":null,"banner":3,"created_at":"2025-11-24T15:48:40.359260+00:00","description":null,"handle":"test-handle-a75ee0b8b483d66f","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T15:48:40.359261+00:00","name":"test-name-a75ee0b8b483d66f","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/b85e63cd-1d9f-4b71-a47c-f5a99d4a4afd/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/b85e63cd-1d9f-4b71-a47c-f5a99d4a4afd/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-2-a75ee0b8b483d66f","name":"test-name-2-a75ee0b8b483d66f"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"2d096572-eb6a-4579-ba38-b4247cf75e17","type":"team","attributes":{"avatar":null,"banner":8,"created_at":"2025-11-24T15:48:40.893488+00:00","description":null,"handle":"test-handle-2-a75ee0b8b483d66f","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T15:48:40.893488+00:00","name":"test-name-2-a75ee0b8b483d66f","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/2d096572-eb6a-4579-ba38-b4247cf75e17/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/2d096572-eb6a-4579-ba38-b4247cf75e17/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"relationships":{"parent_team":{"data":{"id":"b85e63cd-1d9f-4b71-a47c-f5a99d4a4afd","type":"team"}},"sub_team":{"data":{"id":"2d096572-eb6a-4579-ba38-b4247cf75e17","type":"team"}}},"type":"team_hierarchy_links"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: POST + url: https://api.datadoghq.com/api/v2/team-hierarchy-links + response: + body: '{"data":{"id":"fb94d43b-fe10-4c5f-ae7c-4ad745428651","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T15:48:41.150923395Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"b85e63cd-1d9f-4b71-a47c-f5a99d4a4afd","type":"team"}},"sub_team":{"data":{"id":"2d096572-eb6a-4579-ba38-b4247cf75e17","type":"team"}}}},"included":[{"id":"b85e63cd-1d9f-4b71-a47c-f5a99d4a4afd","type":"team","attributes":{"avatar":null,"banner":3,"handle":"test-handle-a75ee0b8b483d66f","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-a75ee0b8b483d66f","summary":null,"user_count":0}},{"id":"2d096572-eb6a-4579-ba38-b4247cf75e17","type":"team","attributes":{"avatar":null,"banner":8,"handle":"test-handle-2-a75ee0b8b483d66f","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-2-a75ee0b8b483d66f","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/fb94d43b-fe10-4c5f-ae7c-4ad745428651 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/2d096572-eb6a-4579-ba38-b4247cf75e17 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 5 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/b85e63cd-1d9f-4b71-a47c-f5a99d4a4afd + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_API_error_response._response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_API_error_response._response.freeze new file mode 100644 index 00000000000..21b6221c0da --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_API_error_response._response.freeze @@ -0,0 +1 @@ +2025-11-24T13:19:11.816Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_API_error_response._response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_API_error_response._response.yaml new file mode 100644 index 00000000000..e5fc2980998 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_API_error_response._response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/aaa11111-aa11-aa11-aaaa-aaaaaa111111 + response: + body: '{"errors":["Not Found: team hierarchy link not found (linkId=aaa11111-aa11-aa11-aaaa-aaaaaa111111)"]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_OK_response.freeze new file mode 100644 index 00000000000..be8e0fd4a38 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-24T17:07:09.212Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_OK_response.yaml new file mode 100644 index 00000000000..c235c3fb729 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_OK_response.yaml @@ -0,0 +1,124 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-ae3e76a23be3747a","name":"test-name-ae3e76a23be3747a"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"fafeac94-42b4-4469-91e8-0ae5ca3f564b","type":"team","attributes":{"avatar":null,"banner":11,"created_at":"2025-11-24T17:07:09.817794+00:00","description":null,"handle":"test-handle-ae3e76a23be3747a","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T17:07:09.817794+00:00","name":"test-name-ae3e76a23be3747a","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/fafeac94-42b4-4469-91e8-0ae5ca3f564b/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/fafeac94-42b4-4469-91e8-0ae5ca3f564b/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-2-ae3e76a23be3747a","name":"test-name-2-ae3e76a23be3747a"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"196bcc55-bd30-4cfd-8549-b3d255a0517b","type":"team","attributes":{"avatar":null,"banner":4,"created_at":"2025-11-24T17:07:10.381761+00:00","description":null,"handle":"test-handle-2-ae3e76a23be3747a","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T17:07:10.381761+00:00","name":"test-name-2-ae3e76a23be3747a","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/196bcc55-bd30-4cfd-8549-b3d255a0517b/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/196bcc55-bd30-4cfd-8549-b3d255a0517b/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"relationships":{"parent_team":{"data":{"id":"fafeac94-42b4-4469-91e8-0ae5ca3f564b","type":"team"}},"sub_team":{"data":{"id":"196bcc55-bd30-4cfd-8549-b3d255a0517b","type":"team"}}},"type":"team_hierarchy_links"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: POST + url: https://api.datadoghq.com/api/v2/team-hierarchy-links + response: + body: '{"data":{"id":"5401e712-de1b-4deb-ac35-2c6ee1943ad0","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T17:07:10.643798843Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"fafeac94-42b4-4469-91e8-0ae5ca3f564b","type":"team"}},"sub_team":{"data":{"id":"196bcc55-bd30-4cfd-8549-b3d255a0517b","type":"team"}}}},"included":[{"id":"fafeac94-42b4-4469-91e8-0ae5ca3f564b","type":"team","attributes":{"avatar":null,"banner":11,"handle":"test-handle-ae3e76a23be3747a","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-ae3e76a23be3747a","summary":null,"user_count":0}},{"id":"196bcc55-bd30-4cfd-8549-b3d255a0517b","type":"team","attributes":{"avatar":null,"banner":4,"handle":"test-handle-2-ae3e76a23be3747a","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-2-ae3e76a23be3747a","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 3 + method: GET + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/5401e712-de1b-4deb-ac35-2c6ee1943ad0 + response: + body: '{"data":{"id":"5401e712-de1b-4deb-ac35-2c6ee1943ad0","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T17:07:10.643799Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"fafeac94-42b4-4469-91e8-0ae5ca3f564b","type":"team"}},"sub_team":{"data":{"id":"196bcc55-bd30-4cfd-8549-b3d255a0517b","type":"team"}}}},"links":{"self":"https://api.datadoghq.com/api/v2/team-hierarchy-links/5401e712-de1b-4deb-ac35-2c6ee1943ad0"},"included":[{"id":"196bcc55-bd30-4cfd-8549-b3d255a0517b","type":"team","attributes":{"avatar":null,"banner":4,"handle":"test-handle-2-ae3e76a23be3747a","is_managed":false,"is_open_membership":true,"link_count":0,"name":"test-name-2-ae3e76a23be3747a","summary":null,"user_count":0}},{"id":"fafeac94-42b4-4469-91e8-0ae5ca3f564b","type":"team","attributes":{"avatar":null,"banner":11,"handle":"test-handle-ae3e76a23be3747a","is_managed":false,"is_open_membership":true,"link_count":0,"name":"test-name-ae3e76a23be3747a","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/5401e712-de1b-4deb-ac35-2c6ee1943ad0 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 5 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/196bcc55-bd30-4cfd-8549-b3d255a0517b + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 6 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/fafeac94-42b4-4469-91e8-0ae5ca3f564b + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_team_hierarchy_links_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_team_hierarchy_links_returns_OK_response.freeze new file mode 100644 index 00000000000..1d3731961ea --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_team_hierarchy_links_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-24T17:18:13.180Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_team_hierarchy_links_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_team_hierarchy_links_returns_OK_response.yaml new file mode 100644 index 00000000000..b70b4f5f0c3 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_team_hierarchy_links_returns_OK_response.yaml @@ -0,0 +1,124 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-ab0ee85594ae1dfd","name":"test-name-ab0ee85594ae1dfd"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"d1baf3de-7316-43b5-8582-dc887acc26ef","type":"team","attributes":{"avatar":null,"banner":6,"created_at":"2025-11-24T17:18:13.814865+00:00","description":null,"handle":"test-handle-ab0ee85594ae1dfd","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T17:18:13.814865+00:00","name":"test-name-ab0ee85594ae1dfd","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/d1baf3de-7316-43b5-8582-dc887acc26ef/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/d1baf3de-7316-43b5-8582-dc887acc26ef/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-2-ab0ee85594ae1dfd","name":"test-name-2-ab0ee85594ae1dfd"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"61b0ab36-c1e5-47fd-898a-ba9bfc860e9d","type":"team","attributes":{"avatar":null,"banner":13,"created_at":"2025-11-24T17:18:14.383042+00:00","description":null,"handle":"test-handle-2-ab0ee85594ae1dfd","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T17:18:14.383042+00:00","name":"test-name-2-ab0ee85594ae1dfd","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/61b0ab36-c1e5-47fd-898a-ba9bfc860e9d/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/61b0ab36-c1e5-47fd-898a-ba9bfc860e9d/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"relationships":{"parent_team":{"data":{"id":"d1baf3de-7316-43b5-8582-dc887acc26ef","type":"team"}},"sub_team":{"data":{"id":"61b0ab36-c1e5-47fd-898a-ba9bfc860e9d","type":"team"}}},"type":"team_hierarchy_links"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: POST + url: https://api.datadoghq.com/api/v2/team-hierarchy-links + response: + body: '{"data":{"id":"61509612-5bb0-42c5-a16e-bf4920acf473","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T17:18:14.635205462Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"d1baf3de-7316-43b5-8582-dc887acc26ef","type":"team"}},"sub_team":{"data":{"id":"61b0ab36-c1e5-47fd-898a-ba9bfc860e9d","type":"team"}}}},"included":[{"id":"d1baf3de-7316-43b5-8582-dc887acc26ef","type":"team","attributes":{"avatar":null,"banner":6,"handle":"test-handle-ab0ee85594ae1dfd","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-ab0ee85594ae1dfd","summary":null,"user_count":0}},{"id":"61b0ab36-c1e5-47fd-898a-ba9bfc860e9d","type":"team","attributes":{"avatar":null,"banner":13,"handle":"test-handle-2-ab0ee85594ae1dfd","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-2-ab0ee85594ae1dfd","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 3 + method: GET + url: https://api.datadoghq.com/api/v2/team-hierarchy-links?filter%5Bparent_team%5D=d1baf3de-7316-43b5-8582-dc887acc26ef&filter%5Bsub_team%5D=61b0ab36-c1e5-47fd-898a-ba9bfc860e9d&page%5Bnumber%5D=0&page%5Bsize%5D=100 + response: + body: '{"data":[{"id":"61509612-5bb0-42c5-a16e-bf4920acf473","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T17:18:14.635205Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"d1baf3de-7316-43b5-8582-dc887acc26ef","type":"team"}},"sub_team":{"data":{"id":"61b0ab36-c1e5-47fd-898a-ba9bfc860e9d","type":"team"}}}}],"meta":{"page":{"type":"number_size","number":0,"size":100,"total":1,"first_number":0,"prev_number":null,"next_number":null,"last_number":0}},"links":{"self":"https://api.datadoghq.com/api/v2/team-hierarchy-links?filter%5Bparent_team%5D=d1baf3de-7316-43b5-8582-dc887acc26ef\u0026filter%5Bsub_team%5D=61b0ab36-c1e5-47fd-898a-ba9bfc860e9d\u0026page%5Bnumber%5D=0\u0026page%5Bsize%5D=100","first":"https://api.datadoghq.com/api/v2/team-hierarchy-links?filter[parent_team]=d1baf3de-7316-43b5-8582-dc887acc26ef\u0026filter[sub_team]=61b0ab36-c1e5-47fd-898a-ba9bfc860e9d\u0026page[number]=0\u0026page[size]=100","last":"https://api.datadoghq.com/api/v2/team-hierarchy-links?filter[parent_team]=d1baf3de-7316-43b5-8582-dc887acc26ef\u0026filter[sub_team]=61b0ab36-c1e5-47fd-898a-ba9bfc860e9d\u0026page[number]=0\u0026page[size]=100"},"included":[{"id":"61b0ab36-c1e5-47fd-898a-ba9bfc860e9d","type":"team","attributes":{"avatar":null,"banner":13,"handle":"test-handle-2-ab0ee85594ae1dfd","is_managed":false,"is_open_membership":true,"link_count":0,"name":"test-name-2-ab0ee85594ae1dfd","summary":null,"user_count":0}},{"id":"d1baf3de-7316-43b5-8582-dc887acc26ef","type":"team","attributes":{"avatar":null,"banner":6,"handle":"test-handle-ab0ee85594ae1dfd","is_managed":false,"is_open_membership":true,"link_count":0,"name":"test-name-ab0ee85594ae1dfd","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/61509612-5bb0-42c5-a16e-bf4920acf473 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 5 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/61b0ab36-c1e5-47fd-898a-ba9bfc860e9d + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 6 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/d1baf3de-7316-43b5-8582-dc887acc26ef + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_API_error_response._response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_API_error_response._response.freeze new file mode 100644 index 00000000000..73f686747b4 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_API_error_response._response.freeze @@ -0,0 +1 @@ +2025-11-24T13:14:20.481Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_API_error_response._response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_API_error_response._response.yaml new file mode 100644 index 00000000000..27a61a63fc4 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_API_error_response._response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 0 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/aaa11111-aa11-aa11-aaaa-aaaaaa111111 + response: + body: '{"errors":["Not Found: link with id aaa11111-aa11-aa11-aaaa-aaaaaa111111 + not found"]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_No_Content_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_No_Content_response.freeze new file mode 100644 index 00000000000..be1311ed7c9 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_No_Content_response.freeze @@ -0,0 +1 @@ +2025-11-24T17:08:01.196Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_No_Content_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_No_Content_response.yaml new file mode 100644 index 00000000000..6a39040a3d7 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_No_Content_response.yaml @@ -0,0 +1,125 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-db31819631324305","name":"test-name-db31819631324305"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"eaf01981-6b63-41ba-b49f-30449c50e865","type":"team","attributes":{"avatar":null,"banner":10,"created_at":"2025-11-24T17:08:01.930314+00:00","description":null,"handle":"test-handle-db31819631324305","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T17:08:01.930314+00:00","name":"test-name-db31819631324305","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/eaf01981-6b63-41ba-b49f-30449c50e865/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/eaf01981-6b63-41ba-b49f-30449c50e865/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-2-db31819631324305","name":"test-name-2-db31819631324305"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"120aeb27-ca42-4e38-a9e4-6497b8f9407c","type":"team","attributes":{"avatar":null,"banner":6,"created_at":"2025-11-24T17:08:02.174211+00:00","description":null,"handle":"test-handle-2-db31819631324305","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T17:08:02.174211+00:00","name":"test-name-2-db31819631324305","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/120aeb27-ca42-4e38-a9e4-6497b8f9407c/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/120aeb27-ca42-4e38-a9e4-6497b8f9407c/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"relationships":{"parent_team":{"data":{"id":"eaf01981-6b63-41ba-b49f-30449c50e865","type":"team"}},"sub_team":{"data":{"id":"120aeb27-ca42-4e38-a9e4-6497b8f9407c","type":"team"}}},"type":"team_hierarchy_links"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: POST + url: https://api.datadoghq.com/api/v2/team-hierarchy-links + response: + body: '{"data":{"id":"185446b8-1e88-419c-b266-3933f1411b6e","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T17:08:02.736655421Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"eaf01981-6b63-41ba-b49f-30449c50e865","type":"team"}},"sub_team":{"data":{"id":"120aeb27-ca42-4e38-a9e4-6497b8f9407c","type":"team"}}}},"included":[{"id":"eaf01981-6b63-41ba-b49f-30449c50e865","type":"team","attributes":{"avatar":null,"banner":10,"handle":"test-handle-db31819631324305","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-db31819631324305","summary":null,"user_count":0}},{"id":"120aeb27-ca42-4e38-a9e4-6497b8f9407c","type":"team","attributes":{"avatar":null,"banner":6,"handle":"test-handle-2-db31819631324305","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-2-db31819631324305","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/185446b8-1e88-419c-b266-3933f1411b6e + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/185446b8-1e88-419c-b266-3933f1411b6e + response: + body: '{"errors":["Not Found: link with id 185446b8-1e88-419c-b266-3933f1411b6e + not found"]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 5 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/120aeb27-ca42-4e38-a9e4-6497b8f9407c + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 6 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/eaf01981-6b63-41ba-b49f-30449c50e865 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 198c7af1b51..64b50d8057c 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -1169,6 +1169,30 @@ "tag": "Teams", "operationId": "CreateTeam" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"handle\": \"test-handle-2-{{ unique_hash }}\",\n \"name\": \"test-name-2-{{ unique_hash }}\"\n },\n \"type\": \"team\"\n }\n}" + } + ], + "step": "there is a valid \"dd_team_2\" in the system", + "key": "dd_team_2", + "tag": "Teams", + "operationId": "CreateTeam" + }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"team_hierarchy_links\",\n \"relationships\": {\n \"parent_team\": {\n \"data\": {\n \"id\": \"{{ dd_team.data.id }}\",\n \"type\": \"team\"\n }\n },\n \"sub_team\": {\n \"data\": {\n \"id\": \"{{ dd_team_2.data.id }}\",\n \"type\": \"team\"\n }\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"team_hierarchy_link\" in the system", + "key": "team_hierarchy_link", + "tag": "Teams", + "operationId": "AddTeamHierarchyLink" + }, { "source": "data.data[0]", "step": "there is a valid \"team_connection\" in the system", diff --git a/tests/scenarios/features/v2/security_monitoring.feature b/tests/scenarios/features/v2/security_monitoring.feature index 531c84c19c1..5599d509afc 100644 --- a/tests/scenarios/features/v2/security_monitoring.feature +++ b/tests/scenarios/features/v2/security_monitoring.feature @@ -5,9 +5,83 @@ Feature: Security Monitoring information. Background: - Given an instance of "SecurityMonitoring" API - And a valid "apiKeyAuth" key in the system + Given a valid "apiKeyAuth" key in the system And a valid "appKeyAuth" key in the system + And an instance of "SecurityMonitoring" API + + @team:DataDog/k9-investigation + Scenario: Attach security finding to a Jira issue returns "OK" response + Given new "AttachJiraIssue" request + And body with value {"data": {"attributes": {"jira_issue_url": "https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476"}, "relationships": {"findings": {"data": [{"id": "OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI=", "type": "findings"}]}, "project": {"data": {"id": "959a6f71-bac8-4027-b1d3-2264f569296f", "type": "projects"}}}, "type": "jira_issues"}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.status_group" is equal to "SG_OPEN" + And the response "data.attributes.insights" has item with field "resource_id" with value "OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI=" + And the response "data.attributes.jira_issue.result.issue_url" is equal to "https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476" + + @team:DataDog/k9-investigation + Scenario: Attach security finding to a case returns "OK" response + Given new "AttachCase" request + And request contains "case_id" parameter with value "7d16945b-baf8-411e-ab2a-20fe43af1ea3" + And body with value {"data": {"id": "7d16945b-baf8-411e-ab2a-20fe43af1ea3", "relationships": {"findings": {"data": [{"id": "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=", "type": "findings"}]}}, "type": "cases"}} + When the request is sent + Then the response status is 200 OK + And the response "data.id" is equal to "7d16945b-baf8-411e-ab2a-20fe43af1ea3" + And the response "data.attributes.status_group" is equal to "SG_OPEN" + And the response "data.attributes.insights" has item with field "resource_id" with value "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=" + + @team:DataDog/k9-investigation + Scenario: Attach security findings to a Jira issue returns "Bad Request" response + Given new "AttachJiraIssue" request + And body with value {"data": {"attributes": {"jira_issue_url": "https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476"}, "relationships": {"findings": {"data": []}, "project": {"data": {"id": "959a6f71-bac8-4027-b1d3-2264f569296f", "type": "projects"}}}, "type": "jira_issues"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-investigation + Scenario: Attach security findings to a Jira issue returns "Not Found" response + Given new "AttachJiraIssue" request + And body with value {"data": {"attributes": {"jira_issue_url": "https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476"}, "relationships": {"findings": {"data": [{"id": "wrong-finding-id", "type": "findings"}]}, "project": {"data": {"id": "959a6f71-bac8-4027-b1d3-2264f569296f", "type": "projects"}}}, "type": "jira_issues"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-investigation + Scenario: Attach security findings to a Jira issue returns "OK" response + Given new "AttachJiraIssue" request + And body with value {"data": {"attributes": {"jira_issue_url": "https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476"}, "relationships": {"findings": {"data": [{"id": "OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI=", "type": "findings"}, {"id": "MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM=", "type": "findings"}]}, "project": {"data": {"id": "959a6f71-bac8-4027-b1d3-2264f569296f", "type": "projects"}}}, "type": "jira_issues"}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.status_group" is equal to "SG_OPEN" + And the response "data.attributes.insights" has item with field "resource_id" with value "OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI=" + And the response "data.attributes.insights" has item with field "resource_id" with value "MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM=" + And the response "data.attributes.jira_issue.result.issue_url" is equal to "https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476" + + @team:DataDog/k9-investigation + Scenario: Attach security findings to a case returns "Bad Request" response + Given new "AttachCase" request + And request contains "case_id" parameter with value "7d16945b-baf8-411e-ab2a-20fe43af1ea3" + And body with value {"data": {"id": "7d16945b-baf8-411e-ab2a-20fe43af1ea3", "relationships": {"findings": {"data": []}}, "type": "cases"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-investigation + Scenario: Attach security findings to a case returns "Not Found" response + Given new "AttachCase" request + And request contains "case_id" parameter with value "wrong-case-id" + And body with value {"data": {"id": "wrong-case-id", "relationships": {"findings": {"data": [{"id": "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=", "type": "findings"}]}}, "type": "cases"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-investigation + Scenario: Attach security findings to a case returns "OK" response + Given new "AttachCase" request + And request contains "case_id" parameter with value "7d16945b-baf8-411e-ab2a-20fe43af1ea3" + And body with value {"data": {"id": "7d16945b-baf8-411e-ab2a-20fe43af1ea3", "relationships": {"findings": {"data": [{"id": "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=", "type": "findings"}, {"id": "MmUzMzZkODQ2YTI3NDU0OTk4NDk3NzhkOTY5YjU2Zjh-YWJjZGI1ODI4OTYzNWM3ZmUwZTBlOWRkYTRiMGUyOGQ=", "type": "findings"}]}}, "type": "cases"}} + When the request is sent + Then the response status is 200 OK + And the response "data.id" is equal to "7d16945b-baf8-411e-ab2a-20fe43af1ea3" + And the response "data.attributes.status_group" is equal to "SG_OPEN" + And the response "data.attributes.insights" has item with field "resource_id" with value "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=" + And the response "data.attributes.insights" has item with field "resource_id" with value "MmUzMzZkODQ2YTI3NDU0OTk4NDk3NzhkOTY5YjU2Zjh-YWJjZGI1ODI4OTYzNWM3ZmUwZTBlOWRkYTRiMGUyOGQ=" @team:DataDog/k9-cloud-security-platform Scenario: Cancel a historical job returns "Bad Request" response @@ -184,6 +258,78 @@ Feature: Security Monitoring Then the response status is 200 OK And the response "terraformContent" is equal to "resource \"datadog_security_monitoring_rule\" \"_{{ unique_hash }}\" {\n\tname = \"_{{ unique_hash }}\"\n\tenabled = true\n\tquery {\n\t\tquery = \"@test:true\"\n\t\tgroup_by_fields = []\n\t\thas_optional_group_by_fields = false\n\t\tdistinct_fields = []\n\t\taggregation = \"count\"\n\t\tname = \"\"\n\t\tdata_source = \"logs\"\n\t}\n\toptions {\n\t\tkeep_alive = 3600\n\t\tmax_signal_duration = 86400\n\t\tdetection_method = \"threshold\"\n\t\tevaluation_window = 900\n\t}\n\tcase {\n\t\tname = \"\"\n\t\tstatus = \"info\"\n\t\tnotifications = []\n\t\tcondition = \"a > 0\"\n\t}\n\tmessage = \"Test rule\"\n\ttags = []\n\thas_extended_title = false\n\ttype = \"log_detection\"\n}\n" + @team:DataDog/k9-investigation + Scenario: Create Jira issue for security finding returns "Created" response + Given new "CreateJiraIssues" request + And body with value {"data": [{"type": "jira_issues", "attributes": {}, "relationships": {"case": {"data": {"type": "cases", "id": "6a773295-8729-4034-aada-53b64cbe02e7"}}}}], "included": [{"type": "cases", "attributes": {"title": "A title", "description": "A description"}, "relationships": {"project": {"data": {"type": "projects", "id": "959a6f71-bac8-4027-b1d3-2264f569296f"}}, "findings": {"data": [{"type": "findings", "id": "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y="}]}}, "id": "6a773295-8729-4034-aada-53b64cbe02e7"}, {"type": "projects", "id": "959a6f71-bac8-4027-b1d3-2264f569296f"}, {"type": "findings", "id": "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y="}]} + When the request is sent + Then the response status is 201 Created + And the response "data" has length 1 + And the response "data[0]" has field "id" + And the response "data[0].attributes.title" is equal to "A title" + And the response "data[0].attributes.description" is equal to "A description" + And the response "data[0].attributes.type" is equal to "SECURITY" + And the response "data[0].attributes.insights" has length 1 + And the response "data[0].attributes.insights[0].resource_id" is equal to "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=" + And the response "data[0].attributes.insights[0].type" is equal to "SECURITY_FINDING" + And the response "data[0].attributes.jira_issue.status" is equal to "COMPLETED" + + @team:DataDog/k9-investigation + Scenario: Create Jira issue for security findings returns "Created" response + Given new "CreateJiraIssues" request + And body with value {"data": [{"type": "jira_issues", "attributes": {}, "relationships": {"case": {"data": {"type": "cases", "id": "e469ceda-957a-4557-a607-9ff25032e9ca"}}}}], "included": [{"type": "cases", "attributes": {"title": "A title", "description": "A description"}, "relationships": {"project": {"data": {"type": "projects", "id": "959a6f71-bac8-4027-b1d3-2264f569296f"}}, "findings": {"data": [{"type": "findings", "id": "MzUxMDI4OWYyYWEyODRhYjQ0Zjg2YjY2ZTFmNjRjYzd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY="}, {"type": "findings", "id": "ZjE2ZGI5YjdmYTQyYzhhMDQ3Nzc3YjM1NGQ2Y2NmZTd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY="}]}}, "id": "e469ceda-957a-4557-a607-9ff25032e9ca"}, {"type": "projects", "id": "959a6f71-bac8-4027-b1d3-2264f569296f"}, {"type": "findings", "id": "MzUxMDI4OWYyYWEyODRhYjQ0Zjg2YjY2ZTFmNjRjYzd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY="}, {"type": "findings", "id": "ZjE2ZGI5YjdmYTQyYzhhMDQ3Nzc3YjM1NGQ2Y2NmZTd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY="}]} + When the request is sent + Then the response status is 201 Created + And the response "data" has length 1 + And the response "data[0]" has field "id" + And the response "data[0].attributes.title" is equal to "A title" + And the response "data[0].attributes.description" is equal to "A description" + And the response "data[0].attributes.type" is equal to "SECURITY" + And the response "data[0].attributes.insights" has length 2 + And the response "data[0].attributes.insights[1].resource_id" is equal to "MzUxMDI4OWYyYWEyODRhYjQ0Zjg2YjY2ZTFmNjRjYzd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY=" + And the response "data[0].attributes.insights[1].type" is equal to "SECURITY_FINDING" + And the response "data[0].attributes.insights[0].resource_id" is equal to "ZjE2ZGI5YjdmYTQyYzhhMDQ3Nzc3YjM1NGQ2Y2NmZTd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY=" + And the response "data[0].attributes.insights[0].type" is equal to "SECURITY_FINDING" + And the response "data[0].attributes.jira_issue.status" is equal to "COMPLETED" + + @team:DataDog/k9-investigation + Scenario: Create Jira issues for security findings returns "Bad Request" response + Given new "CreateJiraIssues" request + And body with value {"data": [{"type": "jira_issues", "attributes": {}, "relationships": {"case": {"data": {"type": "cases", "id": "a7c38bab-ae98-4113-878c-c98799f914c2"}}}}], "included": [{"type": "cases", "relationships": {"project": {"data": {"type": "projects", "id": "959a6f71-bac8-4027-b1d3-2264f569296f"}}, "findings": {"data": []}}, "id": "a7c38bab-ae98-4113-878c-c98799f914c2"}, {"type": "projects", "id": "959a6f71-bac8-4027-b1d3-2264f569296f"}]} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-investigation + Scenario: Create Jira issues for security findings returns "Created" response + Given new "CreateJiraIssues" request + And body with value {"data": [{"type": "jira_issues", "attributes":{}, "relationships": {"case": {"data": {"type": "cases", "id":"53e242c6-a7d6-46ad-9680-b8d14753f716"}}}}, {"type": "jira_issues", "attributes": {}, "relationships": {"case": {"data": {"type": "cases", "id": "195772b2-1f53-41d2-b81e-48c8e6c21d33"}}}}], "included":[{"type":"cases", "attributes":{"title":"A title", "description":"A description"}, "relationships":{"project":{"data":{"type":"projects", "id":"959a6f71-bac8-4027-b1d3-2264f569296f"}}, "findings": {"data": [{"type": "findings", "id": "OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI="}]}}, "id": "53e242c6-a7d6-46ad-9680-b8d14753f716"}, {"type": "cases", "attributes": {"title": "A title", "description": "A description"}, "relationships": {"project": {"data": {"type": "projects", "id": "959a6f71-bac8-4027-b1d3-2264f569296f"}}, "findings": {"data":[{"type": "findings", "id": "MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM="}]}}, "id": "195772b2-1f53-41d2-b81e-48c8e6c21d33"}, {"type": "projects", "id": "959a6f71-bac8-4027-b1d3-2264f569296f"}, {"type": "findings", "id": "OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI="}, {"type": "findings", "id": "MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM="}]} + When the request is sent + Then the response status is 201 Created + And the response "data" has length 2 + And the response "data[0]" has field "id" + And the response "data[0].attributes.title" is equal to "A title" + And the response "data[0].attributes.description" is equal to "A description" + And the response "data[0].attributes.type" is equal to "SECURITY" + And the response "data[0].attributes.insights" has length 1 + And the response "data[0].attributes.insights[0].resource_id" is equal to "OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI=" + And the response "data[0].attributes.insights[0].type" is equal to "SECURITY_FINDING" + And the response "data[0].attributes.jira_issue.status" is equal to "COMPLETED" + And the response "data[1]" has field "id" + And the response "data[1].attributes.title" is equal to "A title" + And the response "data[1].attributes.description" is equal to "A description" + And the response "data[1].attributes.type" is equal to "SECURITY" + And the response "data[1].attributes.insights" has length 1 + And the response "data[1].attributes.insights[0].resource_id" is equal to "MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM=" + And the response "data[1].attributes.insights[0].type" is equal to "SECURITY_FINDING" + And the response "data[1].attributes.jira_issue.status" is equal to "COMPLETED" + + @team:DataDog/k9-investigation + Scenario: Create Jira issues for security findings returns "Not Found" response + Given new "CreateJiraIssues" request + And body with value {"data": [{"type": "jira_issues", "attributes": {}, "relationships": {"case": {"data": {"type": "cases", "id": "6ed1d7c2-e1a3-4369-b92b-a38d3cc75cf3"}}}}], "included": [{"type": "cases", "attributes": {"title": "A title", "description": "A description"}, "relationships": {"project": {"data": {"type": "projects", "id": "00000000-0000-0000-0000-000000000000"}}, "findings": {"data": [{"type": "findings", "id": "YzM2MTFjYzcyNmY0Zjg4MTAxZmRlNjQ1MWU1ZGQwYzR-YzI5NzE5Y2Y4MzU4ZjliNzhkNjYxNTY0ODIzZDQ2YTM="}]}}, "id": "6ed1d7c2-e1a3-4369-b92b-a38d3cc75cf3"}, {"type": "projects", "id": "00000000-0000-0000-0000-000000000000"}, {"type": "findings", "id": "YzM2MTFjYzcyNmY0Zjg4MTAxZmRlNjQ1MWU1ZGQwYzR-YzI5NzE5Y2Y4MzU4ZjliNzhkNjYxNTY0ODIzZDQ2YTM="}]} + When the request is sent + Then the response status is 404 Not Found + @skip-validation @team:DataDog/k9-cloud-security-platform Scenario: Create a cloud_configuration rule returns "OK" response Given new "CreateSecurityMonitoringRule" request @@ -408,6 +554,74 @@ Feature: Security Monitoring And the response "data.attributes.rule_query" is equal to "type:log_detection source:cloudtrail" And the response "data.attributes.data_exclusion_query" is equal to "account_id:12345" + @team:DataDog/k9-investigation + Scenario: Create case for security finding returns "Created" response + Given new "CreateCases" request + And body with value {"data": [{"attributes": {"title": "A title", "description": "A description"}, "relationships": {"findings": {"data": [{"id": "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=", "type": "findings"}]}, "project": {"data": {"id": "959a6f71-bac8-4027-b1d3-2264f569296f", "type": "projects"}}}, "type": "cases"}]} + When the request is sent + Then the response status is 201 Created + And the response "data" has length 1 + And the response "data[0]" has field "id" + And the response "data[0].attributes.title" is equal to "A title" + And the response "data[0].attributes.description" is equal to "A description" + And the response "data[0].attributes.type" is equal to "SECURITY" + And the response "data[0].attributes.insights" has length 1 + And the response "data[0].attributes.insights[0].resource_id" is equal to "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=" + And the response "data[0].attributes.insights[0].type" is equal to "SECURITY_FINDING" + + @team:DataDog/k9-investigation + Scenario: Create case for security findings returns "Created" response + Given new "CreateCases" request + And body with value {"data": [{"attributes": {"title": "A title", "description": "A description"}, "relationships": {"findings": {"data": [{"id": "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=", "type": "findings"}, {"id": "MzZkNTMxODNmOGZlZmJiYzIyMDg4NzhmM2QyMDExZjB-ZmY5NzUwNDQzYTE0MGIyNDM1MTg4YjkxZDNmMDU4OGU=", "type": "findings"}]}, "project": {"data": {"id": "959a6f71-bac8-4027-b1d3-2264f569296f", "type": "projects"}}}, "type": "cases"}]} + When the request is sent + Then the response status is 201 Created + And the response "data" has length 1 + And the response "data[0]" has field "id" + And the response "data[0].attributes.title" is equal to "A title" + And the response "data[0].attributes.description" is equal to "A description" + And the response "data[0].attributes.type" is equal to "SECURITY" + And the response "data[0].attributes.insights" has length 2 + And the response "data[0].attributes.insights[1].resource_id" is equal to "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=" + And the response "data[0].attributes.insights[1].type" is equal to "SECURITY_FINDING" + And the response "data[0].attributes.insights[0].resource_id" is equal to "MzZkNTMxODNmOGZlZmJiYzIyMDg4NzhmM2QyMDExZjB-ZmY5NzUwNDQzYTE0MGIyNDM1MTg4YjkxZDNmMDU4OGU=" + And the response "data[0].attributes.insights[0].type" is equal to "SECURITY_FINDING" + + @team:DataDog/k9-investigation + Scenario: Create cases for security findings returns "Bad Request" response + Given new "CreateCases" request + And body with value {"data": [{"attributes": {}, "relationships": {"findings": {"data": []}, "project": {"data": {"id": "7f198869-c7ef-4afc-97cf-da5cdc13b5c3", "type": "projects"}}}, "type": "cases"}]} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-investigation + Scenario: Create cases for security findings returns "Created" response + Given new "CreateCases" request + And body with value {"data": [{"attributes": {"title": "A title", "description": "A description"}, "relationships": {"findings": {"data": [{"id": "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=", "type": "findings"}]}, "project": {"data": {"id": "959a6f71-bac8-4027-b1d3-2264f569296f", "type": "projects"}}}, "type": "cases"}, {"attributes": {"title": "A title", "description": "A description"}, "relationships": {"findings": {"data": [{"id": "MzZkNTMxODNmOGZlZmJiYzIyMDg4NzhmM2QyMDExZjB-ZmY5NzUwNDQzYTE0MGIyNDM1MTg4YjkxZDNmMDU4OGU=", "type": "findings"}]}, "project": {"data": {"id": "959a6f71-bac8-4027-b1d3-2264f569296f", "type": "projects"}}}, "type": "cases"}]} + When the request is sent + Then the response status is 201 Created + And the response "data" has length 2 + And the response "data[0]" has field "id" + And the response "data[0].attributes.title" is equal to "A title" + And the response "data[0].attributes.description" is equal to "A description" + And the response "data[0].attributes.type" is equal to "SECURITY" + And the response "data[0].attributes.insights" has length 1 + And the response "data[0].attributes.insights[0].resource_id" is equal to "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=" + And the response "data[0].attributes.insights[0].type" is equal to "SECURITY_FINDING" + And the response "data[1]" has field "id" + And the response "data[1].attributes.title" is equal to "A title" + And the response "data[1].attributes.description" is equal to "A description" + And the response "data[1].attributes.type" is equal to "SECURITY" + And the response "data[1].attributes.insights" has length 1 + And the response "data[1].attributes.insights[0].resource_id" is equal to "MzZkNTMxODNmOGZlZmJiYzIyMDg4NzhmM2QyMDExZjB-ZmY5NzUwNDQzYTE0MGIyNDM1MTg4YjkxZDNmMDU4OGU=" + And the response "data[1].attributes.insights[0].type" is equal to "SECURITY_FINDING" + + @team:DataDog/k9-investigation + Scenario: Create cases for security findings returns "Not Found" response + Given new "CreateCases" request + And body with value {"data": [{"attributes": {}, "relationships": {"findings": {"data": [{"id": "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y=", "type": "findings"}]}, "project": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "projects"}}}, "type": "cases"}]} + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/k9-cloud-security-platform Scenario: Delete a custom framework returns "Bad Request" response Given new "DeleteCustomFramework" request @@ -546,6 +760,27 @@ Feature: Security Monitoring When the request is sent Then the response status is 204 OK + @team:DataDog/k9-investigation + Scenario: Detach security findings from their case returns "Bad Request" response + Given new "DetachCase" request + And body with value {"data": {"relationships": {"findings": {"data": []}}, "type": "cases"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-investigation + Scenario: Detach security findings from their case returns "No Content" response + Given new "DetachCase" request + And body with value {"data": {"relationships": {"findings": {"data": [{"id": "YzM2MTFjYzcyNmY0Zjg4MTAxZmRlNjQ1MWU1ZGQwYzR-YzI5NzE5Y2Y4MzU4ZjliNzhkNjYxNTY0ODIzZDQ2YTM=", "type": "findings"}]}}, "type": "cases"}} + When the request is sent + Then the response status is 204 No Content + + @team:DataDog/k9-investigation + Scenario: Detach security findings from their case returns "Not Found" response + Given new "DetachCase" request + And body with value {"data": {"relationships": {"findings": {"data": [{"id": "wrong-finding-id", "type": "findings"}]}}, "type": "cases"}} + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/asm-vm Scenario: Get SBOM returns "Bad request: The server cannot process the request due to invalid syntax in the request." response Given operation "GetSBOM" enabled diff --git a/tests/scenarios/features/v2/teams.feature b/tests/scenarios/features/v2/teams.feature index bf11bd0316d..faa1ca0889d 100644 --- a/tests/scenarios/features/v2/teams.feature +++ b/tests/scenarios/features/v2/teams.feature @@ -43,6 +43,25 @@ Feature: Teams When the request is sent Then the response status is 200 Represents a user's association to a team + @team:DataDog/aaa-omg + Scenario: Create a team hierarchy link returns "Conflict" response + Given new "AddTeamHierarchyLink" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And body with value {"data": {"relationships": {"parent_team": {"data": {"id": "{{team_hierarchy_link.data.relationships.parent_team.data.id}}", "type": "team"}}, "sub_team": {"data": {"id": "{{team_hierarchy_link.data.relationships.sub_team.data.id}}", "type": "team"}}}, "type": "team_hierarchy_links"}} + When the request is sent + Then the response status is 409 Conflict + + @team:DataDog/aaa-omg + Scenario: Create a team hierarchy link returns "OK" response + Given new "AddTeamHierarchyLink" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And body with value {"data": {"relationships": {"parent_team": {"data": {"id": "{{dd_team.data.id}}", "type": "team"}}, "sub_team": {"data": {"id": "{{dd_team_2.data.id}}", "type": "team"}}}, "type": "team_hierarchy_links"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/aaa-omg Scenario: Create a team link returns "API error response." response Given new "CreateTeamLink" request @@ -96,6 +115,28 @@ Feature: Teams And the response "data.attributes.visible_modules" is equal to ["m1","m2"] And the response "data.attributes.hidden_modules" is equal to ["m3"] + @team:DataDog/aaa-omg + Scenario: Get a team hierarchy link returns "API error response." response + Given new "GetTeamHierarchyLink" request + And request contains "link_id" parameter with value "aaa11111-aa11-aa11-aaaa-aaaaaa111111" + When the request is sent + Then the response status is 404 API error response. + + @team:DataDog/aaa-omg + Scenario: Get a team hierarchy link returns "OK" response + Given new "GetTeamHierarchyLink" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And request contains "link_id" parameter from "team_hierarchy_link.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" is equal to "{{ team_hierarchy_link.data.id }}" + And the response "data.relationships.parent_team.data.id" is equal to "{{ dd_team.data.id }}" + And the response "data.relationships.sub_team.data.id" is equal to "{{ dd_team_2.data.id }}" + And the response "included" has item with field "id" with value "{{ dd_team.data.id }}" + And the response "included" has item with field "id" with value "{{ dd_team_2.data.id }}" + @team:DataDog/aaa-omg Scenario: Get a team link returns "API error response." response Given new "GetTeamLink" request @@ -211,6 +252,31 @@ Feature: Teams When the request is sent Then the response status is 200 OK + @team:DataDog/aaa-omg + Scenario: Get team hierarchy links returns "OK" response + Given new "ListTeamHierarchyLinks" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And request contains "filter[parent_team]" parameter from "team_hierarchy_link.data.relationships.parent_team.data.id" + And request contains "filter[sub_team]" parameter from "team_hierarchy_link.data.relationships.sub_team.data.id" + And request contains "page[number]" parameter with value 0 + And request contains "page[size]" parameter with value 100 + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "data[0].id" is equal to "{{ team_hierarchy_link.data.id }}" + And the response "data[0].relationships.parent_team.data.id" is equal to "{{ dd_team.data.id }}" + And the response "data[0].relationships.sub_team.data.id" is equal to "{{ dd_team_2.data.id }}" + And the response "included" has item with field "id" with value "{{ dd_team.data.id }}" + And the response "included" has item with field "id" with value "{{ dd_team_2.data.id }}" + + @generated @skip @team:DataDog/aaa-omg @with-pagination + Scenario: Get team hierarchy links returns "OK" response with pagination + Given new "ListTeamHierarchyLinks" request + When the request with pagination is sent + Then the response status is 200 OK + @team:DataDog/aaa-omg Scenario: Get team memberships returns "API error response." response Given new "GetTeamMemberships" request @@ -293,6 +359,23 @@ Feature: Teams When the request is sent Then the response status is 204 No Content + @team:DataDog/aaa-omg + Scenario: Remove a team hierarchy link returns "API error response." response + Given new "RemoveTeamHierarchyLink" request + And request contains "link_id" parameter with value "aaa11111-aa11-aa11-aaaa-aaaaaa111111" + When the request is sent + Then the response status is 404 API error response. + + @team:DataDog/aaa-omg + Scenario: Remove a team hierarchy link returns "No Content" response + Given new "RemoveTeamHierarchyLink" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And request contains "link_id" parameter from "team_hierarchy_link.data.id" + When the request is sent + Then the response status is 204 No Content + @team:DataDog/aaa-omg Scenario: Remove a team link returns "API error response." response Given new "DeleteTeamLink" request diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 3799e64e630..a2fd0bca5da 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -3597,6 +3597,50 @@ "type": "safe" } }, + "DetachCase": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "CreateCases": { + "tag": "Security Monitoring", + "undo": { + "operationId": "DetachCase", + "parameters": [ + { + "name": "body", + "template": "{\n \"data\": {\n \"type\": \"cases\",\n \"id\": \"{{data[0].id}}\",\n \"relationships\": {\n \"findings\": {\n \"data\": [\n {\n \"type\": \"findings\",\n \"id\": \"{{data[0].attributes.insights[0].resource_id}}\"\n }\n ]\n }\n }\n }\n}" + } + ], + "type": "unsafe" + } + }, + "AttachCase": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "AttachJiraIssue": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, + "CreateJiraIssues": { + "tag": "Security Monitoring", + "undo": { + "operationId": "DetachCase", + "parameters": [ + { + "name": "body", + "template": "{\n \"data\": {\n \"type\": \"cases\",\n \"id\": \"{{data[0].id}}\",\n \"relationships\": {\n \"findings\": {\n \"data\": [\n {\n \"type\": \"findings\",\n \"id\": \"{{data[0].attributes.insights[0].resource_id}}\"\n }\n ]\n }\n }\n }\n}" + } + ], + "type": "unsafe" + } + }, "ListAssetsSBOMs": { "tag": "Security Monitoring", "undo": { @@ -4345,6 +4389,37 @@ "type": "unsafe" } }, + "ListTeamHierarchyLinks": { + "tag": "Teams", + "undo": { + "type": "safe" + } + }, + "AddTeamHierarchyLink": { + "tag": "Teams", + "undo": { + "operationId": "RemoveTeamHierarchyLink", + "parameters": [ + { + "name": "link_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "RemoveTeamHierarchyLink": { + "tag": "Teams", + "undo": { + "type": "idempotent" + } + }, + "GetTeamHierarchyLink": { + "tag": "Teams", + "undo": { + "type": "safe" + } + }, "DeleteTeamConnections": { "tag": "Team Connections", "undo": {