From e6e179bfd7c63302f894f105fb4dfdcd5d43037d Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Mon, 9 Feb 2026 16:01:32 +0000 Subject: [PATCH] Regenerate client from commit 6c91cfe of spec repo --- .generator/schemas/v2/openapi.yaml | 835 ++++++------------ api/datadog/configuration.go | 7 - api/datadogV2/api_case_management.go | 688 +-------------- api/datadogV2/api_seats.go | 316 +++++++ api/datadogV2/doc.go | 10 +- ....go => model_assign_seats_user_request.go} | 69 +- .../model_assign_seats_user_request_data.go | 186 ++++ ...sign_seats_user_request_data_attributes.go | 133 +++ ...go => model_assign_seats_user_response.go} | 69 +- .../model_assign_seats_user_response_data.go | 186 ++++ ...ign_seats_user_response_data_attributes.go | 137 +++ .../model_incident_relationship_data.go | 143 --- api/datadogV2/model_incident_resource_type.go | 64 -- .../model_jira_issue_create_attributes.go | 200 ----- api/datadogV2/model_jira_issue_create_data.go | 146 --- .../model_jira_issue_link_attributes.go | 101 --- api/datadogV2/model_jira_issue_link_data.go | 146 --- .../model_jira_issue_resource_type.go | 64 -- api/datadogV2/model_notebook_create_data.go | 111 --- api/datadogV2/model_notebook_resource_type.go | 64 -- .../model_seat_assignments_data_type.go | 64 ++ api/datadogV2/model_seat_user_data.go | 186 ++++ ...quest.go => model_seat_user_data_array.go} | 75 +- .../model_seat_user_data_attributes.go | 178 ++++ api/datadogV2/model_seat_user_data_type.go | 64 ++ api/datadogV2/model_seat_user_meta.go | 172 ++++ ...el_service_now_ticket_create_attributes.go | 136 --- .../model_service_now_ticket_create_data.go | 146 --- ...model_service_now_ticket_create_request.go | 110 --- .../model_service_now_ticket_resource_type.go | 64 -- ...o => model_unassign_seats_user_request.go} | 69 +- .../model_unassign_seats_user_request_data.go | 186 ++++ ...sign_seats_user_request_data_attributes.go | 133 +++ .../v2/case-management/CreateCaseJiraIssue.go | 37 - .../v2/case-management/CreateCaseNotebook.go | 31 - .../CreateCaseServiceNowTicket.go | 35 - examples/v2/case-management/LinkIncident.go | 36 - .../v2/case-management/LinkJiraIssueToCase.go | 34 - .../v2/case-management/MoveCaseToProject.go | 36 - .../v2/case-management/UnlinkJiraIssue.go | 26 - examples/v2/seats/AssignSeatsUserV2.go | 40 + examples/v2/seats/GetSeatsUsersV2.go | 29 + examples/v2/seats/UnassignSeatsUserV2.go | 36 + tests/scenarios/api_mappings.go | 1 + .../features/v2/case_management.feature | 195 ---- tests/scenarios/features/v2/seats.feature | 72 ++ tests/scenarios/features/v2/undo.json | 75 +- 47 files changed, 2614 insertions(+), 3327 deletions(-) create mode 100644 api/datadogV2/api_seats.go rename api/datadogV2/{model_jira_issue_create_request.go => model_assign_seats_user_request.go} (56%) create mode 100644 api/datadogV2/model_assign_seats_user_request_data.go create mode 100644 api/datadogV2/model_assign_seats_user_request_data_attributes.go rename api/datadogV2/{model_relationship_to_incident_request.go => model_assign_seats_user_response.go} (55%) create mode 100644 api/datadogV2/model_assign_seats_user_response_data.go create mode 100644 api/datadogV2/model_assign_seats_user_response_data_attributes.go delete mode 100644 api/datadogV2/model_incident_relationship_data.go delete mode 100644 api/datadogV2/model_incident_resource_type.go delete mode 100644 api/datadogV2/model_jira_issue_create_attributes.go delete mode 100644 api/datadogV2/model_jira_issue_create_data.go delete mode 100644 api/datadogV2/model_jira_issue_link_attributes.go delete mode 100644 api/datadogV2/model_jira_issue_link_data.go delete mode 100644 api/datadogV2/model_jira_issue_resource_type.go delete mode 100644 api/datadogV2/model_notebook_create_data.go delete mode 100644 api/datadogV2/model_notebook_resource_type.go create mode 100644 api/datadogV2/model_seat_assignments_data_type.go create mode 100644 api/datadogV2/model_seat_user_data.go rename api/datadogV2/{model_jira_issue_link_request.go => model_seat_user_data_array.go} (54%) create mode 100644 api/datadogV2/model_seat_user_data_attributes.go create mode 100644 api/datadogV2/model_seat_user_data_type.go create mode 100644 api/datadogV2/model_seat_user_meta.go delete mode 100644 api/datadogV2/model_service_now_ticket_create_attributes.go delete mode 100644 api/datadogV2/model_service_now_ticket_create_data.go delete mode 100644 api/datadogV2/model_service_now_ticket_create_request.go delete mode 100644 api/datadogV2/model_service_now_ticket_resource_type.go rename api/datadogV2/{model_notebook_create_request.go => model_unassign_seats_user_request.go} (54%) create mode 100644 api/datadogV2/model_unassign_seats_user_request_data.go create mode 100644 api/datadogV2/model_unassign_seats_user_request_data_attributes.go delete mode 100644 examples/v2/case-management/CreateCaseJiraIssue.go delete mode 100644 examples/v2/case-management/CreateCaseNotebook.go delete mode 100644 examples/v2/case-management/CreateCaseServiceNowTicket.go delete mode 100644 examples/v2/case-management/LinkIncident.go delete mode 100644 examples/v2/case-management/LinkJiraIssueToCase.go delete mode 100644 examples/v2/case-management/MoveCaseToProject.go delete mode 100644 examples/v2/case-management/UnlinkJiraIssue.go create mode 100644 examples/v2/seats/AssignSeatsUserV2.go create mode 100644 examples/v2/seats/GetSeatsUsersV2.go create mode 100644 examples/v2/seats/UnassignSeatsUserV2.go create mode 100644 tests/scenarios/features/v2/seats.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 181237b18fc..83cabe9a915 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -5362,6 +5362,73 @@ components: example: _latest type: string type: object + AssignSeatsUserRequest: + properties: + data: + $ref: '#/components/schemas/AssignSeatsUserRequestData' + description: The data for the assign seats user request. + type: object + AssignSeatsUserRequestData: + properties: + attributes: + $ref: '#/components/schemas/AssignSeatsUserRequestDataAttributes' + description: The attributes of the assign seats user request. + id: + description: The ID of the assign seats user request. + type: string + type: + $ref: '#/components/schemas/SeatAssignmentsDataType' + description: The type of the assign seats user request. + required: + - type + type: object + AssignSeatsUserRequestDataAttributes: + properties: + product_code: + description: The product code for which to assign seats. + example: '' + type: string + user_uuids: + description: The list of user IDs to assign seats to. + example: + - '' + items: + type: string + type: array + required: + - product_code + - user_uuids + type: object + AssignSeatsUserResponse: + properties: + data: + $ref: '#/components/schemas/AssignSeatsUserResponseData' + description: The data for the assign seats user response. + type: object + AssignSeatsUserResponseData: + properties: + attributes: + $ref: '#/components/schemas/AssignSeatsUserResponseDataAttributes' + description: The attributes of the assign seats user response. + id: + description: The ID of the assign seats user response. + type: string + type: + $ref: '#/components/schemas/SeatAssignmentsDataType' + required: + - type + type: object + AssignSeatsUserResponseDataAttributes: + properties: + assigned_ids: + description: The list of user IDs to which the seats were assigned. + items: + type: string + type: array + product_code: + description: The product code for which the seats were assigned. + type: string + type: object AttachCaseRequest: description: Request for attaching security findings to a case. properties: @@ -29490,27 +29557,6 @@ components: x-enum-varnames: - USERS - ATTACHMENTS - IncidentRelationshipData: - description: Incident relationship data - properties: - id: - description: Incident identifier - example: 00000000-0000-0000-0000-000000000000 - type: string - type: - $ref: '#/components/schemas/IncidentResourceType' - required: - - type - - id - type: object - IncidentResourceType: - description: Incident resource type - enum: - - incidents - example: incidents - type: string - x-enum-varnames: - - INCIDENTS IncidentRespondersType: description: The incident responders type. enum: @@ -32410,87 +32456,6 @@ components: $ref: '#/components/schemas/Case3rdPartyTicketStatus' readOnly: true type: object - JiraIssueCreateAttributes: - description: Jira issue creation attributes - properties: - fields: - additionalProperties: {} - description: Additional Jira fields - example: {} - type: object - issue_type_id: - description: Jira issue type ID - example: '10001' - type: string - jira_account_id: - description: Jira account ID - example: '1234' - type: string - project_id: - description: Jira project ID - example: '5678' - type: string - required: - - jira_account_id - - project_id - - issue_type_id - type: object - JiraIssueCreateData: - description: Jira issue creation data - properties: - attributes: - $ref: '#/components/schemas/JiraIssueCreateAttributes' - type: - $ref: '#/components/schemas/JiraIssueResourceType' - required: - - type - - attributes - type: object - JiraIssueCreateRequest: - description: Jira issue creation request - properties: - data: - $ref: '#/components/schemas/JiraIssueCreateData' - required: - - data - type: object - JiraIssueLinkAttributes: - description: Jira issue link attributes - properties: - jira_issue_url: - description: URL of the Jira issue - example: https://jira.example.com/browse/PROJ-123 - type: string - required: - - jira_issue_url - type: object - JiraIssueLinkData: - description: Jira issue link data - properties: - attributes: - $ref: '#/components/schemas/JiraIssueLinkAttributes' - type: - $ref: '#/components/schemas/JiraIssueResourceType' - required: - - type - - attributes - type: object - JiraIssueLinkRequest: - description: Jira issue link request - properties: - data: - $ref: '#/components/schemas/JiraIssueLinkData' - required: - - data - type: object - JiraIssueResourceType: - description: Jira issue resource type - enum: - - issues - example: issues - type: string - x-enum-varnames: - - ISSUES JiraIssueResult: description: Jira issue information properties: @@ -37920,30 +37885,6 @@ components: meta: $ref: '#/components/schemas/MonthlyCostAttributionMeta' type: object - NotebookCreateData: - description: Notebook creation data - properties: - type: - $ref: '#/components/schemas/NotebookResourceType' - required: - - type - type: object - NotebookCreateRequest: - description: Notebook creation request - properties: - data: - $ref: '#/components/schemas/NotebookCreateData' - required: - - data - type: object - NotebookResourceType: - description: Notebook resource type - enum: - - notebook - example: notebook - type: string - x-enum-varnames: - - NOTEBOOK NotebookTriggerWrapper: description: Schema for a Notebook-based trigger. properties: @@ -48006,14 +47947,6 @@ components: - id - type type: object - RelationshipToIncidentRequest: - description: Relationship to incident request - properties: - data: - $ref: '#/components/schemas/IncidentRelationshipData' - required: - - data - type: object RelationshipToIncidentResponderData: description: Relationship to impact object. properties: @@ -52255,6 +52188,76 @@ components: - ISSUE_ASSIGNEE - ISSUE_CASE - ISSUE_TEAM_OWNERS + SeatAssignmentsDataType: + default: seat-assignments + description: Seat assignments resource type. + enum: + - seat-assignments + example: seat-assignments + type: string + x-enum-varnames: + - SEAT_ASSIGNMENTS + SeatUserData: + properties: + attributes: + $ref: '#/components/schemas/SeatUserDataAttributes' + description: The attributes of the seat user. + id: + description: The ID of the seat user. + type: string + type: + $ref: '#/components/schemas/SeatUserDataType' + required: + - type + type: object + SeatUserDataArray: + properties: + data: + description: The list of seat users. + items: + $ref: '#/components/schemas/SeatUserData' + type: array + meta: + $ref: '#/components/schemas/SeatUserMeta' + description: The metadata of the seat users. + required: + - data + type: object + SeatUserDataAttributes: + properties: + assigned_at: + description: The date and time the seat was assigned. + format: date-time + type: string + email: + description: The email of the user. + type: string + name: + description: The name of the user. + type: string + type: object + SeatUserDataType: + default: seat-users + description: Seat users resource type. + enum: + - seat-users + example: seat-users + type: string + x-enum-varnames: + - SEAT_USERS + SeatUserMeta: + properties: + cursor: + description: The cursor for the seat users. + type: string + limit: + description: The limit for the seat users. + format: int64 + type: integer + next_cursor: + description: The next cursor for the seat users. + type: string + type: object SecretRuleArray: properties: data: @@ -58222,47 +58225,6 @@ components: $ref: '#/components/schemas/Case3rdPartyTicketStatus' readOnly: true type: object - ServiceNowTicketCreateAttributes: - description: ServiceNow ticket creation attributes - properties: - assignment_group: - description: ServiceNow assignment group - example: IT Support - type: string - instance_name: - description: ServiceNow instance name - example: my-instance - type: string - required: - - instance_name - type: object - ServiceNowTicketCreateData: - description: ServiceNow ticket creation data - properties: - attributes: - $ref: '#/components/schemas/ServiceNowTicketCreateAttributes' - type: - $ref: '#/components/schemas/ServiceNowTicketResourceType' - required: - - type - - attributes - type: object - ServiceNowTicketCreateRequest: - description: ServiceNow ticket creation request - properties: - data: - $ref: '#/components/schemas/ServiceNowTicketCreateData' - required: - - data - type: object - ServiceNowTicketResourceType: - description: ServiceNow ticket resource type - enum: - - tickets - example: tickets - type: string - x-enum-varnames: - - TICKETS ServiceNowTicketResult: description: ServiceNow ticket information properties: @@ -64399,6 +64361,43 @@ components: type: string x-enum-varnames: - AZURE_UC_CONFIGS + UnassignSeatsUserRequest: + properties: + data: + $ref: '#/components/schemas/UnassignSeatsUserRequestData' + description: The data for the unassign seats user request. + type: object + UnassignSeatsUserRequestData: + properties: + attributes: + $ref: '#/components/schemas/UnassignSeatsUserRequestDataAttributes' + description: The attributes of the unassign seats user request. + id: + description: The ID of the unassign seats user request. + type: string + type: + $ref: '#/components/schemas/SeatAssignmentsDataType' + description: The type of the unassign seats user request. + required: + - type + type: object + UnassignSeatsUserRequestDataAttributes: + properties: + product_code: + description: The product code for which to unassign seats. + example: '' + type: string + user_uuids: + description: The list of user IDs to unassign seats from. + example: + - '' + items: + type: string + type: array + required: + - product_code + - user_uuids + type: object Unit: description: Object containing the metric unit family, scale factor, name, and short name. @@ -72717,382 +72716,6 @@ paths: summary: Update case priority tags: - Case Management - /api/v2/cases/{case_id}/relationships/incidents: - post: - description: Link an incident to a case - operationId: LinkIncident - parameters: - - $ref: '#/components/parameters/CaseIDPathParameter' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/RelationshipToIncidentRequest' - description: Incident link request - required: true - responses: - '201': - content: - application/json: - schema: - $ref: '#/components/schemas/CaseResponse' - description: Created - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Bad Request - '401': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Unauthorized - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Forbidden - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Not Found - '429': - $ref: '#/components/responses/TooManyRequestsResponse' - security: - - apiKeyAuth: [] - appKeyAuth: [] - - AuthZ: - - cases_write - summary: Link incident to case - tags: - - Case Management - x-unstable: '**Note**: This endpoint is in preview and is subject to change. - - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' - /api/v2/cases/{case_id}/relationships/jira_issues: - delete: - description: Remove the link between a Jira issue and a case - operationId: UnlinkJiraIssue - parameters: - - $ref: '#/components/parameters/CaseIDPathParameter' - responses: - '204': - description: No Content - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Bad Request - '401': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Unauthorized - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Forbidden - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Not Found - '429': - $ref: '#/components/responses/TooManyRequestsResponse' - security: - - apiKeyAuth: [] - appKeyAuth: [] - - AuthZ: - - cases_write - summary: Remove Jira issue link from case - tags: - - Case Management - x-unstable: '**Note**: This endpoint is in preview and is subject to change. - - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' - patch: - description: Link an existing Jira issue to a case - operationId: LinkJiraIssueToCase - parameters: - - $ref: '#/components/parameters/CaseIDPathParameter' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/JiraIssueLinkRequest' - description: Jira issue link request - required: true - responses: - '204': - description: No Content - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Bad Request - '401': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Unauthorized - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Forbidden - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Not Found - '409': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Conflict - '429': - $ref: '#/components/responses/TooManyRequestsResponse' - security: - - apiKeyAuth: [] - appKeyAuth: [] - - AuthZ: - - cases_write - summary: Link existing Jira issue to case - tags: - - Case Management - x-unstable: '**Note**: This endpoint is in preview and is subject to change. - - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' - post: - description: Create a new Jira issue and link it to a case - operationId: CreateCaseJiraIssue - parameters: - - $ref: '#/components/parameters/CaseIDPathParameter' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/JiraIssueCreateRequest' - description: Jira issue creation request - required: true - responses: - '202': - description: Accepted - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Bad Request - '401': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Unauthorized - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Forbidden - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Not Found - '429': - $ref: '#/components/responses/TooManyRequestsResponse' - security: - - apiKeyAuth: [] - appKeyAuth: [] - - AuthZ: - - cases_write - summary: Create Jira issue for case - tags: - - Case Management - x-unstable: '**Note**: This endpoint is in preview and is subject to change. - - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' - /api/v2/cases/{case_id}/relationships/notebook: - post: - description: Create a new investigation notebook and link it to a case - operationId: CreateCaseNotebook - parameters: - - $ref: '#/components/parameters/CaseIDPathParameter' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/NotebookCreateRequest' - description: Notebook creation request - required: true - responses: - '204': - description: No Content - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Bad Request - '401': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Unauthorized - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Forbidden - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Not Found - '429': - $ref: '#/components/responses/TooManyRequestsResponse' - security: - - apiKeyAuth: [] - appKeyAuth: [] - - AuthZ: - - cases_write - summary: Create investigation notebook for case - tags: - - Case Management - x-unstable: '**Note**: This endpoint is in preview and is subject to change. - - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' - /api/v2/cases/{case_id}/relationships/project: - patch: - description: Update the project associated with a case - operationId: MoveCaseToProject - parameters: - - $ref: '#/components/parameters/CaseIDPathParameter' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/ProjectRelationship' - description: Project update request - required: true - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/CaseResponse' - description: OK - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Bad Request - '401': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Unauthorized - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Forbidden - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Not Found - '429': - $ref: '#/components/responses/TooManyRequestsResponse' - security: - - apiKeyAuth: [] - appKeyAuth: [] - - AuthZ: - - cases_write - summary: Update case project - tags: - - Case Management - x-unstable: '**Note**: This endpoint is in preview and is subject to change. - - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' - /api/v2/cases/{case_id}/relationships/servicenow_tickets: - post: - description: Create a new ServiceNow incident ticket and link it to a case - operationId: CreateCaseServiceNowTicket - parameters: - - $ref: '#/components/parameters/CaseIDPathParameter' - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/ServiceNowTicketCreateRequest' - description: ServiceNow ticket creation request - required: true - responses: - '202': - description: Accepted - '400': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Bad Request - '401': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Unauthorized - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Forbidden - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/JSONAPIErrorResponse' - description: Not Found - '429': - $ref: '#/components/responses/TooManyRequestsResponse' - security: - - apiKeyAuth: [] - appKeyAuth: [] - - AuthZ: - - cases_write - summary: Create ServiceNow ticket for case - tags: - - Case Management - x-unstable: '**Note**: This endpoint is in preview and is subject to change. - - If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/cases/{case_id}/status: post: description: Update case status @@ -92716,6 +92339,113 @@ paths: x-unstable: '**Note**: This endpoint is in public beta. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/seats/users: + delete: + description: Unassign seats from users for a product code. + operationId: UnassignSeatsUserV2 + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UnassignSeatsUserRequest' + required: true + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequestResponse' + '422': + description: Unprocessable Entity + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + description: Internal Server Error + summary: Unassign seats from users + tags: + - Seats + x-permission: + operator: OR + permissions: + - billing_edit + - incident_write + - on_call_write + get: + description: Get the list of seats users assigned to a product code. + operationId: GetSeatsUsersV2 + parameters: + - description: The product code for which to retrieve seat users. + in: query + name: product_code + required: true + schema: + type: string + - description: Maximum number of results to return. + in: query + name: page[limit] + schema: + type: integer + - description: Cursor for pagination. + in: query + name: page[cursor] + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SeatUserDataArray' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '422': + description: Unprocessable Entity + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + description: Internal Server Error + summary: Get seats users + tags: + - Seats + x-permission: + operator: OR + permissions: + - billing_read + - incident_read + - on_call_read + post: + description: Assign seats to users for a product code. + operationId: AssignSeatsUserV2 + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AssignSeatsUserRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/AssignSeatsUserResponse' + description: Created + '400': + $ref: '#/components/responses/BadRequestResponse' + '422': + description: Unprocessable Entity + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + '500': + description: Internal Server Error + summary: Assign seats to users + tags: + - Seats + x-permission: + operator: OR + permissions: + - billing_edit + - incident_write + - on_call_write /api/v2/security-entities/risk-scores: get: description: Get a list of entity risk scores for your organization. Entity @@ -103849,6 +103579,9 @@ tags: - description: Manage retention filters through [Manage Applications](https://app.datadoghq.com/rum/list) of RUM for your organization. name: Rum Retention Filters +- description: The seats API allows you to view, assign, and unassign seats for your + organization. + name: Seats - description: Create and manage your security rules, signals, filters, and more. See the [Datadog Security page](https://docs.datadoghq.com/security/) for more information. diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index fcfbdfb3b9b..6e36cfe4464 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -672,13 +672,6 @@ func NewConfiguration() *Configuration { "v2.GetOpenAPI": false, "v2.ListAPIs": false, "v2.UpdateOpenAPI": false, - "v2.CreateCaseJiraIssue": false, - "v2.CreateCaseNotebook": false, - "v2.CreateCaseServiceNowTicket": false, - "v2.LinkIncident": false, - "v2.LinkJiraIssueToCase": false, - "v2.MoveCaseToProject": false, - "v2.UnlinkJiraIssue": false, "v2.ActivateContentPack": false, "v2.CancelThreatHuntingJob": false, "v2.ConvertJobResultToSignal": false, diff --git a/api/datadogV2/api_case_management.go b/api/datadogV2/api_case_management.go index e0edd89f805..be1224fe85c 100644 --- a/api/datadogV2/api_case_management.go +++ b/api/datadogV2/api_case_management.go @@ -6,8 +6,6 @@ package datadogV2 import ( _context "context" - _fmt "fmt" - _log "log" _nethttp "net/http" _neturl "net/url" @@ -340,273 +338,6 @@ func (a *CaseManagementApi) CreateCase(ctx _context.Context, body CaseCreateRequ return localVarReturnValue, localVarHTTPResponse, nil } -// CreateCaseJiraIssue Create Jira issue for case. -// Create a new Jira issue and link it to a case -func (a *CaseManagementApi) CreateCaseJiraIssue(ctx _context.Context, caseId string, body JiraIssueCreateRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - ) - - operationId := "v2.CreateCaseJiraIssue" - isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) - if !isOperationEnabled { - return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - if isOperationEnabled && a.Client.Cfg.Debug { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CaseManagementApi.CreateCaseJiraIssue") - if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/cases/{case_id}/relationships/jira_issues" - 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"] = "*/*" - - // 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 == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -// CreateCaseNotebook Create investigation notebook for case. -// Create a new investigation notebook and link it to a case -func (a *CaseManagementApi) CreateCaseNotebook(ctx _context.Context, caseId string, body NotebookCreateRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - ) - - operationId := "v2.CreateCaseNotebook" - isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) - if !isOperationEnabled { - return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - if isOperationEnabled && a.Client.Cfg.Debug { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CaseManagementApi.CreateCaseNotebook") - if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/cases/{case_id}/relationships/notebook" - 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"] = "*/*" - - // 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 == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -// CreateCaseServiceNowTicket Create ServiceNow ticket for case. -// Create a new ServiceNow incident ticket and link it to a case -func (a *CaseManagementApi) CreateCaseServiceNowTicket(ctx _context.Context, caseId string, body ServiceNowTicketCreateRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - ) - - operationId := "v2.CreateCaseServiceNowTicket" - isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) - if !isOperationEnabled { - return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - if isOperationEnabled && a.Client.Cfg.Debug { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CaseManagementApi.CreateCaseServiceNowTicket") - if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/cases/{case_id}/relationships/servicenow_tickets" - 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"] = "*/*" - - // 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 == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - // CreateProject Create a project. // Create a project. func (a *CaseManagementApi) CreateProject(ctx _context.Context, body ProjectCreateRequest) (ProjectResponse, *_nethttp.Response, error) { @@ -1364,319 +1095,32 @@ func (a *CaseManagementApi) GetProjects(ctx _context.Context) (ProjectsResponse, return localVarReturnValue, localVarHTTPResponse, nil } -// LinkIncident Link incident to case. -// Link an incident to a case -func (a *CaseManagementApi) LinkIncident(ctx _context.Context, caseId string, body RelationshipToIncidentRequest) (CaseResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPost - localVarPostBody interface{} - localVarReturnValue CaseResponse - ) +// SearchCasesOptionalParameters holds optional parameters for SearchCases. +type SearchCasesOptionalParameters struct { + PageSize *int64 + PageNumber *int64 + SortField *CaseSortableField + Filter *string + SortAsc *bool +} - operationId := "v2.LinkIncident" - isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) - if !isOperationEnabled { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - if isOperationEnabled && a.Client.Cfg.Debug { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } +// NewSearchCasesOptionalParameters creates an empty struct for parameters. +func NewSearchCasesOptionalParameters() *SearchCasesOptionalParameters { + this := SearchCasesOptionalParameters{} + return &this +} - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CaseManagementApi.LinkIncident") - if err != nil { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - } +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *SearchCasesOptionalParameters) WithPageSize(pageSize int64) *SearchCasesOptionalParameters { + r.PageSize = &pageSize + return r +} - localVarPath := localBasePath + "/api/v2/cases/{case_id}/relationships/incidents" - 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 == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := datadog.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// LinkJiraIssueToCase Link existing Jira issue to case. -// Link an existing Jira issue to a case -func (a *CaseManagementApi) LinkJiraIssueToCase(ctx _context.Context, caseId string, body JiraIssueLinkRequest) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - ) - - operationId := "v2.LinkJiraIssueToCase" - isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) - if !isOperationEnabled { - return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - if isOperationEnabled && a.Client.Cfg.Debug { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CaseManagementApi.LinkJiraIssueToCase") - if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/cases/{case_id}/relationships/jira_issues" - 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"] = "*/*" - - // 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 == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 409 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -// MoveCaseToProject Update case project. -// Update the project associated with a case -func (a *CaseManagementApi) MoveCaseToProject(ctx _context.Context, caseId string, body ProjectRelationship) (CaseResponse, *_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodPatch - localVarPostBody interface{} - localVarReturnValue CaseResponse - ) - - operationId := "v2.MoveCaseToProject" - isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) - if !isOperationEnabled { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - if isOperationEnabled && a.Client.Cfg.Debug { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CaseManagementApi.MoveCaseToProject") - if err != nil { - return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/cases/{case_id}/relationships/project" - 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 == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarReturnValue, localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := datadog.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, localVarHTTPResponse, newErr - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -// SearchCasesOptionalParameters holds optional parameters for SearchCases. -type SearchCasesOptionalParameters struct { - PageSize *int64 - PageNumber *int64 - SortField *CaseSortableField - Filter *string - SortAsc *bool -} - -// NewSearchCasesOptionalParameters creates an empty struct for parameters. -func NewSearchCasesOptionalParameters() *SearchCasesOptionalParameters { - this := SearchCasesOptionalParameters{} - return &this -} - -// WithPageSize sets the corresponding parameter name and returns the struct. -func (r *SearchCasesOptionalParameters) WithPageSize(pageSize int64) *SearchCasesOptionalParameters { - r.PageSize = &pageSize - return r -} - -// WithPageNumber sets the corresponding parameter name and returns the struct. -func (r *SearchCasesOptionalParameters) WithPageNumber(pageNumber int64) *SearchCasesOptionalParameters { - r.PageNumber = &pageNumber - return r -} +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *SearchCasesOptionalParameters) WithPageNumber(pageNumber int64) *SearchCasesOptionalParameters { + r.PageNumber = &pageNumber + return r +} // WithSortField sets the corresponding parameter name and returns the struct. func (r *SearchCasesOptionalParameters) WithSortField(sortField CaseSortableField) *SearchCasesOptionalParameters { @@ -2006,92 +1450,6 @@ func (a *CaseManagementApi) UnassignCase(ctx _context.Context, caseId string, bo return localVarReturnValue, localVarHTTPResponse, nil } -// UnlinkJiraIssue Remove Jira issue link from case. -// Remove the link between a Jira issue and a case -func (a *CaseManagementApi) UnlinkJiraIssue(ctx _context.Context, caseId string) (*_nethttp.Response, error) { - var ( - localVarHTTPMethod = _nethttp.MethodDelete - localVarPostBody interface{} - ) - - operationId := "v2.UnlinkJiraIssue" - isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) - if !isOperationEnabled { - return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} - } - if isOperationEnabled && a.Client.Cfg.Debug { - _log.Printf("WARNING: Using unstable operation '%s'", operationId) - } - - localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.CaseManagementApi.UnlinkJiraIssue") - if err != nil { - return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/api/v2/cases/{case_id}/relationships/jira_issues" - localVarPath = datadog.ReplacePathParameter(localVarPath, "{case_id}", _neturl.PathEscape(datadog.ParameterToString(caseId, ""))) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := _neturl.Values{} - localVarFormParams := _neturl.Values{} - localVarHeaderParams["Accept"] = "*/*" - - if a.Client.Cfg.DelegatedTokenConfig != nil { - err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) - if err != nil { - return nil, err - } - } else { - datadog.SetAuthKeys( - ctx, - &localVarHeaderParams, - [2]string{"apiKeyAuth", "DD-API-KEY"}, - [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, - ) - } - req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.Client.CallAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := datadog.ReadBody(localVarHTTPResponse) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := datadog.GenericOpenAPIError{ - ErrorBody: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { - var v JSONAPIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - return localVarHTTPResponse, newErr - } - if localVarHTTPResponse.StatusCode == 429 { - var v APIErrorResponse - err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - return localVarHTTPResponse, newErr - } - newErr.ErrorModel = v - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - // UpdateAttributes Update case attributes. // Update case attributes func (a *CaseManagementApi) UpdateAttributes(ctx _context.Context, caseId string, body CaseUpdateAttributesRequest) (CaseResponse, *_nethttp.Response, error) { diff --git a/api/datadogV2/api_seats.go b/api/datadogV2/api_seats.go new file mode 100644 index 00000000000..93e463fbd26 --- /dev/null +++ b/api/datadogV2/api_seats.go @@ -0,0 +1,316 @@ +// 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 ( + _context "context" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SeatsApi service type +type SeatsApi datadog.Service + +// AssignSeatsUserV2 Assign seats to users. +// Assign seats to users for a product code. +func (a *SeatsApi) AssignSeatsUserV2(ctx _context.Context, body AssignSeatsUserRequest) (AssignSeatsUserResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue AssignSeatsUserResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SeatsApi.AssignSeatsUserV2") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/seats/users" + + 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 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 == 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 + } + if localVarHTTPResponse.StatusCode == 422 || localVarHTTPResponse.StatusCode == 500 { + var v None + 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 +} + +// GetSeatsUsersV2OptionalParameters holds optional parameters for GetSeatsUsersV2. +type GetSeatsUsersV2OptionalParameters struct { + PageLimit *int32 + PageCursor *string +} + +// NewGetSeatsUsersV2OptionalParameters creates an empty struct for parameters. +func NewGetSeatsUsersV2OptionalParameters() *GetSeatsUsersV2OptionalParameters { + this := GetSeatsUsersV2OptionalParameters{} + return &this +} + +// WithPageLimit sets the corresponding parameter name and returns the struct. +func (r *GetSeatsUsersV2OptionalParameters) WithPageLimit(pageLimit int32) *GetSeatsUsersV2OptionalParameters { + r.PageLimit = &pageLimit + return r +} + +// WithPageCursor sets the corresponding parameter name and returns the struct. +func (r *GetSeatsUsersV2OptionalParameters) WithPageCursor(pageCursor string) *GetSeatsUsersV2OptionalParameters { + r.PageCursor = &pageCursor + return r +} + +// GetSeatsUsersV2 Get seats users. +// Get the list of seats users assigned to a product code. +func (a *SeatsApi) GetSeatsUsersV2(ctx _context.Context, productCode string, o ...GetSeatsUsersV2OptionalParameters) (SeatUserDataArray, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue SeatUserDataArray + optionalParams GetSeatsUsersV2OptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type GetSeatsUsersV2OptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SeatsApi.GetSeatsUsersV2") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/seats/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarQueryParams.Add("product_code", datadog.ParameterToString(productCode, "")) + if optionalParams.PageLimit != nil { + localVarQueryParams.Add("page[limit]", datadog.ParameterToString(*optionalParams.PageLimit, "")) + } + if optionalParams.PageCursor != nil { + localVarQueryParams.Add("page[cursor]", datadog.ParameterToString(*optionalParams.PageCursor, "")) + } + localVarHeaderParams["Accept"] = "*/*" + + 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 == 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 + } + if localVarHTTPResponse.StatusCode == 422 || localVarHTTPResponse.StatusCode == 500 { + var v None + 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 +} + +// UnassignSeatsUserV2 Unassign seats from users. +// Unassign seats from users for a product code. +func (a *SeatsApi) UnassignSeatsUserV2(ctx _context.Context, body UnassignSeatsUserRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SeatsApi.UnassignSeatsUserV2") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/seats/users" + + 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 == 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 + } + if localVarHTTPResponse.StatusCode == 422 || localVarHTTPResponse.StatusCode == 500 { + var v None + 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 +} + +// NewSeatsApi Returns NewSeatsApi. +func NewSeatsApi(client *datadog.APIClient) *SeatsApi { + return &SeatsApi{ + Client: client, + } +} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 067088af561..ae47ed4ce16 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -123,9 +123,6 @@ // - [CaseManagementApi.AssignCase] // - [CaseManagementApi.CommentCase] // - [CaseManagementApi.CreateCase] -// - [CaseManagementApi.CreateCaseJiraIssue] -// - [CaseManagementApi.CreateCaseNotebook] -// - [CaseManagementApi.CreateCaseServiceNowTicket] // - [CaseManagementApi.CreateProject] // - [CaseManagementApi.CreateProjectNotificationRule] // - [CaseManagementApi.DeleteCaseComment] @@ -136,13 +133,9 @@ // - [CaseManagementApi.GetProject] // - [CaseManagementApi.GetProjectNotificationRules] // - [CaseManagementApi.GetProjects] -// - [CaseManagementApi.LinkIncident] -// - [CaseManagementApi.LinkJiraIssueToCase] -// - [CaseManagementApi.MoveCaseToProject] // - [CaseManagementApi.SearchCases] // - [CaseManagementApi.UnarchiveCase] // - [CaseManagementApi.UnassignCase] -// - [CaseManagementApi.UnlinkJiraIssue] // - [CaseManagementApi.UpdateAttributes] // - [CaseManagementApi.UpdateCaseCustomAttribute] // - [CaseManagementApi.UpdateCaseDescription] @@ -598,6 +591,9 @@ // - [RumRetentionFiltersApi.ListRetentionFilters] // - [RumRetentionFiltersApi.OrderRetentionFilters] // - [RumRetentionFiltersApi.UpdateRetentionFilter] +// - [SeatsApi.AssignSeatsUserV2] +// - [SeatsApi.GetSeatsUsersV2] +// - [SeatsApi.UnassignSeatsUserV2] // - [SecurityMonitoringApi.ActivateContentPack] // - [SecurityMonitoringApi.AttachCase] // - [SecurityMonitoringApi.AttachJiraIssue] diff --git a/api/datadogV2/model_jira_issue_create_request.go b/api/datadogV2/model_assign_seats_user_request.go similarity index 56% rename from api/datadogV2/model_jira_issue_create_request.go rename to api/datadogV2/model_assign_seats_user_request.go index ac07bce074a..ff3d39c6f9c 100644 --- a/api/datadogV2/model_jira_issue_create_request.go +++ b/api/datadogV2/model_assign_seats_user_request.go @@ -5,68 +5,72 @@ package datadogV2 import ( - "fmt" - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// JiraIssueCreateRequest Jira issue creation request -type JiraIssueCreateRequest struct { - // Jira issue creation data - Data JiraIssueCreateData `json:"data"` +// AssignSeatsUserRequest +type AssignSeatsUserRequest struct { + // + Data *AssignSeatsUserRequestData `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:"-"` } -// NewJiraIssueCreateRequest instantiates a new JiraIssueCreateRequest object. +// NewAssignSeatsUserRequest instantiates a new AssignSeatsUserRequest 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 NewJiraIssueCreateRequest(data JiraIssueCreateData) *JiraIssueCreateRequest { - this := JiraIssueCreateRequest{} - this.Data = data +func NewAssignSeatsUserRequest() *AssignSeatsUserRequest { + this := AssignSeatsUserRequest{} return &this } -// NewJiraIssueCreateRequestWithDefaults instantiates a new JiraIssueCreateRequest object. +// NewAssignSeatsUserRequestWithDefaults instantiates a new AssignSeatsUserRequest 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 NewJiraIssueCreateRequestWithDefaults() *JiraIssueCreateRequest { - this := JiraIssueCreateRequest{} +func NewAssignSeatsUserRequestWithDefaults() *AssignSeatsUserRequest { + this := AssignSeatsUserRequest{} return &this } -// GetData returns the Data field value. -func (o *JiraIssueCreateRequest) GetData() JiraIssueCreateData { - if o == nil { - var ret JiraIssueCreateData +// GetData returns the Data field value if set, zero value otherwise. +func (o *AssignSeatsUserRequest) GetData() AssignSeatsUserRequestData { + if o == nil || o.Data == nil { + var ret AssignSeatsUserRequestData return ret } - return o.Data + return *o.Data } -// GetDataOk returns a tuple with the Data field value +// 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 *JiraIssueCreateRequest) GetDataOk() (*JiraIssueCreateData, bool) { - if o == nil { +func (o *AssignSeatsUserRequest) GetDataOk() (*AssignSeatsUserRequestData, bool) { + if o == nil || o.Data == nil { return nil, false } - return &o.Data, true + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *AssignSeatsUserRequest) HasData() bool { + return o != nil && o.Data != nil } -// SetData sets field value. -func (o *JiraIssueCreateRequest) SetData(v JiraIssueCreateData) { - o.Data = v +// SetData gets a reference to the given AssignSeatsUserRequestData and assigns it to the Data field. +func (o *AssignSeatsUserRequest) SetData(v AssignSeatsUserRequestData) { + o.Data = &v } // MarshalJSON serializes the struct using spec logic. -func (o JiraIssueCreateRequest) MarshalJSON() ([]byte, error) { +func (o AssignSeatsUserRequest) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } - toSerialize["data"] = o.Data + if o.Data != nil { + toSerialize["data"] = o.Data + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -75,16 +79,13 @@ func (o JiraIssueCreateRequest) MarshalJSON() ([]byte, error) { } // UnmarshalJSON deserializes the given payload. -func (o *JiraIssueCreateRequest) UnmarshalJSON(bytes []byte) (err error) { +func (o *AssignSeatsUserRequest) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Data *JiraIssueCreateData `json:"data"` + Data *AssignSeatsUserRequestData `json:"data,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"}) @@ -93,10 +94,10 @@ func (o *JiraIssueCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } hasInvalidField := false - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true } - o.Data = *all.Data + o.Data = all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_assign_seats_user_request_data.go b/api/datadogV2/model_assign_seats_user_request_data.go new file mode 100644 index 00000000000..d7bb6f50487 --- /dev/null +++ b/api/datadogV2/model_assign_seats_user_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" +) + +// AssignSeatsUserRequestData +type AssignSeatsUserRequestData struct { + // + Attributes *AssignSeatsUserRequestDataAttributes `json:"attributes,omitempty"` + // The ID of the assign seats user request. + Id *string `json:"id,omitempty"` + // Seat assignments resource type. + Type SeatAssignmentsDataType `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:"-"` +} + +// NewAssignSeatsUserRequestData instantiates a new AssignSeatsUserRequestData 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 NewAssignSeatsUserRequestData(typeVar SeatAssignmentsDataType) *AssignSeatsUserRequestData { + this := AssignSeatsUserRequestData{} + this.Type = typeVar + return &this +} + +// NewAssignSeatsUserRequestDataWithDefaults instantiates a new AssignSeatsUserRequestData 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 NewAssignSeatsUserRequestDataWithDefaults() *AssignSeatsUserRequestData { + this := AssignSeatsUserRequestData{} + var typeVar SeatAssignmentsDataType = SEATASSIGNMENTSDATATYPE_SEAT_ASSIGNMENTS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *AssignSeatsUserRequestData) GetAttributes() AssignSeatsUserRequestDataAttributes { + if o == nil || o.Attributes == nil { + var ret AssignSeatsUserRequestDataAttributes + 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 *AssignSeatsUserRequestData) GetAttributesOk() (*AssignSeatsUserRequestDataAttributes, 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 *AssignSeatsUserRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given AssignSeatsUserRequestDataAttributes and assigns it to the Attributes field. +func (o *AssignSeatsUserRequestData) SetAttributes(v AssignSeatsUserRequestDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AssignSeatsUserRequestData) 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 *AssignSeatsUserRequestData) 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 *AssignSeatsUserRequestData) 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 *AssignSeatsUserRequestData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *AssignSeatsUserRequestData) GetType() SeatAssignmentsDataType { + if o == nil { + var ret SeatAssignmentsDataType + 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 *AssignSeatsUserRequestData) GetTypeOk() (*SeatAssignmentsDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AssignSeatsUserRequestData) SetType(v SeatAssignmentsDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AssignSeatsUserRequestData) 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 + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AssignSeatsUserRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AssignSeatsUserRequestDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *SeatAssignmentsDataType `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", "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_assign_seats_user_request_data_attributes.go b/api/datadogV2/model_assign_seats_user_request_data_attributes.go new file mode 100644 index 00000000000..ba59f4bd6f9 --- /dev/null +++ b/api/datadogV2/model_assign_seats_user_request_data_attributes.go @@ -0,0 +1,133 @@ +// 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" +) + +// AssignSeatsUserRequestDataAttributes +type AssignSeatsUserRequestDataAttributes struct { + // The product code for which to assign seats. + ProductCode string `json:"product_code"` + // The list of user IDs to assign seats to. + UserUuids []string `json:"user_uuids"` + // 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:"-"` +} + +// NewAssignSeatsUserRequestDataAttributes instantiates a new AssignSeatsUserRequestDataAttributes 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 NewAssignSeatsUserRequestDataAttributes(productCode string, userUuids []string) *AssignSeatsUserRequestDataAttributes { + this := AssignSeatsUserRequestDataAttributes{} + this.ProductCode = productCode + this.UserUuids = userUuids + return &this +} + +// NewAssignSeatsUserRequestDataAttributesWithDefaults instantiates a new AssignSeatsUserRequestDataAttributes 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 NewAssignSeatsUserRequestDataAttributesWithDefaults() *AssignSeatsUserRequestDataAttributes { + this := AssignSeatsUserRequestDataAttributes{} + return &this +} + +// GetProductCode returns the ProductCode field value. +func (o *AssignSeatsUserRequestDataAttributes) GetProductCode() string { + if o == nil { + var ret string + return ret + } + return o.ProductCode +} + +// GetProductCodeOk returns a tuple with the ProductCode field value +// and a boolean to check if the value has been set. +func (o *AssignSeatsUserRequestDataAttributes) GetProductCodeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ProductCode, true +} + +// SetProductCode sets field value. +func (o *AssignSeatsUserRequestDataAttributes) SetProductCode(v string) { + o.ProductCode = v +} + +// GetUserUuids returns the UserUuids field value. +func (o *AssignSeatsUserRequestDataAttributes) GetUserUuids() []string { + if o == nil { + var ret []string + return ret + } + return o.UserUuids +} + +// GetUserUuidsOk returns a tuple with the UserUuids field value +// and a boolean to check if the value has been set. +func (o *AssignSeatsUserRequestDataAttributes) GetUserUuidsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.UserUuids, true +} + +// SetUserUuids sets field value. +func (o *AssignSeatsUserRequestDataAttributes) SetUserUuids(v []string) { + o.UserUuids = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AssignSeatsUserRequestDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["product_code"] = o.ProductCode + toSerialize["user_uuids"] = o.UserUuids + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AssignSeatsUserRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ProductCode *string `json:"product_code"` + UserUuids *[]string `json:"user_uuids"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ProductCode == nil { + return fmt.Errorf("required field product_code missing") + } + if all.UserUuids == nil { + return fmt.Errorf("required field user_uuids missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"product_code", "user_uuids"}) + } else { + return err + } + o.ProductCode = *all.ProductCode + o.UserUuids = *all.UserUuids + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_relationship_to_incident_request.go b/api/datadogV2/model_assign_seats_user_response.go similarity index 55% rename from api/datadogV2/model_relationship_to_incident_request.go rename to api/datadogV2/model_assign_seats_user_response.go index 0cca52c09e0..60726299048 100644 --- a/api/datadogV2/model_relationship_to_incident_request.go +++ b/api/datadogV2/model_assign_seats_user_response.go @@ -5,68 +5,72 @@ package datadogV2 import ( - "fmt" - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// RelationshipToIncidentRequest Relationship to incident request -type RelationshipToIncidentRequest struct { - // Incident relationship data - Data IncidentRelationshipData `json:"data"` +// AssignSeatsUserResponse +type AssignSeatsUserResponse struct { + // + Data *AssignSeatsUserResponseData `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:"-"` } -// NewRelationshipToIncidentRequest instantiates a new RelationshipToIncidentRequest object. +// NewAssignSeatsUserResponse instantiates a new AssignSeatsUserResponse 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 NewRelationshipToIncidentRequest(data IncidentRelationshipData) *RelationshipToIncidentRequest { - this := RelationshipToIncidentRequest{} - this.Data = data +func NewAssignSeatsUserResponse() *AssignSeatsUserResponse { + this := AssignSeatsUserResponse{} return &this } -// NewRelationshipToIncidentRequestWithDefaults instantiates a new RelationshipToIncidentRequest object. +// NewAssignSeatsUserResponseWithDefaults instantiates a new AssignSeatsUserResponse 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 NewRelationshipToIncidentRequestWithDefaults() *RelationshipToIncidentRequest { - this := RelationshipToIncidentRequest{} +func NewAssignSeatsUserResponseWithDefaults() *AssignSeatsUserResponse { + this := AssignSeatsUserResponse{} return &this } -// GetData returns the Data field value. -func (o *RelationshipToIncidentRequest) GetData() IncidentRelationshipData { - if o == nil { - var ret IncidentRelationshipData +// GetData returns the Data field value if set, zero value otherwise. +func (o *AssignSeatsUserResponse) GetData() AssignSeatsUserResponseData { + if o == nil || o.Data == nil { + var ret AssignSeatsUserResponseData return ret } - return o.Data + return *o.Data } -// GetDataOk returns a tuple with the Data field value +// 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 *RelationshipToIncidentRequest) GetDataOk() (*IncidentRelationshipData, bool) { - if o == nil { +func (o *AssignSeatsUserResponse) GetDataOk() (*AssignSeatsUserResponseData, bool) { + if o == nil || o.Data == nil { return nil, false } - return &o.Data, true + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *AssignSeatsUserResponse) HasData() bool { + return o != nil && o.Data != nil } -// SetData sets field value. -func (o *RelationshipToIncidentRequest) SetData(v IncidentRelationshipData) { - o.Data = v +// SetData gets a reference to the given AssignSeatsUserResponseData and assigns it to the Data field. +func (o *AssignSeatsUserResponse) SetData(v AssignSeatsUserResponseData) { + o.Data = &v } // MarshalJSON serializes the struct using spec logic. -func (o RelationshipToIncidentRequest) MarshalJSON() ([]byte, error) { +func (o AssignSeatsUserResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } - toSerialize["data"] = o.Data + if o.Data != nil { + toSerialize["data"] = o.Data + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -75,16 +79,13 @@ func (o RelationshipToIncidentRequest) MarshalJSON() ([]byte, error) { } // UnmarshalJSON deserializes the given payload. -func (o *RelationshipToIncidentRequest) UnmarshalJSON(bytes []byte) (err error) { +func (o *AssignSeatsUserResponse) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Data *IncidentRelationshipData `json:"data"` + Data *AssignSeatsUserResponseData `json:"data,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"}) @@ -93,10 +94,10 @@ func (o *RelationshipToIncidentRequest) UnmarshalJSON(bytes []byte) (err error) } hasInvalidField := false - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true } - o.Data = *all.Data + o.Data = all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_assign_seats_user_response_data.go b/api/datadogV2/model_assign_seats_user_response_data.go new file mode 100644 index 00000000000..ed3617fe8f4 --- /dev/null +++ b/api/datadogV2/model_assign_seats_user_response_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" +) + +// AssignSeatsUserResponseData +type AssignSeatsUserResponseData struct { + // + Attributes *AssignSeatsUserResponseDataAttributes `json:"attributes,omitempty"` + // The ID of the assign seats user response. + Id *string `json:"id,omitempty"` + // Seat assignments resource type. + Type SeatAssignmentsDataType `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:"-"` +} + +// NewAssignSeatsUserResponseData instantiates a new AssignSeatsUserResponseData 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 NewAssignSeatsUserResponseData(typeVar SeatAssignmentsDataType) *AssignSeatsUserResponseData { + this := AssignSeatsUserResponseData{} + this.Type = typeVar + return &this +} + +// NewAssignSeatsUserResponseDataWithDefaults instantiates a new AssignSeatsUserResponseData 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 NewAssignSeatsUserResponseDataWithDefaults() *AssignSeatsUserResponseData { + this := AssignSeatsUserResponseData{} + var typeVar SeatAssignmentsDataType = SEATASSIGNMENTSDATATYPE_SEAT_ASSIGNMENTS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *AssignSeatsUserResponseData) GetAttributes() AssignSeatsUserResponseDataAttributes { + if o == nil || o.Attributes == nil { + var ret AssignSeatsUserResponseDataAttributes + 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 *AssignSeatsUserResponseData) GetAttributesOk() (*AssignSeatsUserResponseDataAttributes, 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 *AssignSeatsUserResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given AssignSeatsUserResponseDataAttributes and assigns it to the Attributes field. +func (o *AssignSeatsUserResponseData) SetAttributes(v AssignSeatsUserResponseDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AssignSeatsUserResponseData) 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 *AssignSeatsUserResponseData) 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 *AssignSeatsUserResponseData) 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 *AssignSeatsUserResponseData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *AssignSeatsUserResponseData) GetType() SeatAssignmentsDataType { + if o == nil { + var ret SeatAssignmentsDataType + 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 *AssignSeatsUserResponseData) GetTypeOk() (*SeatAssignmentsDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *AssignSeatsUserResponseData) SetType(v SeatAssignmentsDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AssignSeatsUserResponseData) 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 + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AssignSeatsUserResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *AssignSeatsUserResponseDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *SeatAssignmentsDataType `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", "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_assign_seats_user_response_data_attributes.go b/api/datadogV2/model_assign_seats_user_response_data_attributes.go new file mode 100644 index 00000000000..46ff93bca00 --- /dev/null +++ b/api/datadogV2/model_assign_seats_user_response_data_attributes.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" +) + +// AssignSeatsUserResponseDataAttributes +type AssignSeatsUserResponseDataAttributes struct { + // The list of user IDs to which the seats were assigned. + AssignedIds []string `json:"assigned_ids,omitempty"` + // The product code for which the seats were assigned. + ProductCode *string `json:"product_code,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:"-"` +} + +// NewAssignSeatsUserResponseDataAttributes instantiates a new AssignSeatsUserResponseDataAttributes 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 NewAssignSeatsUserResponseDataAttributes() *AssignSeatsUserResponseDataAttributes { + this := AssignSeatsUserResponseDataAttributes{} + return &this +} + +// NewAssignSeatsUserResponseDataAttributesWithDefaults instantiates a new AssignSeatsUserResponseDataAttributes 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 NewAssignSeatsUserResponseDataAttributesWithDefaults() *AssignSeatsUserResponseDataAttributes { + this := AssignSeatsUserResponseDataAttributes{} + return &this +} + +// GetAssignedIds returns the AssignedIds field value if set, zero value otherwise. +func (o *AssignSeatsUserResponseDataAttributes) GetAssignedIds() []string { + if o == nil || o.AssignedIds == nil { + var ret []string + return ret + } + return o.AssignedIds +} + +// GetAssignedIdsOk returns a tuple with the AssignedIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AssignSeatsUserResponseDataAttributes) GetAssignedIdsOk() (*[]string, bool) { + if o == nil || o.AssignedIds == nil { + return nil, false + } + return &o.AssignedIds, true +} + +// HasAssignedIds returns a boolean if a field has been set. +func (o *AssignSeatsUserResponseDataAttributes) HasAssignedIds() bool { + return o != nil && o.AssignedIds != nil +} + +// SetAssignedIds gets a reference to the given []string and assigns it to the AssignedIds field. +func (o *AssignSeatsUserResponseDataAttributes) SetAssignedIds(v []string) { + o.AssignedIds = v +} + +// GetProductCode returns the ProductCode field value if set, zero value otherwise. +func (o *AssignSeatsUserResponseDataAttributes) GetProductCode() string { + if o == nil || o.ProductCode == nil { + var ret string + return ret + } + return *o.ProductCode +} + +// GetProductCodeOk returns a tuple with the ProductCode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AssignSeatsUserResponseDataAttributes) GetProductCodeOk() (*string, bool) { + if o == nil || o.ProductCode == nil { + return nil, false + } + return o.ProductCode, true +} + +// HasProductCode returns a boolean if a field has been set. +func (o *AssignSeatsUserResponseDataAttributes) HasProductCode() bool { + return o != nil && o.ProductCode != nil +} + +// SetProductCode gets a reference to the given string and assigns it to the ProductCode field. +func (o *AssignSeatsUserResponseDataAttributes) SetProductCode(v string) { + o.ProductCode = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o AssignSeatsUserResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AssignedIds != nil { + toSerialize["assigned_ids"] = o.AssignedIds + } + if o.ProductCode != nil { + toSerialize["product_code"] = o.ProductCode + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *AssignSeatsUserResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AssignedIds []string `json:"assigned_ids,omitempty"` + ProductCode *string `json:"product_code,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{"assigned_ids", "product_code"}) + } else { + return err + } + o.AssignedIds = all.AssignedIds + o.ProductCode = all.ProductCode + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_incident_relationship_data.go b/api/datadogV2/model_incident_relationship_data.go deleted file mode 100644 index 6a7d376d2cb..00000000000 --- a/api/datadogV2/model_incident_relationship_data.go +++ /dev/null @@ -1,143 +0,0 @@ -// 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" -) - -// IncidentRelationshipData Incident relationship data -type IncidentRelationshipData struct { - // Incident identifier - Id string `json:"id"` - // Incident resource type - Type IncidentResourceType `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:"-"` -} - -// NewIncidentRelationshipData instantiates a new IncidentRelationshipData 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 NewIncidentRelationshipData(id string, typeVar IncidentResourceType) *IncidentRelationshipData { - this := IncidentRelationshipData{} - this.Id = id - this.Type = typeVar - return &this -} - -// NewIncidentRelationshipDataWithDefaults instantiates a new IncidentRelationshipData 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 NewIncidentRelationshipDataWithDefaults() *IncidentRelationshipData { - this := IncidentRelationshipData{} - return &this -} - -// GetId returns the Id field value. -func (o *IncidentRelationshipData) 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 *IncidentRelationshipData) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value. -func (o *IncidentRelationshipData) SetId(v string) { - o.Id = v -} - -// GetType returns the Type field value. -func (o *IncidentRelationshipData) GetType() IncidentResourceType { - if o == nil { - var ret IncidentResourceType - 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 *IncidentRelationshipData) GetTypeOk() (*IncidentResourceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *IncidentRelationshipData) SetType(v IncidentResourceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o IncidentRelationshipData) 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 *IncidentRelationshipData) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Id *string `json:"id"` - Type *IncidentResourceType `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_incident_resource_type.go b/api/datadogV2/model_incident_resource_type.go deleted file mode 100644 index ae65615ff1a..00000000000 --- a/api/datadogV2/model_incident_resource_type.go +++ /dev/null @@ -1,64 +0,0 @@ -// 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" -) - -// IncidentResourceType Incident resource type -type IncidentResourceType string - -// List of IncidentResourceType. -const ( - INCIDENTRESOURCETYPE_INCIDENTS IncidentResourceType = "incidents" -) - -var allowedIncidentResourceTypeEnumValues = []IncidentResourceType{ - INCIDENTRESOURCETYPE_INCIDENTS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *IncidentResourceType) GetAllowedValues() []IncidentResourceType { - return allowedIncidentResourceTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *IncidentResourceType) UnmarshalJSON(src []byte) error { - var value string - err := datadog.Unmarshal(src, &value) - if err != nil { - return err - } - *v = IncidentResourceType(value) - return nil -} - -// NewIncidentResourceTypeFromValue returns a pointer to a valid IncidentResourceType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewIncidentResourceTypeFromValue(v string) (*IncidentResourceType, error) { - ev := IncidentResourceType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for IncidentResourceType: valid values are %v", v, allowedIncidentResourceTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v IncidentResourceType) IsValid() bool { - for _, existing := range allowedIncidentResourceTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to IncidentResourceType value. -func (v IncidentResourceType) Ptr() *IncidentResourceType { - return &v -} diff --git a/api/datadogV2/model_jira_issue_create_attributes.go b/api/datadogV2/model_jira_issue_create_attributes.go deleted file mode 100644 index bad20c805f6..00000000000 --- a/api/datadogV2/model_jira_issue_create_attributes.go +++ /dev/null @@ -1,200 +0,0 @@ -// 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" -) - -// JiraIssueCreateAttributes Jira issue creation attributes -type JiraIssueCreateAttributes struct { - // Additional Jira fields - Fields map[string]interface{} `json:"fields,omitempty"` - // Jira issue type ID - IssueTypeId string `json:"issue_type_id"` - // Jira account ID - JiraAccountId string `json:"jira_account_id"` - // Jira project ID - ProjectId string `json:"project_id"` - // 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:"-"` -} - -// NewJiraIssueCreateAttributes instantiates a new JiraIssueCreateAttributes 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 NewJiraIssueCreateAttributes(issueTypeId string, jiraAccountId string, projectId string) *JiraIssueCreateAttributes { - this := JiraIssueCreateAttributes{} - this.IssueTypeId = issueTypeId - this.JiraAccountId = jiraAccountId - this.ProjectId = projectId - return &this -} - -// NewJiraIssueCreateAttributesWithDefaults instantiates a new JiraIssueCreateAttributes 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 NewJiraIssueCreateAttributesWithDefaults() *JiraIssueCreateAttributes { - this := JiraIssueCreateAttributes{} - return &this -} - -// GetFields returns the Fields field value if set, zero value otherwise. -func (o *JiraIssueCreateAttributes) GetFields() map[string]interface{} { - if o == nil || o.Fields == nil { - var ret map[string]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 *JiraIssueCreateAttributes) GetFieldsOk() (*map[string]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 *JiraIssueCreateAttributes) HasFields() bool { - return o != nil && o.Fields != nil -} - -// SetFields gets a reference to the given map[string]interface{} and assigns it to the Fields field. -func (o *JiraIssueCreateAttributes) SetFields(v map[string]interface{}) { - o.Fields = v -} - -// GetIssueTypeId returns the IssueTypeId field value. -func (o *JiraIssueCreateAttributes) GetIssueTypeId() string { - if o == nil { - var ret string - return ret - } - return o.IssueTypeId -} - -// GetIssueTypeIdOk returns a tuple with the IssueTypeId field value -// and a boolean to check if the value has been set. -func (o *JiraIssueCreateAttributes) GetIssueTypeIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.IssueTypeId, true -} - -// SetIssueTypeId sets field value. -func (o *JiraIssueCreateAttributes) SetIssueTypeId(v string) { - o.IssueTypeId = v -} - -// GetJiraAccountId returns the JiraAccountId field value. -func (o *JiraIssueCreateAttributes) GetJiraAccountId() string { - if o == nil { - var ret string - return ret - } - return o.JiraAccountId -} - -// GetJiraAccountIdOk returns a tuple with the JiraAccountId field value -// and a boolean to check if the value has been set. -func (o *JiraIssueCreateAttributes) GetJiraAccountIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.JiraAccountId, true -} - -// SetJiraAccountId sets field value. -func (o *JiraIssueCreateAttributes) SetJiraAccountId(v string) { - o.JiraAccountId = v -} - -// GetProjectId returns the ProjectId field value. -func (o *JiraIssueCreateAttributes) GetProjectId() string { - if o == nil { - var ret string - return ret - } - return o.ProjectId -} - -// GetProjectIdOk returns a tuple with the ProjectId field value -// and a boolean to check if the value has been set. -func (o *JiraIssueCreateAttributes) GetProjectIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.ProjectId, true -} - -// SetProjectId sets field value. -func (o *JiraIssueCreateAttributes) SetProjectId(v string) { - o.ProjectId = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o JiraIssueCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - if o.Fields != nil { - toSerialize["fields"] = o.Fields - } - toSerialize["issue_type_id"] = o.IssueTypeId - toSerialize["jira_account_id"] = o.JiraAccountId - toSerialize["project_id"] = o.ProjectId - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *JiraIssueCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Fields map[string]interface{} `json:"fields,omitempty"` - IssueTypeId *string `json:"issue_type_id"` - JiraAccountId *string `json:"jira_account_id"` - ProjectId *string `json:"project_id"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.IssueTypeId == nil { - return fmt.Errorf("required field issue_type_id missing") - } - if all.JiraAccountId == nil { - return fmt.Errorf("required field jira_account_id missing") - } - if all.ProjectId == nil { - return fmt.Errorf("required field project_id missing") - } - additionalProperties := make(map[string]interface{}) - if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"fields", "issue_type_id", "jira_account_id", "project_id"}) - } else { - return err - } - o.Fields = all.Fields - o.IssueTypeId = *all.IssueTypeId - o.JiraAccountId = *all.JiraAccountId - o.ProjectId = *all.ProjectId - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - return nil -} diff --git a/api/datadogV2/model_jira_issue_create_data.go b/api/datadogV2/model_jira_issue_create_data.go deleted file mode 100644 index ede2d44b7a5..00000000000 --- a/api/datadogV2/model_jira_issue_create_data.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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" -) - -// JiraIssueCreateData Jira issue creation data -type JiraIssueCreateData struct { - // Jira issue creation attributes - Attributes JiraIssueCreateAttributes `json:"attributes"` - // Jira issue resource type - Type JiraIssueResourceType `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:"-"` -} - -// NewJiraIssueCreateData instantiates a new JiraIssueCreateData 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 NewJiraIssueCreateData(attributes JiraIssueCreateAttributes, typeVar JiraIssueResourceType) *JiraIssueCreateData { - this := JiraIssueCreateData{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewJiraIssueCreateDataWithDefaults instantiates a new JiraIssueCreateData 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 NewJiraIssueCreateDataWithDefaults() *JiraIssueCreateData { - this := JiraIssueCreateData{} - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *JiraIssueCreateData) GetAttributes() JiraIssueCreateAttributes { - if o == nil { - var ret JiraIssueCreateAttributes - 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 *JiraIssueCreateData) GetAttributesOk() (*JiraIssueCreateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *JiraIssueCreateData) SetAttributes(v JiraIssueCreateAttributes) { - o.Attributes = v -} - -// GetType returns the Type field value. -func (o *JiraIssueCreateData) GetType() JiraIssueResourceType { - if o == nil { - var ret JiraIssueResourceType - 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 *JiraIssueCreateData) GetTypeOk() (*JiraIssueResourceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *JiraIssueCreateData) SetType(v JiraIssueResourceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o JiraIssueCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *JiraIssueCreateData) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Attributes *JiraIssueCreateAttributes `json:"attributes"` - Type *JiraIssueResourceType `json:"type"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if all.Type == nil { - return fmt.Errorf("required field type missing") - } - additionalProperties := make(map[string]interface{}) - if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) - } else { - return err - } - - hasInvalidField := false - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.Attributes = *all.Attributes - if !all.Type.IsValid() { - hasInvalidField = true - } else { - o.Type = *all.Type - } - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - - return nil -} diff --git a/api/datadogV2/model_jira_issue_link_attributes.go b/api/datadogV2/model_jira_issue_link_attributes.go deleted file mode 100644 index 7500b1d5725..00000000000 --- a/api/datadogV2/model_jira_issue_link_attributes.go +++ /dev/null @@ -1,101 +0,0 @@ -// 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" -) - -// JiraIssueLinkAttributes Jira issue link attributes -type JiraIssueLinkAttributes struct { - // URL of the Jira issue - 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:"-"` -} - -// NewJiraIssueLinkAttributes instantiates a new JiraIssueLinkAttributes 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 NewJiraIssueLinkAttributes(jiraIssueUrl string) *JiraIssueLinkAttributes { - this := JiraIssueLinkAttributes{} - this.JiraIssueUrl = jiraIssueUrl - return &this -} - -// NewJiraIssueLinkAttributesWithDefaults instantiates a new JiraIssueLinkAttributes 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 NewJiraIssueLinkAttributesWithDefaults() *JiraIssueLinkAttributes { - this := JiraIssueLinkAttributes{} - return &this -} - -// GetJiraIssueUrl returns the JiraIssueUrl field value. -func (o *JiraIssueLinkAttributes) 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 *JiraIssueLinkAttributes) GetJiraIssueUrlOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.JiraIssueUrl, true -} - -// SetJiraIssueUrl sets field value. -func (o *JiraIssueLinkAttributes) SetJiraIssueUrl(v string) { - o.JiraIssueUrl = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o JiraIssueLinkAttributes) 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 *JiraIssueLinkAttributes) 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_jira_issue_link_data.go b/api/datadogV2/model_jira_issue_link_data.go deleted file mode 100644 index 49ecca2fc73..00000000000 --- a/api/datadogV2/model_jira_issue_link_data.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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" -) - -// JiraIssueLinkData Jira issue link data -type JiraIssueLinkData struct { - // Jira issue link attributes - Attributes JiraIssueLinkAttributes `json:"attributes"` - // Jira issue resource type - Type JiraIssueResourceType `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:"-"` -} - -// NewJiraIssueLinkData instantiates a new JiraIssueLinkData 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 NewJiraIssueLinkData(attributes JiraIssueLinkAttributes, typeVar JiraIssueResourceType) *JiraIssueLinkData { - this := JiraIssueLinkData{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewJiraIssueLinkDataWithDefaults instantiates a new JiraIssueLinkData 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 NewJiraIssueLinkDataWithDefaults() *JiraIssueLinkData { - this := JiraIssueLinkData{} - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *JiraIssueLinkData) GetAttributes() JiraIssueLinkAttributes { - if o == nil { - var ret JiraIssueLinkAttributes - 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 *JiraIssueLinkData) GetAttributesOk() (*JiraIssueLinkAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *JiraIssueLinkData) SetAttributes(v JiraIssueLinkAttributes) { - o.Attributes = v -} - -// GetType returns the Type field value. -func (o *JiraIssueLinkData) GetType() JiraIssueResourceType { - if o == nil { - var ret JiraIssueResourceType - 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 *JiraIssueLinkData) GetTypeOk() (*JiraIssueResourceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *JiraIssueLinkData) SetType(v JiraIssueResourceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o JiraIssueLinkData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *JiraIssueLinkData) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Attributes *JiraIssueLinkAttributes `json:"attributes"` - Type *JiraIssueResourceType `json:"type"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if all.Type == nil { - return fmt.Errorf("required field type missing") - } - additionalProperties := make(map[string]interface{}) - if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) - } else { - return err - } - - hasInvalidField := false - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.Attributes = *all.Attributes - if !all.Type.IsValid() { - hasInvalidField = true - } else { - o.Type = *all.Type - } - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - - return nil -} diff --git a/api/datadogV2/model_jira_issue_resource_type.go b/api/datadogV2/model_jira_issue_resource_type.go deleted file mode 100644 index a3337da30d6..00000000000 --- a/api/datadogV2/model_jira_issue_resource_type.go +++ /dev/null @@ -1,64 +0,0 @@ -// 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" -) - -// JiraIssueResourceType Jira issue resource type -type JiraIssueResourceType string - -// List of JiraIssueResourceType. -const ( - JIRAISSUERESOURCETYPE_ISSUES JiraIssueResourceType = "issues" -) - -var allowedJiraIssueResourceTypeEnumValues = []JiraIssueResourceType{ - JIRAISSUERESOURCETYPE_ISSUES, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *JiraIssueResourceType) GetAllowedValues() []JiraIssueResourceType { - return allowedJiraIssueResourceTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *JiraIssueResourceType) UnmarshalJSON(src []byte) error { - var value string - err := datadog.Unmarshal(src, &value) - if err != nil { - return err - } - *v = JiraIssueResourceType(value) - return nil -} - -// NewJiraIssueResourceTypeFromValue returns a pointer to a valid JiraIssueResourceType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewJiraIssueResourceTypeFromValue(v string) (*JiraIssueResourceType, error) { - ev := JiraIssueResourceType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for JiraIssueResourceType: valid values are %v", v, allowedJiraIssueResourceTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v JiraIssueResourceType) IsValid() bool { - for _, existing := range allowedJiraIssueResourceTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to JiraIssueResourceType value. -func (v JiraIssueResourceType) Ptr() *JiraIssueResourceType { - return &v -} diff --git a/api/datadogV2/model_notebook_create_data.go b/api/datadogV2/model_notebook_create_data.go deleted file mode 100644 index 9e17b093277..00000000000 --- a/api/datadogV2/model_notebook_create_data.go +++ /dev/null @@ -1,111 +0,0 @@ -// 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" -) - -// NotebookCreateData Notebook creation data -type NotebookCreateData struct { - // Notebook resource type - Type NotebookResourceType `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:"-"` -} - -// NewNotebookCreateData instantiates a new NotebookCreateData 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 NewNotebookCreateData(typeVar NotebookResourceType) *NotebookCreateData { - this := NotebookCreateData{} - this.Type = typeVar - return &this -} - -// NewNotebookCreateDataWithDefaults instantiates a new NotebookCreateData 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 NewNotebookCreateDataWithDefaults() *NotebookCreateData { - this := NotebookCreateData{} - return &this -} - -// GetType returns the Type field value. -func (o *NotebookCreateData) GetType() NotebookResourceType { - if o == nil { - var ret NotebookResourceType - 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 *NotebookCreateData) GetTypeOk() (*NotebookResourceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *NotebookCreateData) SetType(v NotebookResourceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o NotebookCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *NotebookCreateData) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Type *NotebookResourceType `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{"type"}) - } else { - return err - } - - hasInvalidField := false - 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_notebook_resource_type.go b/api/datadogV2/model_notebook_resource_type.go deleted file mode 100644 index 0f8f93deac9..00000000000 --- a/api/datadogV2/model_notebook_resource_type.go +++ /dev/null @@ -1,64 +0,0 @@ -// 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" -) - -// NotebookResourceType Notebook resource type -type NotebookResourceType string - -// List of NotebookResourceType. -const ( - NOTEBOOKRESOURCETYPE_NOTEBOOK NotebookResourceType = "notebook" -) - -var allowedNotebookResourceTypeEnumValues = []NotebookResourceType{ - NOTEBOOKRESOURCETYPE_NOTEBOOK, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *NotebookResourceType) GetAllowedValues() []NotebookResourceType { - return allowedNotebookResourceTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *NotebookResourceType) UnmarshalJSON(src []byte) error { - var value string - err := datadog.Unmarshal(src, &value) - if err != nil { - return err - } - *v = NotebookResourceType(value) - return nil -} - -// NewNotebookResourceTypeFromValue returns a pointer to a valid NotebookResourceType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewNotebookResourceTypeFromValue(v string) (*NotebookResourceType, error) { - ev := NotebookResourceType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for NotebookResourceType: valid values are %v", v, allowedNotebookResourceTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v NotebookResourceType) IsValid() bool { - for _, existing := range allowedNotebookResourceTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to NotebookResourceType value. -func (v NotebookResourceType) Ptr() *NotebookResourceType { - return &v -} diff --git a/api/datadogV2/model_seat_assignments_data_type.go b/api/datadogV2/model_seat_assignments_data_type.go new file mode 100644 index 00000000000..444d6aedafb --- /dev/null +++ b/api/datadogV2/model_seat_assignments_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" +) + +// SeatAssignmentsDataType Seat assignments resource type. +type SeatAssignmentsDataType string + +// List of SeatAssignmentsDataType. +const ( + SEATASSIGNMENTSDATATYPE_SEAT_ASSIGNMENTS SeatAssignmentsDataType = "seat-assignments" +) + +var allowedSeatAssignmentsDataTypeEnumValues = []SeatAssignmentsDataType{ + SEATASSIGNMENTSDATATYPE_SEAT_ASSIGNMENTS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SeatAssignmentsDataType) GetAllowedValues() []SeatAssignmentsDataType { + return allowedSeatAssignmentsDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SeatAssignmentsDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SeatAssignmentsDataType(value) + return nil +} + +// NewSeatAssignmentsDataTypeFromValue returns a pointer to a valid SeatAssignmentsDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSeatAssignmentsDataTypeFromValue(v string) (*SeatAssignmentsDataType, error) { + ev := SeatAssignmentsDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SeatAssignmentsDataType: valid values are %v", v, allowedSeatAssignmentsDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SeatAssignmentsDataType) IsValid() bool { + for _, existing := range allowedSeatAssignmentsDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SeatAssignmentsDataType value. +func (v SeatAssignmentsDataType) Ptr() *SeatAssignmentsDataType { + return &v +} diff --git a/api/datadogV2/model_seat_user_data.go b/api/datadogV2/model_seat_user_data.go new file mode 100644 index 00000000000..1b3034e6199 --- /dev/null +++ b/api/datadogV2/model_seat_user_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" +) + +// SeatUserData +type SeatUserData struct { + // + Attributes *SeatUserDataAttributes `json:"attributes,omitempty"` + // The ID of the seat user. + Id *string `json:"id,omitempty"` + // Seat users resource type. + Type SeatUserDataType `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:"-"` +} + +// NewSeatUserData instantiates a new SeatUserData 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 NewSeatUserData(typeVar SeatUserDataType) *SeatUserData { + this := SeatUserData{} + this.Type = typeVar + return &this +} + +// NewSeatUserDataWithDefaults instantiates a new SeatUserData 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 NewSeatUserDataWithDefaults() *SeatUserData { + this := SeatUserData{} + var typeVar SeatUserDataType = SEATUSERDATATYPE_SEAT_USERS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *SeatUserData) GetAttributes() SeatUserDataAttributes { + if o == nil || o.Attributes == nil { + var ret SeatUserDataAttributes + 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 *SeatUserData) GetAttributesOk() (*SeatUserDataAttributes, 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 *SeatUserData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given SeatUserDataAttributes and assigns it to the Attributes field. +func (o *SeatUserData) SetAttributes(v SeatUserDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SeatUserData) 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 *SeatUserData) 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 *SeatUserData) 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 *SeatUserData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *SeatUserData) GetType() SeatUserDataType { + if o == nil { + var ret SeatUserDataType + 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 *SeatUserData) GetTypeOk() (*SeatUserDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *SeatUserData) SetType(v SeatUserDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SeatUserData) 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 + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SeatUserData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *SeatUserDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *SeatUserDataType `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", "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_jira_issue_link_request.go b/api/datadogV2/model_seat_user_data_array.go similarity index 54% rename from api/datadogV2/model_jira_issue_link_request.go rename to api/datadogV2/model_seat_user_data_array.go index bd32d68ecb7..8ca480fd4d9 100644 --- a/api/datadogV2/model_jira_issue_link_request.go +++ b/api/datadogV2/model_seat_user_data_array.go @@ -10,37 +10,39 @@ import ( "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// JiraIssueLinkRequest Jira issue link request -type JiraIssueLinkRequest struct { - // Jira issue link data - Data JiraIssueLinkData `json:"data"` +// SeatUserDataArray +type SeatUserDataArray struct { + // The list of seat users. + Data []SeatUserData `json:"data"` + // + Meta *SeatUserMeta `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:"-"` } -// NewJiraIssueLinkRequest instantiates a new JiraIssueLinkRequest object. +// NewSeatUserDataArray instantiates a new SeatUserDataArray 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 NewJiraIssueLinkRequest(data JiraIssueLinkData) *JiraIssueLinkRequest { - this := JiraIssueLinkRequest{} +func NewSeatUserDataArray(data []SeatUserData) *SeatUserDataArray { + this := SeatUserDataArray{} this.Data = data return &this } -// NewJiraIssueLinkRequestWithDefaults instantiates a new JiraIssueLinkRequest object. +// NewSeatUserDataArrayWithDefaults instantiates a new SeatUserDataArray 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 NewJiraIssueLinkRequestWithDefaults() *JiraIssueLinkRequest { - this := JiraIssueLinkRequest{} +func NewSeatUserDataArrayWithDefaults() *SeatUserDataArray { + this := SeatUserDataArray{} return &this } // GetData returns the Data field value. -func (o *JiraIssueLinkRequest) GetData() JiraIssueLinkData { +func (o *SeatUserDataArray) GetData() []SeatUserData { if o == nil { - var ret JiraIssueLinkData + var ret []SeatUserData return ret } return o.Data @@ -48,7 +50,7 @@ func (o *JiraIssueLinkRequest) GetData() JiraIssueLinkData { // GetDataOk returns a tuple with the Data field value // and a boolean to check if the value has been set. -func (o *JiraIssueLinkRequest) GetDataOk() (*JiraIssueLinkData, bool) { +func (o *SeatUserDataArray) GetDataOk() (*[]SeatUserData, bool) { if o == nil { return nil, false } @@ -56,17 +58,48 @@ func (o *JiraIssueLinkRequest) GetDataOk() (*JiraIssueLinkData, bool) { } // SetData sets field value. -func (o *JiraIssueLinkRequest) SetData(v JiraIssueLinkData) { +func (o *SeatUserDataArray) SetData(v []SeatUserData) { o.Data = v } +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *SeatUserDataArray) GetMeta() SeatUserMeta { + if o == nil || o.Meta == nil { + var ret SeatUserMeta + 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 *SeatUserDataArray) GetMetaOk() (*SeatUserMeta, 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 *SeatUserDataArray) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given SeatUserMeta and assigns it to the Meta field. +func (o *SeatUserDataArray) SetMeta(v SeatUserMeta) { + o.Meta = &v +} + // MarshalJSON serializes the struct using spec logic. -func (o JiraIssueLinkRequest) MarshalJSON() ([]byte, error) { +func (o SeatUserDataArray) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } toSerialize["data"] = o.Data + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -75,9 +108,10 @@ func (o JiraIssueLinkRequest) MarshalJSON() ([]byte, error) { } // UnmarshalJSON deserializes the given payload. -func (o *JiraIssueLinkRequest) UnmarshalJSON(bytes []byte) (err error) { +func (o *SeatUserDataArray) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Data *JiraIssueLinkData `json:"data"` + Data *[]SeatUserData `json:"data"` + Meta *SeatUserMeta `json:"meta,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) @@ -87,16 +121,17 @@ func (o *JiraIssueLinkRequest) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + datadog.DeleteKeys(additionalProperties, &[]string{"data", "meta"}) } else { return err } hasInvalidField := false - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + o.Data = *all.Data + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true } - o.Data = *all.Data + o.Meta = all.Meta if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_seat_user_data_attributes.go b/api/datadogV2/model_seat_user_data_attributes.go new file mode 100644 index 00000000000..502b1845933 --- /dev/null +++ b/api/datadogV2/model_seat_user_data_attributes.go @@ -0,0 +1,178 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SeatUserDataAttributes +type SeatUserDataAttributes struct { + // The date and time the seat was assigned. + AssignedAt *time.Time `json:"assigned_at,omitempty"` + // The email of the user. + Email *string `json:"email,omitempty"` + // The name of the user. + Name *string `json:"name,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSeatUserDataAttributes instantiates a new SeatUserDataAttributes 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 NewSeatUserDataAttributes() *SeatUserDataAttributes { + this := SeatUserDataAttributes{} + return &this +} + +// NewSeatUserDataAttributesWithDefaults instantiates a new SeatUserDataAttributes 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 NewSeatUserDataAttributesWithDefaults() *SeatUserDataAttributes { + this := SeatUserDataAttributes{} + return &this +} + +// GetAssignedAt returns the AssignedAt field value if set, zero value otherwise. +func (o *SeatUserDataAttributes) GetAssignedAt() time.Time { + if o == nil || o.AssignedAt == nil { + var ret time.Time + return ret + } + return *o.AssignedAt +} + +// GetAssignedAtOk returns a tuple with the AssignedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SeatUserDataAttributes) GetAssignedAtOk() (*time.Time, bool) { + if o == nil || o.AssignedAt == nil { + return nil, false + } + return o.AssignedAt, true +} + +// HasAssignedAt returns a boolean if a field has been set. +func (o *SeatUserDataAttributes) HasAssignedAt() bool { + return o != nil && o.AssignedAt != nil +} + +// SetAssignedAt gets a reference to the given time.Time and assigns it to the AssignedAt field. +func (o *SeatUserDataAttributes) SetAssignedAt(v time.Time) { + o.AssignedAt = &v +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *SeatUserDataAttributes) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SeatUserDataAttributes) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *SeatUserDataAttributes) HasEmail() bool { + return o != nil && o.Email != nil +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *SeatUserDataAttributes) SetEmail(v string) { + o.Email = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SeatUserDataAttributes) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SeatUserDataAttributes) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SeatUserDataAttributes) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SeatUserDataAttributes) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SeatUserDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AssignedAt != nil { + if o.AssignedAt.Nanosecond() == 0 { + toSerialize["assigned_at"] = o.AssignedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["assigned_at"] = o.AssignedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SeatUserDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AssignedAt *time.Time `json:"assigned_at,omitempty"` + Email *string `json:"email,omitempty"` + Name *string `json:"name,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"assigned_at", "email", "name"}) + } else { + return err + } + o.AssignedAt = all.AssignedAt + o.Email = all.Email + o.Name = all.Name + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_seat_user_data_type.go b/api/datadogV2/model_seat_user_data_type.go new file mode 100644 index 00000000000..7d64a23c08d --- /dev/null +++ b/api/datadogV2/model_seat_user_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" +) + +// SeatUserDataType Seat users resource type. +type SeatUserDataType string + +// List of SeatUserDataType. +const ( + SEATUSERDATATYPE_SEAT_USERS SeatUserDataType = "seat-users" +) + +var allowedSeatUserDataTypeEnumValues = []SeatUserDataType{ + SEATUSERDATATYPE_SEAT_USERS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *SeatUserDataType) GetAllowedValues() []SeatUserDataType { + return allowedSeatUserDataTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *SeatUserDataType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = SeatUserDataType(value) + return nil +} + +// NewSeatUserDataTypeFromValue returns a pointer to a valid SeatUserDataType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewSeatUserDataTypeFromValue(v string) (*SeatUserDataType, error) { + ev := SeatUserDataType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for SeatUserDataType: valid values are %v", v, allowedSeatUserDataTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v SeatUserDataType) IsValid() bool { + for _, existing := range allowedSeatUserDataTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SeatUserDataType value. +func (v SeatUserDataType) Ptr() *SeatUserDataType { + return &v +} diff --git a/api/datadogV2/model_seat_user_meta.go b/api/datadogV2/model_seat_user_meta.go new file mode 100644 index 00000000000..3dce51140c6 --- /dev/null +++ b/api/datadogV2/model_seat_user_meta.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" +) + +// SeatUserMeta +type SeatUserMeta struct { + // The cursor for the seat users. + Cursor *string `json:"cursor,omitempty"` + // The limit for the seat users. + Limit *int64 `json:"limit,omitempty"` + // The next cursor for the seat users. + NextCursor *string `json:"next_cursor,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:"-"` +} + +// NewSeatUserMeta instantiates a new SeatUserMeta 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 NewSeatUserMeta() *SeatUserMeta { + this := SeatUserMeta{} + return &this +} + +// NewSeatUserMetaWithDefaults instantiates a new SeatUserMeta 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 NewSeatUserMetaWithDefaults() *SeatUserMeta { + this := SeatUserMeta{} + return &this +} + +// GetCursor returns the Cursor field value if set, zero value otherwise. +func (o *SeatUserMeta) GetCursor() string { + if o == nil || o.Cursor == nil { + var ret string + return ret + } + return *o.Cursor +} + +// GetCursorOk returns a tuple with the Cursor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SeatUserMeta) GetCursorOk() (*string, bool) { + if o == nil || o.Cursor == nil { + return nil, false + } + return o.Cursor, true +} + +// HasCursor returns a boolean if a field has been set. +func (o *SeatUserMeta) HasCursor() bool { + return o != nil && o.Cursor != nil +} + +// SetCursor gets a reference to the given string and assigns it to the Cursor field. +func (o *SeatUserMeta) SetCursor(v string) { + o.Cursor = &v +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *SeatUserMeta) GetLimit() int64 { + if o == nil || o.Limit == nil { + var ret int64 + return ret + } + return *o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SeatUserMeta) GetLimitOk() (*int64, bool) { + if o == nil || o.Limit == nil { + return nil, false + } + return o.Limit, true +} + +// HasLimit returns a boolean if a field has been set. +func (o *SeatUserMeta) HasLimit() bool { + return o != nil && o.Limit != nil +} + +// SetLimit gets a reference to the given int64 and assigns it to the Limit field. +func (o *SeatUserMeta) SetLimit(v int64) { + o.Limit = &v +} + +// GetNextCursor returns the NextCursor field value if set, zero value otherwise. +func (o *SeatUserMeta) GetNextCursor() string { + if o == nil || o.NextCursor == nil { + var ret string + return ret + } + return *o.NextCursor +} + +// GetNextCursorOk returns a tuple with the NextCursor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SeatUserMeta) GetNextCursorOk() (*string, bool) { + if o == nil || o.NextCursor == nil { + return nil, false + } + return o.NextCursor, true +} + +// HasNextCursor returns a boolean if a field has been set. +func (o *SeatUserMeta) HasNextCursor() bool { + return o != nil && o.NextCursor != nil +} + +// SetNextCursor gets a reference to the given string and assigns it to the NextCursor field. +func (o *SeatUserMeta) SetNextCursor(v string) { + o.NextCursor = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SeatUserMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Cursor != nil { + toSerialize["cursor"] = o.Cursor + } + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + if o.NextCursor != nil { + toSerialize["next_cursor"] = o.NextCursor + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SeatUserMeta) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Cursor *string `json:"cursor,omitempty"` + Limit *int64 `json:"limit,omitempty"` + NextCursor *string `json:"next_cursor,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{"cursor", "limit", "next_cursor"}) + } else { + return err + } + o.Cursor = all.Cursor + o.Limit = all.Limit + o.NextCursor = all.NextCursor + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_service_now_ticket_create_attributes.go b/api/datadogV2/model_service_now_ticket_create_attributes.go deleted file mode 100644 index 78d7cb6bb78..00000000000 --- a/api/datadogV2/model_service_now_ticket_create_attributes.go +++ /dev/null @@ -1,136 +0,0 @@ -// 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" -) - -// ServiceNowTicketCreateAttributes ServiceNow ticket creation attributes -type ServiceNowTicketCreateAttributes struct { - // ServiceNow assignment group - AssignmentGroup *string `json:"assignment_group,omitempty"` - // ServiceNow instance name - InstanceName string `json:"instance_name"` - // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct - UnparsedObject map[string]interface{} `json:"-"` - AdditionalProperties map[string]interface{} `json:"-"` -} - -// NewServiceNowTicketCreateAttributes instantiates a new ServiceNowTicketCreateAttributes 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 NewServiceNowTicketCreateAttributes(instanceName string) *ServiceNowTicketCreateAttributes { - this := ServiceNowTicketCreateAttributes{} - this.InstanceName = instanceName - return &this -} - -// NewServiceNowTicketCreateAttributesWithDefaults instantiates a new ServiceNowTicketCreateAttributes 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 NewServiceNowTicketCreateAttributesWithDefaults() *ServiceNowTicketCreateAttributes { - this := ServiceNowTicketCreateAttributes{} - return &this -} - -// GetAssignmentGroup returns the AssignmentGroup field value if set, zero value otherwise. -func (o *ServiceNowTicketCreateAttributes) GetAssignmentGroup() string { - if o == nil || o.AssignmentGroup == nil { - var ret string - return ret - } - return *o.AssignmentGroup -} - -// GetAssignmentGroupOk returns a tuple with the AssignmentGroup field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *ServiceNowTicketCreateAttributes) GetAssignmentGroupOk() (*string, bool) { - if o == nil || o.AssignmentGroup == nil { - return nil, false - } - return o.AssignmentGroup, true -} - -// HasAssignmentGroup returns a boolean if a field has been set. -func (o *ServiceNowTicketCreateAttributes) HasAssignmentGroup() bool { - return o != nil && o.AssignmentGroup != nil -} - -// SetAssignmentGroup gets a reference to the given string and assigns it to the AssignmentGroup field. -func (o *ServiceNowTicketCreateAttributes) SetAssignmentGroup(v string) { - o.AssignmentGroup = &v -} - -// GetInstanceName returns the InstanceName field value. -func (o *ServiceNowTicketCreateAttributes) GetInstanceName() string { - if o == nil { - var ret string - return ret - } - return o.InstanceName -} - -// GetInstanceNameOk returns a tuple with the InstanceName field value -// and a boolean to check if the value has been set. -func (o *ServiceNowTicketCreateAttributes) GetInstanceNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.InstanceName, true -} - -// SetInstanceName sets field value. -func (o *ServiceNowTicketCreateAttributes) SetInstanceName(v string) { - o.InstanceName = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ServiceNowTicketCreateAttributes) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - if o.AssignmentGroup != nil { - toSerialize["assignment_group"] = o.AssignmentGroup - } - toSerialize["instance_name"] = o.InstanceName - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ServiceNowTicketCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - AssignmentGroup *string `json:"assignment_group,omitempty"` - InstanceName *string `json:"instance_name"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.InstanceName == nil { - return fmt.Errorf("required field instance_name missing") - } - additionalProperties := make(map[string]interface{}) - if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"assignment_group", "instance_name"}) - } else { - return err - } - o.AssignmentGroup = all.AssignmentGroup - o.InstanceName = *all.InstanceName - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - return nil -} diff --git a/api/datadogV2/model_service_now_ticket_create_data.go b/api/datadogV2/model_service_now_ticket_create_data.go deleted file mode 100644 index 943556f3a7e..00000000000 --- a/api/datadogV2/model_service_now_ticket_create_data.go +++ /dev/null @@ -1,146 +0,0 @@ -// 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" -) - -// ServiceNowTicketCreateData ServiceNow ticket creation data -type ServiceNowTicketCreateData struct { - // ServiceNow ticket creation attributes - Attributes ServiceNowTicketCreateAttributes `json:"attributes"` - // ServiceNow ticket resource type - Type ServiceNowTicketResourceType `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:"-"` -} - -// NewServiceNowTicketCreateData instantiates a new ServiceNowTicketCreateData 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 NewServiceNowTicketCreateData(attributes ServiceNowTicketCreateAttributes, typeVar ServiceNowTicketResourceType) *ServiceNowTicketCreateData { - this := ServiceNowTicketCreateData{} - this.Attributes = attributes - this.Type = typeVar - return &this -} - -// NewServiceNowTicketCreateDataWithDefaults instantiates a new ServiceNowTicketCreateData 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 NewServiceNowTicketCreateDataWithDefaults() *ServiceNowTicketCreateData { - this := ServiceNowTicketCreateData{} - return &this -} - -// GetAttributes returns the Attributes field value. -func (o *ServiceNowTicketCreateData) GetAttributes() ServiceNowTicketCreateAttributes { - if o == nil { - var ret ServiceNowTicketCreateAttributes - 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 *ServiceNowTicketCreateData) GetAttributesOk() (*ServiceNowTicketCreateAttributes, bool) { - if o == nil { - return nil, false - } - return &o.Attributes, true -} - -// SetAttributes sets field value. -func (o *ServiceNowTicketCreateData) SetAttributes(v ServiceNowTicketCreateAttributes) { - o.Attributes = v -} - -// GetType returns the Type field value. -func (o *ServiceNowTicketCreateData) GetType() ServiceNowTicketResourceType { - if o == nil { - var ret ServiceNowTicketResourceType - 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 *ServiceNowTicketCreateData) GetTypeOk() (*ServiceNowTicketResourceType, bool) { - if o == nil { - return nil, false - } - return &o.Type, true -} - -// SetType sets field value. -func (o *ServiceNowTicketCreateData) SetType(v ServiceNowTicketResourceType) { - o.Type = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ServiceNowTicketCreateData) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.UnparsedObject != nil { - return datadog.Marshal(o.UnparsedObject) - } - toSerialize["attributes"] = o.Attributes - toSerialize["type"] = o.Type - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - return datadog.Marshal(toSerialize) -} - -// UnmarshalJSON deserializes the given payload. -func (o *ServiceNowTicketCreateData) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Attributes *ServiceNowTicketCreateAttributes `json:"attributes"` - Type *ServiceNowTicketResourceType `json:"type"` - }{} - if err = datadog.Unmarshal(bytes, &all); err != nil { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - if all.Attributes == nil { - return fmt.Errorf("required field attributes missing") - } - if all.Type == nil { - return fmt.Errorf("required field type missing") - } - additionalProperties := make(map[string]interface{}) - if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) - } else { - return err - } - - hasInvalidField := false - if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.Attributes = *all.Attributes - if !all.Type.IsValid() { - hasInvalidField = true - } else { - o.Type = *all.Type - } - - if len(additionalProperties) > 0 { - o.AdditionalProperties = additionalProperties - } - - if hasInvalidField { - return datadog.Unmarshal(bytes, &o.UnparsedObject) - } - - return nil -} diff --git a/api/datadogV2/model_service_now_ticket_create_request.go b/api/datadogV2/model_service_now_ticket_create_request.go deleted file mode 100644 index c9b89cb2d06..00000000000 --- a/api/datadogV2/model_service_now_ticket_create_request.go +++ /dev/null @@ -1,110 +0,0 @@ -// 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" -) - -// ServiceNowTicketCreateRequest ServiceNow ticket creation request -type ServiceNowTicketCreateRequest struct { - // ServiceNow ticket creation data - Data ServiceNowTicketCreateData `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:"-"` -} - -// NewServiceNowTicketCreateRequest instantiates a new ServiceNowTicketCreateRequest 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 NewServiceNowTicketCreateRequest(data ServiceNowTicketCreateData) *ServiceNowTicketCreateRequest { - this := ServiceNowTicketCreateRequest{} - this.Data = data - return &this -} - -// NewServiceNowTicketCreateRequestWithDefaults instantiates a new ServiceNowTicketCreateRequest 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 NewServiceNowTicketCreateRequestWithDefaults() *ServiceNowTicketCreateRequest { - this := ServiceNowTicketCreateRequest{} - return &this -} - -// GetData returns the Data field value. -func (o *ServiceNowTicketCreateRequest) GetData() ServiceNowTicketCreateData { - if o == nil { - var ret ServiceNowTicketCreateData - 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 *ServiceNowTicketCreateRequest) GetDataOk() (*ServiceNowTicketCreateData, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value. -func (o *ServiceNowTicketCreateRequest) SetData(v ServiceNowTicketCreateData) { - o.Data = v -} - -// MarshalJSON serializes the struct using spec logic. -func (o ServiceNowTicketCreateRequest) 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 *ServiceNowTicketCreateRequest) UnmarshalJSON(bytes []byte) (err error) { - all := struct { - Data *ServiceNowTicketCreateData `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_service_now_ticket_resource_type.go b/api/datadogV2/model_service_now_ticket_resource_type.go deleted file mode 100644 index 703543c0784..00000000000 --- a/api/datadogV2/model_service_now_ticket_resource_type.go +++ /dev/null @@ -1,64 +0,0 @@ -// 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" -) - -// ServiceNowTicketResourceType ServiceNow ticket resource type -type ServiceNowTicketResourceType string - -// List of ServiceNowTicketResourceType. -const ( - SERVICENOWTICKETRESOURCETYPE_TICKETS ServiceNowTicketResourceType = "tickets" -) - -var allowedServiceNowTicketResourceTypeEnumValues = []ServiceNowTicketResourceType{ - SERVICENOWTICKETRESOURCETYPE_TICKETS, -} - -// GetAllowedValues reeturns the list of possible values. -func (v *ServiceNowTicketResourceType) GetAllowedValues() []ServiceNowTicketResourceType { - return allowedServiceNowTicketResourceTypeEnumValues -} - -// UnmarshalJSON deserializes the given payload. -func (v *ServiceNowTicketResourceType) UnmarshalJSON(src []byte) error { - var value string - err := datadog.Unmarshal(src, &value) - if err != nil { - return err - } - *v = ServiceNowTicketResourceType(value) - return nil -} - -// NewServiceNowTicketResourceTypeFromValue returns a pointer to a valid ServiceNowTicketResourceType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewServiceNowTicketResourceTypeFromValue(v string) (*ServiceNowTicketResourceType, error) { - ev := ServiceNowTicketResourceType(v) - if ev.IsValid() { - return &ev, nil - } - return nil, fmt.Errorf("invalid value '%v' for ServiceNowTicketResourceType: valid values are %v", v, allowedServiceNowTicketResourceTypeEnumValues) -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v ServiceNowTicketResourceType) IsValid() bool { - for _, existing := range allowedServiceNowTicketResourceTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to ServiceNowTicketResourceType value. -func (v ServiceNowTicketResourceType) Ptr() *ServiceNowTicketResourceType { - return &v -} diff --git a/api/datadogV2/model_notebook_create_request.go b/api/datadogV2/model_unassign_seats_user_request.go similarity index 54% rename from api/datadogV2/model_notebook_create_request.go rename to api/datadogV2/model_unassign_seats_user_request.go index 19ffeb217a9..f99ac7a2c15 100644 --- a/api/datadogV2/model_notebook_create_request.go +++ b/api/datadogV2/model_unassign_seats_user_request.go @@ -5,68 +5,72 @@ package datadogV2 import ( - "fmt" - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" ) -// NotebookCreateRequest Notebook creation request -type NotebookCreateRequest struct { - // Notebook creation data - Data NotebookCreateData `json:"data"` +// UnassignSeatsUserRequest +type UnassignSeatsUserRequest struct { + // + Data *UnassignSeatsUserRequestData `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:"-"` } -// NewNotebookCreateRequest instantiates a new NotebookCreateRequest object. +// NewUnassignSeatsUserRequest instantiates a new UnassignSeatsUserRequest 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 NewNotebookCreateRequest(data NotebookCreateData) *NotebookCreateRequest { - this := NotebookCreateRequest{} - this.Data = data +func NewUnassignSeatsUserRequest() *UnassignSeatsUserRequest { + this := UnassignSeatsUserRequest{} return &this } -// NewNotebookCreateRequestWithDefaults instantiates a new NotebookCreateRequest object. +// NewUnassignSeatsUserRequestWithDefaults instantiates a new UnassignSeatsUserRequest 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 NewNotebookCreateRequestWithDefaults() *NotebookCreateRequest { - this := NotebookCreateRequest{} +func NewUnassignSeatsUserRequestWithDefaults() *UnassignSeatsUserRequest { + this := UnassignSeatsUserRequest{} return &this } -// GetData returns the Data field value. -func (o *NotebookCreateRequest) GetData() NotebookCreateData { - if o == nil { - var ret NotebookCreateData +// GetData returns the Data field value if set, zero value otherwise. +func (o *UnassignSeatsUserRequest) GetData() UnassignSeatsUserRequestData { + if o == nil || o.Data == nil { + var ret UnassignSeatsUserRequestData return ret } - return o.Data + return *o.Data } -// GetDataOk returns a tuple with the Data field value +// 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 *NotebookCreateRequest) GetDataOk() (*NotebookCreateData, bool) { - if o == nil { +func (o *UnassignSeatsUserRequest) GetDataOk() (*UnassignSeatsUserRequestData, bool) { + if o == nil || o.Data == nil { return nil, false } - return &o.Data, true + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *UnassignSeatsUserRequest) HasData() bool { + return o != nil && o.Data != nil } -// SetData sets field value. -func (o *NotebookCreateRequest) SetData(v NotebookCreateData) { - o.Data = v +// SetData gets a reference to the given UnassignSeatsUserRequestData and assigns it to the Data field. +func (o *UnassignSeatsUserRequest) SetData(v UnassignSeatsUserRequestData) { + o.Data = &v } // MarshalJSON serializes the struct using spec logic. -func (o NotebookCreateRequest) MarshalJSON() ([]byte, error) { +func (o UnassignSeatsUserRequest) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } - toSerialize["data"] = o.Data + if o.Data != nil { + toSerialize["data"] = o.Data + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -75,16 +79,13 @@ func (o NotebookCreateRequest) MarshalJSON() ([]byte, error) { } // UnmarshalJSON deserializes the given payload. -func (o *NotebookCreateRequest) UnmarshalJSON(bytes []byte) (err error) { +func (o *UnassignSeatsUserRequest) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Data *NotebookCreateData `json:"data"` + Data *UnassignSeatsUserRequestData `json:"data,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"}) @@ -93,10 +94,10 @@ func (o *NotebookCreateRequest) UnmarshalJSON(bytes []byte) (err error) { } hasInvalidField := false - if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true } - o.Data = *all.Data + o.Data = all.Data if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_unassign_seats_user_request_data.go b/api/datadogV2/model_unassign_seats_user_request_data.go new file mode 100644 index 00000000000..a1493055113 --- /dev/null +++ b/api/datadogV2/model_unassign_seats_user_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" +) + +// UnassignSeatsUserRequestData +type UnassignSeatsUserRequestData struct { + // + Attributes *UnassignSeatsUserRequestDataAttributes `json:"attributes,omitempty"` + // The ID of the unassign seats user request. + Id *string `json:"id,omitempty"` + // Seat assignments resource type. + Type SeatAssignmentsDataType `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:"-"` +} + +// NewUnassignSeatsUserRequestData instantiates a new UnassignSeatsUserRequestData 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 NewUnassignSeatsUserRequestData(typeVar SeatAssignmentsDataType) *UnassignSeatsUserRequestData { + this := UnassignSeatsUserRequestData{} + this.Type = typeVar + return &this +} + +// NewUnassignSeatsUserRequestDataWithDefaults instantiates a new UnassignSeatsUserRequestData 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 NewUnassignSeatsUserRequestDataWithDefaults() *UnassignSeatsUserRequestData { + this := UnassignSeatsUserRequestData{} + var typeVar SeatAssignmentsDataType = SEATASSIGNMENTSDATATYPE_SEAT_ASSIGNMENTS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *UnassignSeatsUserRequestData) GetAttributes() UnassignSeatsUserRequestDataAttributes { + if o == nil || o.Attributes == nil { + var ret UnassignSeatsUserRequestDataAttributes + 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 *UnassignSeatsUserRequestData) GetAttributesOk() (*UnassignSeatsUserRequestDataAttributes, 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 *UnassignSeatsUserRequestData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given UnassignSeatsUserRequestDataAttributes and assigns it to the Attributes field. +func (o *UnassignSeatsUserRequestData) SetAttributes(v UnassignSeatsUserRequestDataAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UnassignSeatsUserRequestData) 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 *UnassignSeatsUserRequestData) 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 *UnassignSeatsUserRequestData) 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 *UnassignSeatsUserRequestData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *UnassignSeatsUserRequestData) GetType() SeatAssignmentsDataType { + if o == nil { + var ret SeatAssignmentsDataType + 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 *UnassignSeatsUserRequestData) GetTypeOk() (*SeatAssignmentsDataType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *UnassignSeatsUserRequestData) SetType(v SeatAssignmentsDataType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UnassignSeatsUserRequestData) 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 + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UnassignSeatsUserRequestData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *UnassignSeatsUserRequestDataAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *SeatAssignmentsDataType `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", "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_unassign_seats_user_request_data_attributes.go b/api/datadogV2/model_unassign_seats_user_request_data_attributes.go new file mode 100644 index 00000000000..d763f8bb161 --- /dev/null +++ b/api/datadogV2/model_unassign_seats_user_request_data_attributes.go @@ -0,0 +1,133 @@ +// 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" +) + +// UnassignSeatsUserRequestDataAttributes +type UnassignSeatsUserRequestDataAttributes struct { + // The product code for which to unassign seats. + ProductCode string `json:"product_code"` + // The list of user IDs to unassign seats from. + UserUuids []string `json:"user_uuids"` + // 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:"-"` +} + +// NewUnassignSeatsUserRequestDataAttributes instantiates a new UnassignSeatsUserRequestDataAttributes 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 NewUnassignSeatsUserRequestDataAttributes(productCode string, userUuids []string) *UnassignSeatsUserRequestDataAttributes { + this := UnassignSeatsUserRequestDataAttributes{} + this.ProductCode = productCode + this.UserUuids = userUuids + return &this +} + +// NewUnassignSeatsUserRequestDataAttributesWithDefaults instantiates a new UnassignSeatsUserRequestDataAttributes 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 NewUnassignSeatsUserRequestDataAttributesWithDefaults() *UnassignSeatsUserRequestDataAttributes { + this := UnassignSeatsUserRequestDataAttributes{} + return &this +} + +// GetProductCode returns the ProductCode field value. +func (o *UnassignSeatsUserRequestDataAttributes) GetProductCode() string { + if o == nil { + var ret string + return ret + } + return o.ProductCode +} + +// GetProductCodeOk returns a tuple with the ProductCode field value +// and a boolean to check if the value has been set. +func (o *UnassignSeatsUserRequestDataAttributes) GetProductCodeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ProductCode, true +} + +// SetProductCode sets field value. +func (o *UnassignSeatsUserRequestDataAttributes) SetProductCode(v string) { + o.ProductCode = v +} + +// GetUserUuids returns the UserUuids field value. +func (o *UnassignSeatsUserRequestDataAttributes) GetUserUuids() []string { + if o == nil { + var ret []string + return ret + } + return o.UserUuids +} + +// GetUserUuidsOk returns a tuple with the UserUuids field value +// and a boolean to check if the value has been set. +func (o *UnassignSeatsUserRequestDataAttributes) GetUserUuidsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return &o.UserUuids, true +} + +// SetUserUuids sets field value. +func (o *UnassignSeatsUserRequestDataAttributes) SetUserUuids(v []string) { + o.UserUuids = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o UnassignSeatsUserRequestDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["product_code"] = o.ProductCode + toSerialize["user_uuids"] = o.UserUuids + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *UnassignSeatsUserRequestDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ProductCode *string `json:"product_code"` + UserUuids *[]string `json:"user_uuids"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ProductCode == nil { + return fmt.Errorf("required field product_code missing") + } + if all.UserUuids == nil { + return fmt.Errorf("required field user_uuids missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"product_code", "user_uuids"}) + } else { + return err + } + o.ProductCode = *all.ProductCode + o.UserUuids = *all.UserUuids + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/examples/v2/case-management/CreateCaseJiraIssue.go b/examples/v2/case-management/CreateCaseJiraIssue.go deleted file mode 100644 index c3d6afed297..00000000000 --- a/examples/v2/case-management/CreateCaseJiraIssue.go +++ /dev/null @@ -1,37 +0,0 @@ -// Create Jira issue for case returns "Accepted" response - -package main - -import ( - "context" - "fmt" - "os" - - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" - "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" -) - -func main() { - body := datadogV2.JiraIssueCreateRequest{ - Data: datadogV2.JiraIssueCreateData{ - Attributes: datadogV2.JiraIssueCreateAttributes{ - Fields: map[string]interface{}{}, - IssueTypeId: "10001", - JiraAccountId: "1234", - ProjectId: "5678", - }, - Type: datadogV2.JIRAISSUERESOURCETYPE_ISSUES, - }, - } - ctx := datadog.NewDefaultContext(context.Background()) - configuration := datadog.NewConfiguration() - configuration.SetUnstableOperationEnabled("v2.CreateCaseJiraIssue", true) - apiClient := datadog.NewAPIClient(configuration) - api := datadogV2.NewCaseManagementApi(apiClient) - r, err := api.CreateCaseJiraIssue(ctx, "case_id", body) - - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `CaseManagementApi.CreateCaseJiraIssue`: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } -} diff --git a/examples/v2/case-management/CreateCaseNotebook.go b/examples/v2/case-management/CreateCaseNotebook.go deleted file mode 100644 index ae8de7fc6bf..00000000000 --- a/examples/v2/case-management/CreateCaseNotebook.go +++ /dev/null @@ -1,31 +0,0 @@ -// Create investigation notebook for 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.NotebookCreateRequest{ - Data: datadogV2.NotebookCreateData{ - Type: datadogV2.NOTEBOOKRESOURCETYPE_NOTEBOOK, - }, - } - ctx := datadog.NewDefaultContext(context.Background()) - configuration := datadog.NewConfiguration() - configuration.SetUnstableOperationEnabled("v2.CreateCaseNotebook", true) - apiClient := datadog.NewAPIClient(configuration) - api := datadogV2.NewCaseManagementApi(apiClient) - r, err := api.CreateCaseNotebook(ctx, "case_id", body) - - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `CaseManagementApi.CreateCaseNotebook`: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } -} diff --git a/examples/v2/case-management/CreateCaseServiceNowTicket.go b/examples/v2/case-management/CreateCaseServiceNowTicket.go deleted file mode 100644 index 6b3ccc651a8..00000000000 --- a/examples/v2/case-management/CreateCaseServiceNowTicket.go +++ /dev/null @@ -1,35 +0,0 @@ -// Create ServiceNow ticket for case returns "Accepted" response - -package main - -import ( - "context" - "fmt" - "os" - - "github.com/DataDog/datadog-api-client-go/v2/api/datadog" - "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" -) - -func main() { - body := datadogV2.ServiceNowTicketCreateRequest{ - Data: datadogV2.ServiceNowTicketCreateData{ - Attributes: datadogV2.ServiceNowTicketCreateAttributes{ - AssignmentGroup: datadog.PtrString("IT Support"), - InstanceName: "my-instance", - }, - Type: datadogV2.SERVICENOWTICKETRESOURCETYPE_TICKETS, - }, - } - ctx := datadog.NewDefaultContext(context.Background()) - configuration := datadog.NewConfiguration() - configuration.SetUnstableOperationEnabled("v2.CreateCaseServiceNowTicket", true) - apiClient := datadog.NewAPIClient(configuration) - api := datadogV2.NewCaseManagementApi(apiClient) - r, err := api.CreateCaseServiceNowTicket(ctx, "case_id", body) - - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `CaseManagementApi.CreateCaseServiceNowTicket`: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } -} diff --git a/examples/v2/case-management/LinkIncident.go b/examples/v2/case-management/LinkIncident.go deleted file mode 100644 index f128e21dcdf..00000000000 --- a/examples/v2/case-management/LinkIncident.go +++ /dev/null @@ -1,36 +0,0 @@ -// Link incident to case 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.RelationshipToIncidentRequest{ - Data: datadogV2.IncidentRelationshipData{ - Id: "00000000-0000-0000-0000-000000000000", - Type: datadogV2.INCIDENTRESOURCETYPE_INCIDENTS, - }, - } - ctx := datadog.NewDefaultContext(context.Background()) - configuration := datadog.NewConfiguration() - configuration.SetUnstableOperationEnabled("v2.LinkIncident", true) - apiClient := datadog.NewAPIClient(configuration) - api := datadogV2.NewCaseManagementApi(apiClient) - resp, r, err := api.LinkIncident(ctx, "case_id", body) - - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `CaseManagementApi.LinkIncident`: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - - responseContent, _ := json.MarshalIndent(resp, "", " ") - fmt.Fprintf(os.Stdout, "Response from `CaseManagementApi.LinkIncident`:\n%s\n", responseContent) -} diff --git a/examples/v2/case-management/LinkJiraIssueToCase.go b/examples/v2/case-management/LinkJiraIssueToCase.go deleted file mode 100644 index b9ca8414843..00000000000 --- a/examples/v2/case-management/LinkJiraIssueToCase.go +++ /dev/null @@ -1,34 +0,0 @@ -// Link existing Jira issue to 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.JiraIssueLinkRequest{ - Data: datadogV2.JiraIssueLinkData{ - Attributes: datadogV2.JiraIssueLinkAttributes{ - JiraIssueUrl: "https://jira.example.com/browse/PROJ-123", - }, - Type: datadogV2.JIRAISSUERESOURCETYPE_ISSUES, - }, - } - ctx := datadog.NewDefaultContext(context.Background()) - configuration := datadog.NewConfiguration() - configuration.SetUnstableOperationEnabled("v2.LinkJiraIssueToCase", true) - apiClient := datadog.NewAPIClient(configuration) - api := datadogV2.NewCaseManagementApi(apiClient) - r, err := api.LinkJiraIssueToCase(ctx, "case_id", body) - - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `CaseManagementApi.LinkJiraIssueToCase`: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } -} diff --git a/examples/v2/case-management/MoveCaseToProject.go b/examples/v2/case-management/MoveCaseToProject.go deleted file mode 100644 index 835a44a9728..00000000000 --- a/examples/v2/case-management/MoveCaseToProject.go +++ /dev/null @@ -1,36 +0,0 @@ -// Update case project 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.ProjectRelationship{ - Data: datadogV2.ProjectRelationshipData{ - Id: "e555e290-ed65-49bd-ae18-8acbfcf18db7", - Type: datadogV2.PROJECTRESOURCETYPE_PROJECT, - }, - } - ctx := datadog.NewDefaultContext(context.Background()) - configuration := datadog.NewConfiguration() - configuration.SetUnstableOperationEnabled("v2.MoveCaseToProject", true) - apiClient := datadog.NewAPIClient(configuration) - api := datadogV2.NewCaseManagementApi(apiClient) - resp, r, err := api.MoveCaseToProject(ctx, "case_id", body) - - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `CaseManagementApi.MoveCaseToProject`: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - - responseContent, _ := json.MarshalIndent(resp, "", " ") - fmt.Fprintf(os.Stdout, "Response from `CaseManagementApi.MoveCaseToProject`:\n%s\n", responseContent) -} diff --git a/examples/v2/case-management/UnlinkJiraIssue.go b/examples/v2/case-management/UnlinkJiraIssue.go deleted file mode 100644 index 1c324fee87c..00000000000 --- a/examples/v2/case-management/UnlinkJiraIssue.go +++ /dev/null @@ -1,26 +0,0 @@ -// Remove Jira issue link from 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() { - ctx := datadog.NewDefaultContext(context.Background()) - configuration := datadog.NewConfiguration() - configuration.SetUnstableOperationEnabled("v2.UnlinkJiraIssue", true) - apiClient := datadog.NewAPIClient(configuration) - api := datadogV2.NewCaseManagementApi(apiClient) - r, err := api.UnlinkJiraIssue(ctx, "case_id") - - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `CaseManagementApi.UnlinkJiraIssue`: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } -} diff --git a/examples/v2/seats/AssignSeatsUserV2.go b/examples/v2/seats/AssignSeatsUserV2.go new file mode 100644 index 00000000000..6e0da6776aa --- /dev/null +++ b/examples/v2/seats/AssignSeatsUserV2.go @@ -0,0 +1,40 @@ +// Assign seats to users 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.AssignSeatsUserRequest{ + Data: &datadogV2.AssignSeatsUserRequestData{ + Attributes: &datadogV2.AssignSeatsUserRequestDataAttributes{ + ProductCode: "", + UserUuids: []string{ + "", + }, + }, + Type: datadogV2.SEATASSIGNMENTSDATATYPE_SEAT_ASSIGNMENTS, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSeatsApi(apiClient) + resp, r, err := api.AssignSeatsUserV2(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SeatsApi.AssignSeatsUserV2`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SeatsApi.AssignSeatsUserV2`:\n%s\n", responseContent) +} diff --git a/examples/v2/seats/GetSeatsUsersV2.go b/examples/v2/seats/GetSeatsUsersV2.go new file mode 100644 index 00000000000..366955de8b9 --- /dev/null +++ b/examples/v2/seats/GetSeatsUsersV2.go @@ -0,0 +1,29 @@ +// Get seats users returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSeatsApi(apiClient) + resp, r, err := api.GetSeatsUsersV2(ctx, "product_code", *datadogV2.NewGetSeatsUsersV2OptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SeatsApi.GetSeatsUsersV2`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SeatsApi.GetSeatsUsersV2`:\n%s\n", responseContent) +} diff --git a/examples/v2/seats/UnassignSeatsUserV2.go b/examples/v2/seats/UnassignSeatsUserV2.go new file mode 100644 index 00000000000..9569281c1b6 --- /dev/null +++ b/examples/v2/seats/UnassignSeatsUserV2.go @@ -0,0 +1,36 @@ +// Unassign seats from users 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.UnassignSeatsUserRequest{ + Data: &datadogV2.UnassignSeatsUserRequestData{ + Attributes: &datadogV2.UnassignSeatsUserRequestDataAttributes{ + ProductCode: "", + UserUuids: []string{ + "", + }, + }, + Type: datadogV2.SEATASSIGNMENTSDATATYPE_SEAT_ASSIGNMENTS, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSeatsApi(apiClient) + r, err := api.UnassignSeatsUserV2(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SeatsApi.UnassignSeatsUserV2`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index 2d25e86d1e9..300fd6f9b0d 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -124,6 +124,7 @@ var apiMappings = map[string]map[string]reflect.Value{ "RumReplaySessionsApi": reflect.ValueOf(datadogV2.NewRumReplaySessionsApi), "RumReplayViewershipApi": reflect.ValueOf(datadogV2.NewRumReplayViewershipApi), "ServiceScorecardsApi": reflect.ValueOf(datadogV2.NewServiceScorecardsApi), + "SeatsApi": reflect.ValueOf(datadogV2.NewSeatsApi), "EntityRiskScoresApi": reflect.ValueOf(datadogV2.NewEntityRiskScoresApi), "SensitiveDataScannerApi": reflect.ValueOf(datadogV2.NewSensitiveDataScannerApi), "ServiceAccountsApi": reflect.ValueOf(datadogV2.NewServiceAccountsApi), diff --git a/tests/scenarios/features/v2/case_management.feature b/tests/scenarios/features/v2/case_management.feature index 56d8f9ed68e..7e26a5815f2 100644 --- a/tests/scenarios/features/v2/case_management.feature +++ b/tests/scenarios/features/v2/case_management.feature @@ -90,60 +90,6 @@ Feature: Case Management When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/case-management - Scenario: Create Jira issue for case returns "Accepted" response - Given operation "CreateCaseJiraIssue" enabled - And new "CreateCaseJiraIssue" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"fields": {}, "issue_type_id": "10001", "jira_account_id": "1234", "project_id": "5678"}, "type": "issues"}} - When the request is sent - Then the response status is 202 Accepted - - @generated @skip @team:DataDog/case-management - Scenario: Create Jira issue for case returns "Bad Request" response - Given operation "CreateCaseJiraIssue" enabled - And new "CreateCaseJiraIssue" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"fields": {}, "issue_type_id": "10001", "jira_account_id": "1234", "project_id": "5678"}, "type": "issues"}} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/case-management - Scenario: Create Jira issue for case returns "Not Found" response - Given operation "CreateCaseJiraIssue" enabled - And new "CreateCaseJiraIssue" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"fields": {}, "issue_type_id": "10001", "jira_account_id": "1234", "project_id": "5678"}, "type": "issues"}} - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/case-management - Scenario: Create ServiceNow ticket for case returns "Accepted" response - Given operation "CreateCaseServiceNowTicket" enabled - And new "CreateCaseServiceNowTicket" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"assignment_group": "IT Support", "instance_name": "my-instance"}, "type": "tickets"}} - When the request is sent - Then the response status is 202 Accepted - - @generated @skip @team:DataDog/case-management - Scenario: Create ServiceNow ticket for case returns "Bad Request" response - Given operation "CreateCaseServiceNowTicket" enabled - And new "CreateCaseServiceNowTicket" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"assignment_group": "IT Support", "instance_name": "my-instance"}, "type": "tickets"}} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/case-management - Scenario: Create ServiceNow ticket for case returns "Not Found" response - Given operation "CreateCaseServiceNowTicket" enabled - And new "CreateCaseServiceNowTicket" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"assignment_group": "IT Support", "instance_name": "my-instance"}, "type": "tickets"}} - When the request is sent - Then the response status is 404 Not Found - @team:DataDog/case-management Scenario: Create a case returns "Bad Request" response Given new "CreateCase" request @@ -215,33 +161,6 @@ Feature: Case Management When the request is sent Then the response status is 404 Not Found - @generated @skip @team:DataDog/case-management - Scenario: Create investigation notebook for case returns "Bad Request" response - Given operation "CreateCaseNotebook" enabled - And new "CreateCaseNotebook" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"type": "notebook"}} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/case-management - Scenario: Create investigation notebook for case returns "No Content" response - Given operation "CreateCaseNotebook" enabled - And new "CreateCaseNotebook" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"type": "notebook"}} - When the request is sent - Then the response status is 204 No Content - - @generated @skip @team:DataDog/case-management - Scenario: Create investigation notebook for case returns "Not Found" response - Given operation "CreateCaseNotebook" enabled - And new "CreateCaseNotebook" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"type": "notebook"}} - When the request is sent - Then the response status is 404 Not Found - @generated @skip @team:DataDog/case-management Scenario: Delete a notification rule returns "API error response" response Given new "DeleteProjectNotificationRule" request @@ -389,93 +308,6 @@ Feature: Case Management When the request is sent Then the response status is 200 OK - @generated @skip @team:DataDog/case-management - Scenario: Link existing Jira issue to case returns "Bad Request" response - Given operation "LinkJiraIssueToCase" enabled - And new "LinkJiraIssueToCase" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"jira_issue_url": "https://jira.example.com/browse/PROJ-123"}, "type": "issues"}} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/case-management - Scenario: Link existing Jira issue to case returns "Conflict" response - Given operation "LinkJiraIssueToCase" enabled - And new "LinkJiraIssueToCase" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"jira_issue_url": "https://jira.example.com/browse/PROJ-123"}, "type": "issues"}} - When the request is sent - Then the response status is 409 Conflict - - @generated @skip @team:DataDog/case-management - Scenario: Link existing Jira issue to case returns "No Content" response - Given operation "LinkJiraIssueToCase" enabled - And new "LinkJiraIssueToCase" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"jira_issue_url": "https://jira.example.com/browse/PROJ-123"}, "type": "issues"}} - When the request is sent - Then the response status is 204 No Content - - @generated @skip @team:DataDog/case-management - Scenario: Link existing Jira issue to case returns "Not Found" response - Given operation "LinkJiraIssueToCase" enabled - And new "LinkJiraIssueToCase" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"jira_issue_url": "https://jira.example.com/browse/PROJ-123"}, "type": "issues"}} - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/case-management - Scenario: Link incident to case returns "Bad Request" response - Given operation "LinkIncident" enabled - And new "LinkIncident" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incidents"}} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/case-management - Scenario: Link incident to case returns "Created" response - Given operation "LinkIncident" enabled - And new "LinkIncident" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incidents"}} - When the request is sent - Then the response status is 201 Created - - @generated @skip @team:DataDog/case-management - Scenario: Link incident to case returns "Not Found" response - Given operation "LinkIncident" enabled - And new "LinkIncident" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incidents"}} - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/case-management - Scenario: Remove Jira issue link from case returns "Bad Request" response - Given operation "UnlinkJiraIssue" enabled - And new "UnlinkJiraIssue" request - And request contains "case_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/case-management - Scenario: Remove Jira issue link from case returns "No Content" response - Given operation "UnlinkJiraIssue" enabled - And new "UnlinkJiraIssue" request - And request contains "case_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 204 No Content - - @generated @skip @team:DataDog/case-management - Scenario: Remove Jira issue link from case returns "Not Found" response - Given operation "UnlinkJiraIssue" enabled - And new "UnlinkJiraIssue" request - And request contains "case_id" parameter from "REPLACE.ME" - When the request is sent - Then the response status is 404 Not Found - @generated @skip @team:DataDog/case-management Scenario: Remove a project returns "API error response" response Given new "DeleteProject" request @@ -732,33 +564,6 @@ Feature: Case Management Then the response status is 200 OK And the response "data.attributes.priority" is equal to "P3" - @generated @skip @team:DataDog/case-management - Scenario: Update case project returns "Bad Request" response - Given operation "MoveCaseToProject" enabled - And new "MoveCaseToProject" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"id": "e555e290-ed65-49bd-ae18-8acbfcf18db7", "type": "project"}} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/case-management - Scenario: Update case project returns "Not Found" response - Given operation "MoveCaseToProject" enabled - And new "MoveCaseToProject" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"id": "e555e290-ed65-49bd-ae18-8acbfcf18db7", "type": "project"}} - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/case-management - Scenario: Update case project returns "OK" response - Given operation "MoveCaseToProject" enabled - And new "MoveCaseToProject" request - And request contains "case_id" parameter from "REPLACE.ME" - And body with value {"data": {"id": "e555e290-ed65-49bd-ae18-8acbfcf18db7", "type": "project"}} - When the request is sent - Then the response status is 200 OK - @team:DataDog/case-management Scenario: Update case status returns "Bad Request" response Given new "UpdateStatus" request diff --git a/tests/scenarios/features/v2/seats.feature b/tests/scenarios/features/v2/seats.feature new file mode 100644 index 00000000000..e3a5205c3cc --- /dev/null +++ b/tests/scenarios/features/v2/seats.feature @@ -0,0 +1,72 @@ +@endpoint(seats) @endpoint(seats-v2) +Feature: Seats + The seats API allows you to view, assign, and unassign seats for your + organization. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Seats" API + + @generated @skip @team:DataDog/billing-experience + Scenario: Assign seats to users returns "Bad Request" response + Given new "AssignSeatsUserV2" request + And body with value {"data": {"attributes": {"product_code": "", "user_uuids": [""]}, "type": "seat-assignments"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/billing-experience + Scenario: Assign seats to users returns "Created" response + Given new "AssignSeatsUserV2" request + And body with value {"data": {"attributes": {"product_code": "", "user_uuids": [""]}, "type": "seat-assignments"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/billing-experience + Scenario: Assign seats to users returns "Unprocessable Entity" response + Given new "AssignSeatsUserV2" request + And body with value {"data": {"attributes": {"product_code": "", "user_uuids": [""]}, "type": "seat-assignments"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + + @generated @skip @team:DataDog/billing-experience + Scenario: Get seats users returns "Bad Request" response + Given new "GetSeatsUsersV2" request + And request contains "product_code" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/billing-experience + Scenario: Get seats users returns "OK" response + Given new "GetSeatsUsersV2" request + And request contains "product_code" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/billing-experience + Scenario: Get seats users returns "Unprocessable Entity" response + Given new "GetSeatsUsersV2" request + And request contains "product_code" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 422 Unprocessable Entity + + @generated @skip @team:DataDog/billing-experience + Scenario: Unassign seats from users returns "Bad Request" response + Given new "UnassignSeatsUserV2" request + And body with value {"data": {"attributes": {"product_code": "", "user_uuids": [""]}, "type": "seat-assignments"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/billing-experience + Scenario: Unassign seats from users returns "No Content" response + Given new "UnassignSeatsUserV2" request + And body with value {"data": {"attributes": {"product_code": "", "user_uuids": [""]}, "type": "seat-assignments"}} + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/billing-experience + Scenario: Unassign seats from users returns "Unprocessable Entity" response + Given new "UnassignSeatsUserV2" request + And body with value {"data": {"attributes": {"product_code": "", "user_uuids": [""]}, "type": "seat-assignments"}} + When the request is sent + Then the response status is 422 Unprocessable Entity diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 5727d36b956..5f24936509b 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -836,56 +836,6 @@ "type": "idempotent" } }, - "LinkIncident": { - "tag": "Case Management", - "undo": { - "operationId": "TODO", - "parameters": [], - "type": "unsafe" - } - }, - "UnlinkJiraIssue": { - "tag": "Case Management", - "undo": { - "type": "idempotent" - } - }, - "LinkJiraIssueToCase": { - "tag": "Case Management", - "undo": { - "type": "idempotent" - } - }, - "CreateCaseJiraIssue": { - "tag": "Case Management", - "undo": { - "operationId": "TODO", - "parameters": [], - "type": "unsafe" - } - }, - "CreateCaseNotebook": { - "tag": "Case Management", - "undo": { - "operationId": "TODO", - "parameters": [], - "type": "unsafe" - } - }, - "MoveCaseToProject": { - "tag": "Case Management", - "undo": { - "type": "idempotent" - } - }, - "CreateCaseServiceNowTicket": { - "tag": "Case Management", - "undo": { - "operationId": "TODO", - "parameters": [], - "type": "unsafe" - } - }, "UpdateStatus": { "tag": "Case Management", "undo": { @@ -4274,6 +4224,31 @@ "type": "idempotent" } }, + "UnassignSeatsUserV2": { + "tag": "Seats", + "undo": { + "type": "idempotent" + } + }, + "GetSeatsUsersV2": { + "tag": "Seats", + "undo": { + "type": "safe" + } + }, + "AssignSeatsUserV2": { + "tag": "Seats", + "undo": { + "operationId": "UnassignSeatsUserV2", + "parameters": [ + { + "name": "body", + "template": "{\"data\": {\"type\": \"seat-assignments\", \"attributes\": {\"product_code\": \"{{ data.attributes.product_code }}\", \"user_uuids\": {{ data.attributes.assigned_ids }}}}}" + } + ], + "type": "unsafe" + } + }, "ListEntityRiskScores": { "tag": "Entity Risk Scores", "undo": {