diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index a484bec1a76..22aa66aee70 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -264,6 +264,22 @@ components: required: true schema: type: string + ChangeRequestDecisionIDPathParameter: + description: The identifier of the change request decision. + example: decision-id-0 + in: path + name: decision_id + required: true + schema: + type: string + ChangeRequestIDPathParameter: + description: The identifier of the change request. + example: CHM-1234 + in: path + name: change_request_id + required: true + schema: + type: string CloudAccountID: description: Cloud Account id. in: path @@ -10567,6 +10583,626 @@ components: required: - changeEventTrigger type: object + ChangeRequestBranchCreateAttributes: + description: Attributes for creating a change request branch. + properties: + branch_name: + description: The name of the branch to create. + example: chm/CHM-1234 + type: string + repo_id: + description: The repository identifier in the format owner/repository. + example: DataDog/dd-source + type: string + required: + - repo_id + - branch_name + type: object + ChangeRequestBranchCreateData: + description: Data object to create a change request branch. + properties: + attributes: + $ref: '#/components/schemas/ChangeRequestBranchCreateAttributes' + type: + $ref: '#/components/schemas/ChangeRequestBranchResourceType' + required: + - type + - attributes + type: object + ChangeRequestBranchCreateRequest: + description: Request object to create a branch for a change request. + properties: + data: + $ref: '#/components/schemas/ChangeRequestBranchCreateData' + required: + - data + type: object + ChangeRequestBranchResourceType: + description: Change request branch resource type. + enum: + - change_request_branch + example: change_request_branch + type: string + x-enum-varnames: + - CHANGE_REQUEST_BRANCH + ChangeRequestChangeType: + description: The type of the change request. + enum: + - NORMAL + - STANDARD + - EMERGENCY + example: NORMAL + type: string + x-enum-varnames: + - NORMAL + - STANDARD + - EMERGENCY + ChangeRequestCreateAttributes: + description: Attributes for creating a change request. + properties: + change_request_linked_incident_uuid: + description: The UUID of an incident to link to the change request. + example: 00000000-0000-0000-0000-000000000000 + type: string + change_request_maintenance_window_query: + description: The maintenance window query for the change request. + example: '' + type: string + change_request_plan: + description: The plan associated with the change request. + example: 1. Deploy to staging 2. Run tests 3. Deploy to production + type: string + change_request_risk: + $ref: '#/components/schemas/ChangeRequestRiskLevel' + change_request_type: + $ref: '#/components/schemas/ChangeRequestChangeType' + description: + description: The description of the change request. + example: Deploying new payment service v2.1 + type: string + end_date: + description: The planned end date of the change request. + example: '2024-01-02T15:00:00Z' + format: date-time + type: string + project_id: + description: The project UUID to associate with the change request. + example: d4bbe1af-f36e-42f1-87c1-493ca35c320e + type: string + requested_teams: + description: A list of team handles to request decisions from. + example: + - team-handle-1 + items: + type: string + type: array + start_date: + description: The planned start date of the change request. + example: '2024-01-01T03:00:00Z' + format: date-time + type: string + title: + description: The title of the change request. + example: Deploy new payment service + type: string + required: + - title + type: object + ChangeRequestCreateData: + description: Data object to create a change request. + properties: + attributes: + $ref: '#/components/schemas/ChangeRequestCreateAttributes' + type: + $ref: '#/components/schemas/ChangeRequestResourceType' + required: + - type + - attributes + type: object + ChangeRequestCreateRequest: + description: Request object to create a change request. + properties: + data: + $ref: '#/components/schemas/ChangeRequestCreateData' + required: + - data + type: object + ChangeRequestDecisionCreateAttributes: + description: Attributes for creating a change request decision. + properties: + change_request_status: + $ref: '#/components/schemas/ChangeRequestDecisionStatusType' + request_reason: + description: The reason for requesting the decision. + example: Please review and approve this change + type: string + type: object + ChangeRequestDecisionCreateItem: + description: An included change request decision for a create or update operation. + properties: + attributes: + $ref: '#/components/schemas/ChangeRequestDecisionCreateAttributes' + id: + description: The decision identifier. + example: decision-id-0 + type: string + relationships: + $ref: '#/components/schemas/ChangeRequestDecisionCreateRelationships' + type: + $ref: '#/components/schemas/ChangeRequestDecisionResourceType' + required: + - type + - id + type: object + ChangeRequestDecisionCreateRelationships: + description: Relationships for creating a change request decision. + properties: + requested_user: + $ref: '#/components/schemas/ChangeRequestUserRelationship' + type: object + ChangeRequestDecisionRelationshipData: + description: Change request decision relationship data. + properties: + id: + description: The decision UUID. + example: decision-id-0 + type: string + type: + $ref: '#/components/schemas/ChangeRequestDecisionResourceType' + required: + - id + - type + type: object + ChangeRequestDecisionRelationships: + description: Relationships of a change request decision. + properties: + modified_by: + $ref: '#/components/schemas/ChangeRequestUserRelationship' + requested_by_user: + $ref: '#/components/schemas/ChangeRequestUserRelationship' + requested_user: + $ref: '#/components/schemas/ChangeRequestUserRelationship' + required: + - requested_user + - requested_by_user + - modified_by + type: object + ChangeRequestDecisionResourceType: + description: Change request decision resource type. + enum: + - change_request_decision + example: change_request_decision + type: string + x-enum-varnames: + - CHANGE_REQUEST_DECISION + ChangeRequestDecisionResponseAttributes: + description: Attributes of a change request decision in a response. + properties: + change_request_status: + $ref: '#/components/schemas/ChangeRequestDecisionStatusType' + decided_at: + description: Timestamp of when the decision was made. + example: '2024-01-02T00:00:00Z' + format: date-time + type: string + decision_reason: + description: The reason for the decision. + example: LGTM + type: string + deleted_at: + description: Timestamp of when the decision was deleted. + example: '0001-01-01T00:00:00Z' + format: date-time + type: string + request_reason: + description: The reason for requesting the decision. + example: Please review this change + type: string + requested_at: + description: Timestamp of when the decision was requested. + example: '2024-01-01T00:00:00Z' + format: date-time + type: string + required: + - change_request_status + - request_reason + - decision_reason + - requested_at + - decided_at + - deleted_at + type: object + ChangeRequestDecisionStatusType: + description: The status of a change request decision. + enum: + - REQUESTED + - APPROVED + - DECLINED + example: REQUESTED + type: string + x-enum-varnames: + - REQUESTED + - APPROVED + - DECLINED + ChangeRequestDecisionUpdateData: + description: Data object to update a change request decision. + properties: + attributes: + $ref: '#/components/schemas/ChangeRequestDecisionUpdateDataAttributes' + relationships: + $ref: '#/components/schemas/ChangeRequestDecisionUpdateDataRelationships' + type: + $ref: '#/components/schemas/ChangeRequestResourceType' + required: + - type + type: object + ChangeRequestDecisionUpdateDataAttributes: + description: Attributes of the parent change request for a decision update. + properties: + id: + description: The identifier of the change request. + example: CHM-1234 + type: string + type: object + ChangeRequestDecisionUpdateDataRelationships: + description: Relationships for updating a change request decision. + properties: + change_request_decisions: + $ref: '#/components/schemas/ChangeRequestDecisionsRelationship' + required: + - change_request_decisions + type: object + ChangeRequestDecisionUpdateRequest: + description: Request object to update a change request decision. + properties: + data: + $ref: '#/components/schemas/ChangeRequestDecisionUpdateData' + included: + $ref: '#/components/schemas/ChangeRequestUpdateIncluded' + required: + - data + type: object + ChangeRequestDecisionsRelationship: + description: Relationship to change request decisions. + properties: + data: + description: Array of decision relationship data. + items: + $ref: '#/components/schemas/ChangeRequestDecisionRelationshipData' + type: array + required: + - data + type: object + ChangeRequestIncluded: + description: Included resources related to the change request. + items: + $ref: '#/components/schemas/ChangeRequestIncludedItem' + type: array + ChangeRequestIncludedDecision: + description: An included change request decision resource. + properties: + attributes: + $ref: '#/components/schemas/ChangeRequestDecisionResponseAttributes' + id: + description: The decision UUID. + example: decision-id-0 + type: string + relationships: + $ref: '#/components/schemas/ChangeRequestDecisionRelationships' + type: + $ref: '#/components/schemas/ChangeRequestDecisionResourceType' + required: + - type + - id + - attributes + type: object + ChangeRequestIncludedItem: + description: An included resource item in the change request response. + oneOf: + - $ref: '#/components/schemas/ChangeRequestIncludedUser' + - $ref: '#/components/schemas/ChangeRequestIncludedDecision' + ChangeRequestIncludedUser: + description: An included user resource. + properties: + attributes: + $ref: '#/components/schemas/ChangeRequestIncludedUserAttributes' + id: + description: The user UUID. + example: 00000000-0000-0000-0000-000000000000 + type: string + type: + description: The resource type. + example: user + type: string + required: + - type + - id + - attributes + type: object + ChangeRequestIncludedUserAttributes: + description: Attributes of an included user. + properties: + email: + description: The email of the user. + example: john.doe@example.com + type: string + handle: + description: The handle of the user. + example: john.doe@example.com + type: string + name: + description: The name of the user. + example: John Doe + type: string + required: + - name + - email + - handle + type: object + ChangeRequestObjectAttributes: + additionalProperties: + items: + type: string + type: array + description: Custom attributes of the change request as key-value pairs. + type: object + ChangeRequestRelationships: + description: Relationships of a change request. + properties: + change_request_decisions: + $ref: '#/components/schemas/ChangeRequestDecisionsRelationship' + created_by: + $ref: '#/components/schemas/ChangeRequestUserRelationship' + modified_by: + $ref: '#/components/schemas/ChangeRequestUserRelationship' + required: + - created_by + - modified_by + - change_request_decisions + type: object + ChangeRequestResourceType: + description: Change request resource type. + enum: + - change_request + example: change_request + type: string + x-enum-varnames: + - CHANGE_REQUEST + ChangeRequestResponse: + description: Response object for a change request. + properties: + data: + $ref: '#/components/schemas/ChangeRequestResponseData' + included: + $ref: '#/components/schemas/ChangeRequestIncluded' + required: + - data + type: object + ChangeRequestResponseAttributes: + description: Attributes of a change request response. + properties: + archived_at: + description: Timestamp of when the change request was archived. + format: date-time + nullable: true + readOnly: true + type: string + attributes: + $ref: '#/components/schemas/ChangeRequestObjectAttributes' + change_request_linked_incident_uuid: + description: The UUID of the linked incident. + example: '' + type: string + change_request_maintenance_window_query: + description: The maintenance window query for the change request. + example: '' + type: string + change_request_plan: + description: The plan associated with the change request. + example: '' + type: string + change_request_risk: + $ref: '#/components/schemas/ChangeRequestRiskLevel' + change_request_type: + $ref: '#/components/schemas/ChangeRequestChangeType' + closed_at: + description: Timestamp of when the change request was closed. + format: date-time + nullable: true + readOnly: true + type: string + created_at: + description: Timestamp of when the change request was created. + example: '2024-01-01T00:00:00Z' + format: date-time + readOnly: true + type: string + creation_source: + description: The source from which the change request was created. + example: CS_MANUAL + type: string + description: + description: The description of the change request. + example: Deploying new payment service v2.1 + type: string + end_date: + description: The planned end date of the change request. + example: '2024-01-02T15:00:00Z' + format: date-time + type: string + key: + description: The human-readable key of the change request. + example: CHM-1234 + type: string + modified_at: + description: Timestamp of when the change request was last modified. + example: '2024-01-01T00:00:00Z' + format: date-time + readOnly: true + type: string + plan_notebook_id: + description: The notebook ID associated with the change request plan. + example: 0 + format: int64 + type: integer + priority: + description: The priority of the change request. + example: NOT_DEFINED + type: string + project_id: + description: The project UUID associated with the change request. + example: d4bbe1af-f36e-42f1-87c1-493ca35c320e + type: string + start_date: + description: The planned start date of the change request. + example: '2024-01-01T03:00:00Z' + format: date-time + type: string + status: + description: The current status of the change request. + example: OPEN + type: string + title: + description: The title of the change request. + example: Deploy new payment service + type: string + type: + description: The case type. + example: CHANGE_REQUEST + type: string + required: + - key + - title + - type + - priority + - status + - description + - creation_source + - plan_notebook_id + - project_id + - attributes + - created_at + - modified_at + - change_request_type + - change_request_risk + - change_request_plan + - change_request_linked_incident_uuid + - change_request_maintenance_window_query + type: object + ChangeRequestResponseData: + description: Data object for a change request response. + properties: + attributes: + $ref: '#/components/schemas/ChangeRequestResponseAttributes' + id: + description: The identifier of the change request. + example: CHM-1234 + type: string + relationships: + $ref: '#/components/schemas/ChangeRequestRelationships' + type: + $ref: '#/components/schemas/ChangeRequestResourceType' + required: + - id + - type + - attributes + type: object + ChangeRequestRiskLevel: + description: The risk level of the change request. + enum: + - UNDEFINED + - LOW + - MEDIUM + - HIGH + example: LOW + type: string + x-enum-varnames: + - UNDEFINED + - LOW + - MEDIUM + - HIGH + ChangeRequestUpdateAttributes: + description: Attributes for updating a change request. + properties: + change_request_plan: + description: The plan associated with the change request. + example: Updated deployment plan + type: string + change_request_risk: + $ref: '#/components/schemas/ChangeRequestRiskLevel' + change_request_type: + $ref: '#/components/schemas/ChangeRequestChangeType' + end_date: + description: The planned end date of the change request. + example: '2024-01-02T15:00:00Z' + format: date-time + type: string + id: + description: The identifier of the change request to update. + example: CHM-1234 + type: string + start_date: + description: The planned start date of the change request. + example: '2024-01-01T03:00:00Z' + format: date-time + type: string + type: object + ChangeRequestUpdateData: + description: Data object to update a change request. + properties: + attributes: + $ref: '#/components/schemas/ChangeRequestUpdateAttributes' + relationships: + $ref: '#/components/schemas/ChangeRequestUpdateRelationships' + type: + $ref: '#/components/schemas/ChangeRequestResourceType' + required: + - type + type: object + ChangeRequestUpdateIncluded: + description: Included resources for the change request update. + items: + $ref: '#/components/schemas/ChangeRequestDecisionCreateItem' + type: array + ChangeRequestUpdateRelationships: + description: Relationships for updating a change request. + properties: + change_request_decisions: + $ref: '#/components/schemas/ChangeRequestDecisionsRelationship' + type: object + ChangeRequestUpdateRequest: + description: Request object to update a change request. + properties: + data: + $ref: '#/components/schemas/ChangeRequestUpdateData' + included: + $ref: '#/components/schemas/ChangeRequestUpdateIncluded' + required: + - data + type: object + ChangeRequestUserRelationship: + description: Relationship to a user. + properties: + data: + $ref: '#/components/schemas/ChangeRequestUserRelationshipData' + required: + - data + type: object + ChangeRequestUserRelationshipData: + description: User relationship data. + nullable: true + properties: + id: + description: The user UUID. + example: 00000000-0000-0000-0000-000000000000 + type: string + type: + description: The user resource type. + example: user + type: string + required: + - id + - type + type: object ChargebackBreakdown: description: Charges breakdown. properties: @@ -74763,6 +75399,267 @@ paths: limitParam: page[limit] pageOffsetParam: page[offset] resultsPath: data + /api/v2/change-management/change-request: + post: + description: Create a new change request. + operationId: CreateChangeRequest + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChangeRequestCreateRequest' + description: Change request payload. + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/ChangeRequestResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_write + summary: Create a change request + tags: + - Change 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/change-management/change-request/{change_request_id}: + get: + description: Get the details of a change request by its ID. + operationId: GetChangeRequest + parameters: + - $ref: '#/components/parameters/ChangeRequestIDPathParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ChangeRequestResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_read + summary: Get a change request + tags: + - Change 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: Update the properties of a change request. + operationId: UpdateChangeRequest + parameters: + - $ref: '#/components/parameters/ChangeRequestIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChangeRequestUpdateRequest' + description: Change request update payload. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ChangeRequestResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_write + summary: Update a change request + tags: + - Change 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/change-management/change-request/{change_request_id}/branch: + post: + description: Create a new branch in a repository for a change request. + operationId: CreateChangeRequestBranch + parameters: + - $ref: '#/components/parameters/ChangeRequestIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChangeRequestBranchCreateRequest' + description: Branch creation payload. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ChangeRequestResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '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 a change request branch + tags: + - Change 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/change-management/change-request/{change_request_id}/decisions/{decision_id}: + delete: + description: Delete a decision from a change request. + operationId: DeleteChangeRequestDecision + parameters: + - $ref: '#/components/parameters/ChangeRequestIDPathParameter' + - $ref: '#/components/parameters/ChangeRequestDecisionIDPathParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ChangeRequestResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - cases_write + summary: Delete a change request decision + tags: + - Change 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: Update a decision on a change request, such as approving or declining + it. + operationId: UpdateChangeRequestDecision + parameters: + - $ref: '#/components/parameters/ChangeRequestIDPathParameter' + - $ref: '#/components/parameters/ChangeRequestDecisionIDPathParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChangeRequestDecisionUpdateRequest' + description: Decision update payload. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ChangeRequestResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/JSONAPIErrorResponse' + description: Bad Request + '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 a change request decision + tags: + - Change 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/ci/pipeline: post: description: 'Send your pipeline event to your Datadog platform over HTTP. For @@ -105183,6 +106080,10 @@ tags: Management page](https://docs.datadoghq.com/service_management/case_management/) for more information. name: Case Management Type +- description: View and manage change requests within Change Management. See the [Case + Management page](https://docs.datadoghq.com/service_management/case_management/) + for more information. + name: Change Management - description: Configure AWS cloud authentication mappings for persona and intake authentication through the Datadog API. name: Cloud Authentication diff --git a/examples/v2/change-management/CreateChangeRequest.rb b/examples/v2/change-management/CreateChangeRequest.rb new file mode 100644 index 00000000000..6c4749344c6 --- /dev/null +++ b/examples/v2/change-management/CreateChangeRequest.rb @@ -0,0 +1,29 @@ +# Create a change request returns "Created" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_change_request".to_sym] = true +end +api_instance = DatadogAPIClient::V2::ChangeManagementAPI.new + +body = DatadogAPIClient::V2::ChangeRequestCreateRequest.new({ + data: DatadogAPIClient::V2::ChangeRequestCreateData.new({ + attributes: DatadogAPIClient::V2::ChangeRequestCreateAttributes.new({ + change_request_linked_incident_uuid: "00000000-0000-0000-0000-000000000000", + change_request_maintenance_window_query: "", + change_request_plan: "1. Deploy to staging 2. Run tests 3. Deploy to production", + change_request_risk: DatadogAPIClient::V2::ChangeRequestRiskLevel::LOW, + change_request_type: DatadogAPIClient::V2::ChangeRequestChangeType::NORMAL, + description: "Deploying new payment service v2.1", + end_date: "2024-01-02T15:00:00Z", + project_id: "d4bbe1af-f36e-42f1-87c1-493ca35c320e", + requested_teams: [ + "team-handle-1", + ], + start_date: "2024-01-01T03:00:00Z", + title: "Deploy new payment service", + }), + type: DatadogAPIClient::V2::ChangeRequestResourceType::CHANGE_REQUEST, + }), +}) +p api_instance.create_change_request(body) diff --git a/examples/v2/change-management/CreateChangeRequestBranch.rb b/examples/v2/change-management/CreateChangeRequestBranch.rb new file mode 100644 index 00000000000..ed4f9b6e545 --- /dev/null +++ b/examples/v2/change-management/CreateChangeRequestBranch.rb @@ -0,0 +1,18 @@ +# Create a change request branch returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_change_request_branch".to_sym] = true +end +api_instance = DatadogAPIClient::V2::ChangeManagementAPI.new + +body = DatadogAPIClient::V2::ChangeRequestBranchCreateRequest.new({ + data: DatadogAPIClient::V2::ChangeRequestBranchCreateData.new({ + attributes: DatadogAPIClient::V2::ChangeRequestBranchCreateAttributes.new({ + branch_name: "chm/CHM-1234", + repo_id: "DataDog/dd-source", + }), + type: DatadogAPIClient::V2::ChangeRequestBranchResourceType::CHANGE_REQUEST_BRANCH, + }), +}) +p api_instance.create_change_request_branch("change_request_id", body) diff --git a/examples/v2/change-management/DeleteChangeRequestDecision.rb b/examples/v2/change-management/DeleteChangeRequestDecision.rb new file mode 100644 index 00000000000..93607771b32 --- /dev/null +++ b/examples/v2/change-management/DeleteChangeRequestDecision.rb @@ -0,0 +1,8 @@ +# Delete a change request decision returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_change_request_decision".to_sym] = true +end +api_instance = DatadogAPIClient::V2::ChangeManagementAPI.new +p api_instance.delete_change_request_decision("change_request_id", "decision_id") diff --git a/examples/v2/change-management/GetChangeRequest.rb b/examples/v2/change-management/GetChangeRequest.rb new file mode 100644 index 00000000000..e8cf968adc6 --- /dev/null +++ b/examples/v2/change-management/GetChangeRequest.rb @@ -0,0 +1,8 @@ +# Get a change request returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_change_request".to_sym] = true +end +api_instance = DatadogAPIClient::V2::ChangeManagementAPI.new +p api_instance.get_change_request("change_request_id") diff --git a/examples/v2/change-management/UpdateChangeRequest.rb b/examples/v2/change-management/UpdateChangeRequest.rb new file mode 100644 index 00000000000..66a6cd84ad6 --- /dev/null +++ b/examples/v2/change-management/UpdateChangeRequest.rb @@ -0,0 +1,50 @@ +# Update a change request returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_change_request".to_sym] = true +end +api_instance = DatadogAPIClient::V2::ChangeManagementAPI.new + +body = DatadogAPIClient::V2::ChangeRequestUpdateRequest.new({ + data: DatadogAPIClient::V2::ChangeRequestUpdateData.new({ + attributes: DatadogAPIClient::V2::ChangeRequestUpdateAttributes.new({ + change_request_plan: "Updated deployment plan", + change_request_risk: DatadogAPIClient::V2::ChangeRequestRiskLevel::LOW, + change_request_type: DatadogAPIClient::V2::ChangeRequestChangeType::NORMAL, + end_date: "2024-01-02T15:00:00Z", + id: "CHM-1234", + start_date: "2024-01-01T03:00:00Z", + }), + relationships: DatadogAPIClient::V2::ChangeRequestUpdateRelationships.new({ + change_request_decisions: DatadogAPIClient::V2::ChangeRequestDecisionsRelationship.new({ + data: [ + DatadogAPIClient::V2::ChangeRequestDecisionRelationshipData.new({ + id: "decision-id-0", + type: DatadogAPIClient::V2::ChangeRequestDecisionResourceType::CHANGE_REQUEST_DECISION, + }), + ], + }), + }), + type: DatadogAPIClient::V2::ChangeRequestResourceType::CHANGE_REQUEST, + }), + included: [ + DatadogAPIClient::V2::ChangeRequestDecisionCreateItem.new({ + attributes: DatadogAPIClient::V2::ChangeRequestDecisionCreateAttributes.new({ + change_request_status: DatadogAPIClient::V2::ChangeRequestDecisionStatusType::REQUESTED, + request_reason: "Please review and approve this change", + }), + id: "decision-id-0", + relationships: DatadogAPIClient::V2::ChangeRequestDecisionCreateRelationships.new({ + requested_user: DatadogAPIClient::V2::ChangeRequestUserRelationship.new({ + data: DatadogAPIClient::V2::ChangeRequestUserRelationshipData.new({ + id: "00000000-0000-0000-0000-000000000000", + type: "user", + }), + }), + }), + type: DatadogAPIClient::V2::ChangeRequestDecisionResourceType::CHANGE_REQUEST_DECISION, + }), + ], +}) +p api_instance.update_change_request("change_request_id", body) diff --git a/examples/v2/change-management/UpdateChangeRequestDecision.rb b/examples/v2/change-management/UpdateChangeRequestDecision.rb new file mode 100644 index 00000000000..da9bcf65eb3 --- /dev/null +++ b/examples/v2/change-management/UpdateChangeRequestDecision.rb @@ -0,0 +1,45 @@ +# Update a change request decision returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_change_request_decision".to_sym] = true +end +api_instance = DatadogAPIClient::V2::ChangeManagementAPI.new + +body = DatadogAPIClient::V2::ChangeRequestDecisionUpdateRequest.new({ + data: DatadogAPIClient::V2::ChangeRequestDecisionUpdateData.new({ + attributes: DatadogAPIClient::V2::ChangeRequestDecisionUpdateDataAttributes.new({ + id: "CHM-1234", + }), + relationships: DatadogAPIClient::V2::ChangeRequestDecisionUpdateDataRelationships.new({ + change_request_decisions: DatadogAPIClient::V2::ChangeRequestDecisionsRelationship.new({ + data: [ + DatadogAPIClient::V2::ChangeRequestDecisionRelationshipData.new({ + id: "decision-id-0", + type: DatadogAPIClient::V2::ChangeRequestDecisionResourceType::CHANGE_REQUEST_DECISION, + }), + ], + }), + }), + type: DatadogAPIClient::V2::ChangeRequestResourceType::CHANGE_REQUEST, + }), + included: [ + DatadogAPIClient::V2::ChangeRequestDecisionCreateItem.new({ + attributes: DatadogAPIClient::V2::ChangeRequestDecisionCreateAttributes.new({ + change_request_status: DatadogAPIClient::V2::ChangeRequestDecisionStatusType::REQUESTED, + request_reason: "Please review and approve this change", + }), + id: "decision-id-0", + relationships: DatadogAPIClient::V2::ChangeRequestDecisionCreateRelationships.new({ + requested_user: DatadogAPIClient::V2::ChangeRequestUserRelationship.new({ + data: DatadogAPIClient::V2::ChangeRequestUserRelationshipData.new({ + id: "00000000-0000-0000-0000-000000000000", + type: "user", + }), + }), + }), + type: DatadogAPIClient::V2::ChangeRequestDecisionResourceType::CHANGE_REQUEST_DECISION, + }), + ], +}) +p api_instance.update_change_request_decision("change_request_id", "decision_id", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 91dd023b112..058c6fd26cc 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1357,6 +1357,29 @@ "include" => "RelationIncludeType", "include_discovered" => "Boolean", }, + "v2.CreateChangeRequest" => { + "body" => "ChangeRequestCreateRequest", + }, + "v2.GetChangeRequest" => { + "change_request_id" => "String", + }, + "v2.UpdateChangeRequest" => { + "change_request_id" => "String", + "body" => "ChangeRequestUpdateRequest", + }, + "v2.CreateChangeRequestBranch" => { + "change_request_id" => "String", + "body" => "ChangeRequestBranchCreateRequest", + }, + "v2.DeleteChangeRequestDecision" => { + "change_request_id" => "String", + "decision_id" => "String", + }, + "v2.UpdateChangeRequestDecision" => { + "change_request_id" => "String", + "decision_id" => "String", + "body" => "ChangeRequestDecisionUpdateRequest", + }, "v2.CreateCIAppPipelineEvent" => { "body" => "CIAppCreatePipelineEventRequest", }, diff --git a/features/v2/change_management.feature b/features/v2/change_management.feature new file mode 100644 index 00000000000..dbbae657bb8 --- /dev/null +++ b/features/v2/change_management.feature @@ -0,0 +1,162 @@ +@endpoint(change-management) @endpoint(change-management-v2) +Feature: Change Management + View and manage change requests within Change Management. See the [Case + Management + page](https://docs.datadoghq.com/service_management/case_management/) for + more information. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "ChangeManagement" API + + @generated @skip @team:DataDog/case-management + Scenario: Create a change request branch returns "Bad Request" response + Given operation "CreateChangeRequestBranch" enabled + And new "CreateChangeRequestBranch" request + And request contains "change_request_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"branch_name": "chm/CHM-1234", "repo_id": "DataDog/dd-source"}, "type": "change_request_branch"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Create a change request branch returns "Not Found" response + Given operation "CreateChangeRequestBranch" enabled + And new "CreateChangeRequestBranch" request + And request contains "change_request_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"branch_name": "chm/CHM-1234", "repo_id": "DataDog/dd-source"}, "type": "change_request_branch"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/case-management + Scenario: Create a change request branch returns "OK" response + Given operation "CreateChangeRequestBranch" enabled + And new "CreateChangeRequestBranch" request + And request contains "change_request_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"branch_name": "chm/CHM-1234", "repo_id": "DataDog/dd-source"}, "type": "change_request_branch"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/case-management + Scenario: Create a change request returns "Bad Request" response + Given operation "CreateChangeRequest" enabled + And new "CreateChangeRequest" request + And body with value {"data": {"attributes": {"change_request_linked_incident_uuid": "00000000-0000-0000-0000-000000000000", "change_request_maintenance_window_query": "", "change_request_plan": "1. Deploy to staging 2. Run tests 3. Deploy to production", "change_request_risk": "LOW", "change_request_type": "NORMAL", "description": "Deploying new payment service v2.1", "end_date": "2024-01-02T15:00:00Z", "project_id": "d4bbe1af-f36e-42f1-87c1-493ca35c320e", "requested_teams": ["team-handle-1"], "start_date": "2024-01-01T03:00:00Z", "title": "Deploy new payment service"}, "type": "change_request"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Create a change request returns "Created" response + Given operation "CreateChangeRequest" enabled + And new "CreateChangeRequest" request + And body with value {"data": {"attributes": {"change_request_linked_incident_uuid": "00000000-0000-0000-0000-000000000000", "change_request_maintenance_window_query": "", "change_request_plan": "1. Deploy to staging 2. Run tests 3. Deploy to production", "change_request_risk": "LOW", "change_request_type": "NORMAL", "description": "Deploying new payment service v2.1", "end_date": "2024-01-02T15:00:00Z", "project_id": "d4bbe1af-f36e-42f1-87c1-493ca35c320e", "requested_teams": ["team-handle-1"], "start_date": "2024-01-01T03:00:00Z", "title": "Deploy new payment service"}, "type": "change_request"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/case-management + Scenario: Delete a change request decision returns "Bad Request" response + Given operation "DeleteChangeRequestDecision" enabled + And new "DeleteChangeRequestDecision" request + And request contains "change_request_id" parameter from "REPLACE.ME" + And request contains "decision_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: Delete a change request decision returns "Not Found" response + Given operation "DeleteChangeRequestDecision" enabled + And new "DeleteChangeRequestDecision" request + And request contains "change_request_id" parameter from "REPLACE.ME" + And request contains "decision_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: Delete a change request decision returns "OK" response + Given operation "DeleteChangeRequestDecision" enabled + And new "DeleteChangeRequestDecision" request + And request contains "change_request_id" parameter from "REPLACE.ME" + And request contains "decision_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/case-management + Scenario: Get a change request returns "Bad Request" response + Given operation "GetChangeRequest" enabled + And new "GetChangeRequest" request + And request contains "change_request_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: Get a change request returns "Not Found" response + Given operation "GetChangeRequest" enabled + And new "GetChangeRequest" request + And request contains "change_request_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: Get a change request returns "OK" response + Given operation "GetChangeRequest" enabled + And new "GetChangeRequest" request + And request contains "change_request_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/case-management + Scenario: Update a change request decision returns "Bad Request" response + Given operation "UpdateChangeRequestDecision" enabled + And new "UpdateChangeRequestDecision" request + And request contains "change_request_id" parameter from "REPLACE.ME" + And request contains "decision_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"id": "CHM-1234"}, "relationships": {"change_request_decisions": {"data": [{"id": "decision-id-0", "type": "change_request_decision"}]}}, "type": "change_request"}, "included": [{"attributes": {"change_request_status": "REQUESTED", "request_reason": "Please review and approve this change"}, "id": "decision-id-0", "relationships": {"requested_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "user"}}}, "type": "change_request_decision"}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Update a change request decision returns "Not Found" response + Given operation "UpdateChangeRequestDecision" enabled + And new "UpdateChangeRequestDecision" request + And request contains "change_request_id" parameter from "REPLACE.ME" + And request contains "decision_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"id": "CHM-1234"}, "relationships": {"change_request_decisions": {"data": [{"id": "decision-id-0", "type": "change_request_decision"}]}}, "type": "change_request"}, "included": [{"attributes": {"change_request_status": "REQUESTED", "request_reason": "Please review and approve this change"}, "id": "decision-id-0", "relationships": {"requested_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "user"}}}, "type": "change_request_decision"}]} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/case-management + Scenario: Update a change request decision returns "OK" response + Given operation "UpdateChangeRequestDecision" enabled + And new "UpdateChangeRequestDecision" request + And request contains "change_request_id" parameter from "REPLACE.ME" + And request contains "decision_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"id": "CHM-1234"}, "relationships": {"change_request_decisions": {"data": [{"id": "decision-id-0", "type": "change_request_decision"}]}}, "type": "change_request"}, "included": [{"attributes": {"change_request_status": "REQUESTED", "request_reason": "Please review and approve this change"}, "id": "decision-id-0", "relationships": {"requested_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "user"}}}, "type": "change_request_decision"}]} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/case-management + Scenario: Update a change request returns "Bad Request" response + Given operation "UpdateChangeRequest" enabled + And new "UpdateChangeRequest" request + And request contains "change_request_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"change_request_plan": "Updated deployment plan", "change_request_risk": "LOW", "change_request_type": "NORMAL", "end_date": "2024-01-02T15:00:00Z", "id": "CHM-1234", "start_date": "2024-01-01T03:00:00Z"}, "relationships": {"change_request_decisions": {"data": [{"id": "decision-id-0", "type": "change_request_decision"}]}}, "type": "change_request"}, "included": [{"attributes": {"change_request_status": "REQUESTED", "request_reason": "Please review and approve this change"}, "id": "decision-id-0", "relationships": {"requested_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "user"}}}, "type": "change_request_decision"}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/case-management + Scenario: Update a change request returns "Not Found" response + Given operation "UpdateChangeRequest" enabled + And new "UpdateChangeRequest" request + And request contains "change_request_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"change_request_plan": "Updated deployment plan", "change_request_risk": "LOW", "change_request_type": "NORMAL", "end_date": "2024-01-02T15:00:00Z", "id": "CHM-1234", "start_date": "2024-01-01T03:00:00Z"}, "relationships": {"change_request_decisions": {"data": [{"id": "decision-id-0", "type": "change_request_decision"}]}}, "type": "change_request"}, "included": [{"attributes": {"change_request_status": "REQUESTED", "request_reason": "Please review and approve this change"}, "id": "decision-id-0", "relationships": {"requested_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "user"}}}, "type": "change_request_decision"}]} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/case-management + Scenario: Update a change request returns "OK" response + Given operation "UpdateChangeRequest" enabled + And new "UpdateChangeRequest" request + And request contains "change_request_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"change_request_plan": "Updated deployment plan", "change_request_risk": "LOW", "change_request_type": "NORMAL", "end_date": "2024-01-02T15:00:00Z", "id": "CHM-1234", "start_date": "2024-01-01T03:00:00Z"}, "relationships": {"change_request_decisions": {"data": [{"id": "decision-id-0", "type": "change_request_decision"}]}}, "type": "change_request"}, "included": [{"attributes": {"change_request_status": "REQUESTED", "request_reason": "Please review and approve this change"}, "id": "decision-id-0", "relationships": {"requested_user": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "user"}}}, "type": "change_request_decision"}]} + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index 10efec9a5c1..53890381408 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -972,6 +972,46 @@ "type": "safe" } }, + "CreateChangeRequest": { + "tag": "Change Management", + "undo": { + "operationId": "TODO", + "parameters": [], + "type": "unsafe" + } + }, + "GetChangeRequest": { + "tag": "Change Management", + "undo": { + "type": "safe" + } + }, + "UpdateChangeRequest": { + "tag": "Change Management", + "undo": { + "type": "idempotent" + } + }, + "CreateChangeRequestBranch": { + "tag": "Change Management", + "undo": { + "operationId": "TODO", + "parameters": [], + "type": "unsafe" + } + }, + "DeleteChangeRequestDecision": { + "tag": "Change Management", + "undo": { + "type": "idempotent" + } + }, + "UpdateChangeRequestDecision": { + "tag": "Change Management", + "undo": { + "type": "idempotent" + } + }, "CreateCIAppPipelineEvent": { "tag": "CI Visibility Pipelines", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 4b2edf25db6..b4596bb39fe 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -215,6 +215,12 @@ def initialize "v2.link_jira_issue_to_case": false, "v2.move_case_to_project": false, "v2.unlink_jira_issue": false, + "v2.create_change_request": false, + "v2.create_change_request_branch": false, + "v2.delete_change_request_decision": false, + "v2.get_change_request": false, + "v2.update_change_request": false, + "v2.update_change_request_decision": false, "v2.list_aws_cloud_auth_persona_mappings": false, "v2.activate_content_pack": false, "v2.cancel_threat_hunting_job": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 77636ca0dc7..36a1ce2a3e0 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1496,6 +1496,43 @@ def overrides "v2.change_event_custom_attributes_impacted_resources_items" => "ChangeEventCustomAttributesImpactedResourcesItems", "v2.change_event_custom_attributes_impacted_resources_items_type" => "ChangeEventCustomAttributesImpactedResourcesItemsType", "v2.change_event_trigger_wrapper" => "ChangeEventTriggerWrapper", + "v2.change_request_branch_create_attributes" => "ChangeRequestBranchCreateAttributes", + "v2.change_request_branch_create_data" => "ChangeRequestBranchCreateData", + "v2.change_request_branch_create_request" => "ChangeRequestBranchCreateRequest", + "v2.change_request_branch_resource_type" => "ChangeRequestBranchResourceType", + "v2.change_request_change_type" => "ChangeRequestChangeType", + "v2.change_request_create_attributes" => "ChangeRequestCreateAttributes", + "v2.change_request_create_data" => "ChangeRequestCreateData", + "v2.change_request_create_request" => "ChangeRequestCreateRequest", + "v2.change_request_decision_create_attributes" => "ChangeRequestDecisionCreateAttributes", + "v2.change_request_decision_create_item" => "ChangeRequestDecisionCreateItem", + "v2.change_request_decision_create_relationships" => "ChangeRequestDecisionCreateRelationships", + "v2.change_request_decision_relationship_data" => "ChangeRequestDecisionRelationshipData", + "v2.change_request_decision_relationships" => "ChangeRequestDecisionRelationships", + "v2.change_request_decision_resource_type" => "ChangeRequestDecisionResourceType", + "v2.change_request_decision_response_attributes" => "ChangeRequestDecisionResponseAttributes", + "v2.change_request_decisions_relationship" => "ChangeRequestDecisionsRelationship", + "v2.change_request_decision_status_type" => "ChangeRequestDecisionStatusType", + "v2.change_request_decision_update_data" => "ChangeRequestDecisionUpdateData", + "v2.change_request_decision_update_data_attributes" => "ChangeRequestDecisionUpdateDataAttributes", + "v2.change_request_decision_update_data_relationships" => "ChangeRequestDecisionUpdateDataRelationships", + "v2.change_request_decision_update_request" => "ChangeRequestDecisionUpdateRequest", + "v2.change_request_included_decision" => "ChangeRequestIncludedDecision", + "v2.change_request_included_item" => "ChangeRequestIncludedItem", + "v2.change_request_included_user" => "ChangeRequestIncludedUser", + "v2.change_request_included_user_attributes" => "ChangeRequestIncludedUserAttributes", + "v2.change_request_relationships" => "ChangeRequestRelationships", + "v2.change_request_resource_type" => "ChangeRequestResourceType", + "v2.change_request_response" => "ChangeRequestResponse", + "v2.change_request_response_attributes" => "ChangeRequestResponseAttributes", + "v2.change_request_response_data" => "ChangeRequestResponseData", + "v2.change_request_risk_level" => "ChangeRequestRiskLevel", + "v2.change_request_update_attributes" => "ChangeRequestUpdateAttributes", + "v2.change_request_update_data" => "ChangeRequestUpdateData", + "v2.change_request_update_relationships" => "ChangeRequestUpdateRelationships", + "v2.change_request_update_request" => "ChangeRequestUpdateRequest", + "v2.change_request_user_relationship" => "ChangeRequestUserRelationship", + "v2.change_request_user_relationship_data" => "ChangeRequestUserRelationshipData", "v2.chargeback_breakdown" => "ChargebackBreakdown", "v2.ci_app_aggregate_bucket_value" => "CIAppAggregateBucketValue", "v2.ci_app_aggregate_bucket_value_timeseries_point" => "CIAppAggregateBucketValueTimeseriesPoint", @@ -5354,6 +5391,7 @@ def overrides "v2.case_management_api" => "CaseManagementAPI", "v2.case_management_attribute_api" => "CaseManagementAttributeAPI", "v2.case_management_type_api" => "CaseManagementTypeAPI", + "v2.change_management_api" => "ChangeManagementAPI", "v2.ci_visibility_pipelines_api" => "CIVisibilityPipelinesAPI", "v2.ci_visibility_tests_api" => "CIVisibilityTestsAPI", "v2.cloud_authentication_api" => "CloudAuthenticationAPI", diff --git a/lib/datadog_api_client/v2/api/change_management_api.rb b/lib/datadog_api_client/v2/api/change_management_api.rb new file mode 100644 index 00000000000..775fbcf8a6e --- /dev/null +++ b/lib/datadog_api_client/v2/api/change_management_api.rb @@ -0,0 +1,485 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class ChangeManagementAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Create a change request. + # + # @see #create_change_request_with_http_info + def create_change_request(body, opts = {}) + data, _status_code, _headers = create_change_request_with_http_info(body, opts) + data + end + + # Create a change request. + # + # Create a new change request. + # + # @param body [ChangeRequestCreateRequest] Change request payload. + # @param opts [Hash] the optional parameters + # @return [Array<(ChangeRequestResponse, Integer, Hash)>] ChangeRequestResponse data, response status code and response headers + def create_change_request_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_change_request".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_change_request") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_change_request")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChangeManagementAPI.create_change_request ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling ChangeManagementAPI.create_change_request" + end + # resource path + local_var_path = '/api/v2/change-management/change-request' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'ChangeRequestResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_change_request, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ChangeManagementAPI#create_change_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create a change request branch. + # + # @see #create_change_request_branch_with_http_info + def create_change_request_branch(change_request_id, body, opts = {}) + data, _status_code, _headers = create_change_request_branch_with_http_info(change_request_id, body, opts) + data + end + + # Create a change request branch. + # + # Create a new branch in a repository for a change request. + # + # @param change_request_id [String] The identifier of the change request. + # @param body [ChangeRequestBranchCreateRequest] Branch creation payload. + # @param opts [Hash] the optional parameters + # @return [Array<(ChangeRequestResponse, Integer, Hash)>] ChangeRequestResponse data, response status code and response headers + def create_change_request_branch_with_http_info(change_request_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_change_request_branch".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_change_request_branch") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_change_request_branch")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChangeManagementAPI.create_change_request_branch ...' + end + # verify the required parameter 'change_request_id' is set + if @api_client.config.client_side_validation && change_request_id.nil? + fail ArgumentError, "Missing the required parameter 'change_request_id' when calling ChangeManagementAPI.create_change_request_branch" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling ChangeManagementAPI.create_change_request_branch" + end + # resource path + local_var_path = '/api/v2/change-management/change-request/{change_request_id}/branch'.sub('{change_request_id}', CGI.escape(change_request_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'ChangeRequestResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_change_request_branch, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ChangeManagementAPI#create_change_request_branch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete a change request decision. + # + # @see #delete_change_request_decision_with_http_info + def delete_change_request_decision(change_request_id, decision_id, opts = {}) + data, _status_code, _headers = delete_change_request_decision_with_http_info(change_request_id, decision_id, opts) + data + end + + # Delete a change request decision. + # + # Delete a decision from a change request. + # + # @param change_request_id [String] The identifier of the change request. + # @param decision_id [String] The identifier of the change request decision. + # @param opts [Hash] the optional parameters + # @return [Array<(ChangeRequestResponse, Integer, Hash)>] ChangeRequestResponse data, response status code and response headers + def delete_change_request_decision_with_http_info(change_request_id, decision_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_change_request_decision".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_change_request_decision") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_change_request_decision")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChangeManagementAPI.delete_change_request_decision ...' + end + # verify the required parameter 'change_request_id' is set + if @api_client.config.client_side_validation && change_request_id.nil? + fail ArgumentError, "Missing the required parameter 'change_request_id' when calling ChangeManagementAPI.delete_change_request_decision" + end + # verify the required parameter 'decision_id' is set + if @api_client.config.client_side_validation && decision_id.nil? + fail ArgumentError, "Missing the required parameter 'decision_id' when calling ChangeManagementAPI.delete_change_request_decision" + end + # resource path + local_var_path = '/api/v2/change-management/change-request/{change_request_id}/decisions/{decision_id}'.sub('{change_request_id}', CGI.escape(change_request_id.to_s).gsub('%2F', '/')).sub('{decision_id}', CGI.escape(decision_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ChangeRequestResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :delete_change_request_decision, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ChangeManagementAPI#delete_change_request_decision\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a change request. + # + # @see #get_change_request_with_http_info + def get_change_request(change_request_id, opts = {}) + data, _status_code, _headers = get_change_request_with_http_info(change_request_id, opts) + data + end + + # Get a change request. + # + # Get the details of a change request by its ID. + # + # @param change_request_id [String] The identifier of the change request. + # @param opts [Hash] the optional parameters + # @return [Array<(ChangeRequestResponse, Integer, Hash)>] ChangeRequestResponse data, response status code and response headers + def get_change_request_with_http_info(change_request_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_change_request".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_change_request") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_change_request")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChangeManagementAPI.get_change_request ...' + end + # verify the required parameter 'change_request_id' is set + if @api_client.config.client_side_validation && change_request_id.nil? + fail ArgumentError, "Missing the required parameter 'change_request_id' when calling ChangeManagementAPI.get_change_request" + end + # resource path + local_var_path = '/api/v2/change-management/change-request/{change_request_id}'.sub('{change_request_id}', CGI.escape(change_request_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ChangeRequestResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_change_request, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ChangeManagementAPI#get_change_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a change request. + # + # @see #update_change_request_with_http_info + def update_change_request(change_request_id, body, opts = {}) + data, _status_code, _headers = update_change_request_with_http_info(change_request_id, body, opts) + data + end + + # Update a change request. + # + # Update the properties of a change request. + # + # @param change_request_id [String] The identifier of the change request. + # @param body [ChangeRequestUpdateRequest] Change request update payload. + # @param opts [Hash] the optional parameters + # @return [Array<(ChangeRequestResponse, Integer, Hash)>] ChangeRequestResponse data, response status code and response headers + def update_change_request_with_http_info(change_request_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_change_request".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_change_request") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_change_request")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChangeManagementAPI.update_change_request ...' + end + # verify the required parameter 'change_request_id' is set + if @api_client.config.client_side_validation && change_request_id.nil? + fail ArgumentError, "Missing the required parameter 'change_request_id' when calling ChangeManagementAPI.update_change_request" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling ChangeManagementAPI.update_change_request" + end + # resource path + local_var_path = '/api/v2/change-management/change-request/{change_request_id}'.sub('{change_request_id}', CGI.escape(change_request_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'ChangeRequestResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_change_request, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ChangeManagementAPI#update_change_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a change request decision. + # + # @see #update_change_request_decision_with_http_info + def update_change_request_decision(change_request_id, decision_id, body, opts = {}) + data, _status_code, _headers = update_change_request_decision_with_http_info(change_request_id, decision_id, body, opts) + data + end + + # Update a change request decision. + # + # Update a decision on a change request, such as approving or declining it. + # + # @param change_request_id [String] The identifier of the change request. + # @param decision_id [String] The identifier of the change request decision. + # @param body [ChangeRequestDecisionUpdateRequest] Decision update payload. + # @param opts [Hash] the optional parameters + # @return [Array<(ChangeRequestResponse, Integer, Hash)>] ChangeRequestResponse data, response status code and response headers + def update_change_request_decision_with_http_info(change_request_id, decision_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_change_request_decision".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_change_request_decision") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_change_request_decision")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChangeManagementAPI.update_change_request_decision ...' + end + # verify the required parameter 'change_request_id' is set + if @api_client.config.client_side_validation && change_request_id.nil? + fail ArgumentError, "Missing the required parameter 'change_request_id' when calling ChangeManagementAPI.update_change_request_decision" + end + # verify the required parameter 'decision_id' is set + if @api_client.config.client_side_validation && decision_id.nil? + fail ArgumentError, "Missing the required parameter 'decision_id' when calling ChangeManagementAPI.update_change_request_decision" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling ChangeManagementAPI.update_change_request_decision" + end + # resource path + local_var_path = '/api/v2/change-management/change-request/{change_request_id}/decisions/{decision_id}'.sub('{change_request_id}', CGI.escape(change_request_id.to_s).gsub('%2F', '/')).sub('{decision_id}', CGI.escape(decision_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'ChangeRequestResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_change_request_decision, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ChangeManagementAPI#update_change_request_decision\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_branch_create_attributes.rb b/lib/datadog_api_client/v2/models/change_request_branch_create_attributes.rb new file mode 100644 index 00000000000..f87fdccda59 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_branch_create_attributes.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for creating a change request branch. + class ChangeRequestBranchCreateAttributes + include BaseGenericModel + + # The name of the branch to create. + attr_reader :branch_name + + # The repository identifier in the format owner/repository. + attr_reader :repo_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'branch_name' => :'branch_name', + :'repo_id' => :'repo_id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'branch_name' => :'String', + :'repo_id' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestBranchCreateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'branch_name') + self.branch_name = attributes[:'branch_name'] + end + + if attributes.key?(:'repo_id') + self.repo_id = attributes[:'repo_id'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @branch_name.nil? + return false if @repo_id.nil? + true + end + + # Custom attribute writer method with validation + # @param branch_name [Object] Object to be assigned + # @!visibility private + def branch_name=(branch_name) + if branch_name.nil? + fail ArgumentError, 'invalid value for "branch_name", branch_name cannot be nil.' + end + @branch_name = branch_name + end + + # Custom attribute writer method with validation + # @param repo_id [Object] Object to be assigned + # @!visibility private + def repo_id=(repo_id) + if repo_id.nil? + fail ArgumentError, 'invalid value for "repo_id", repo_id cannot be nil.' + end + @repo_id = repo_id + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + branch_name == o.branch_name && + repo_id == o.repo_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [branch_name, repo_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_branch_create_data.rb b/lib/datadog_api_client/v2/models/change_request_branch_create_data.rb new file mode 100644 index 00000000000..bed22639997 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_branch_create_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data object to create a change request branch. + class ChangeRequestBranchCreateData + include BaseGenericModel + + # Attributes for creating a change request branch. + attr_reader :attributes + + # Change request branch resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ChangeRequestBranchCreateAttributes', + :'type' => :'ChangeRequestBranchResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestBranchCreateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_branch_create_request.rb b/lib/datadog_api_client/v2/models/change_request_branch_create_request.rb new file mode 100644 index 00000000000..e723023fc5a --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_branch_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request object to create a branch for a change request. + class ChangeRequestBranchCreateRequest + include BaseGenericModel + + # Data object to create a change request branch. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ChangeRequestBranchCreateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestBranchCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_branch_resource_type.rb b/lib/datadog_api_client/v2/models/change_request_branch_resource_type.rb new file mode 100644 index 00000000000..ecbea77e982 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_branch_resource_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Change request branch resource type. + class ChangeRequestBranchResourceType + include BaseEnumModel + + CHANGE_REQUEST_BRANCH = "change_request_branch".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_change_type.rb b/lib/datadog_api_client/v2/models/change_request_change_type.rb new file mode 100644 index 00000000000..4c79a3ba55e --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_change_type.rb @@ -0,0 +1,28 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of the change request. + class ChangeRequestChangeType + include BaseEnumModel + + NORMAL = "NORMAL".freeze + STANDARD = "STANDARD".freeze + EMERGENCY = "EMERGENCY".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_create_attributes.rb b/lib/datadog_api_client/v2/models/change_request_create_attributes.rb new file mode 100644 index 00000000000..14fd2580e2c --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_create_attributes.rb @@ -0,0 +1,225 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for creating a change request. + class ChangeRequestCreateAttributes + include BaseGenericModel + + # The UUID of an incident to link to the change request. + attr_accessor :change_request_linked_incident_uuid + + # The maintenance window query for the change request. + attr_accessor :change_request_maintenance_window_query + + # The plan associated with the change request. + attr_accessor :change_request_plan + + # The risk level of the change request. + attr_accessor :change_request_risk + + # The type of the change request. + attr_accessor :change_request_type + + # The description of the change request. + attr_accessor :description + + # The planned end date of the change request. + attr_accessor :end_date + + # The project UUID to associate with the change request. + attr_accessor :project_id + + # A list of team handles to request decisions from. + attr_accessor :requested_teams + + # The planned start date of the change request. + attr_accessor :start_date + + # The title of the change request. + attr_reader :title + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'change_request_linked_incident_uuid' => :'change_request_linked_incident_uuid', + :'change_request_maintenance_window_query' => :'change_request_maintenance_window_query', + :'change_request_plan' => :'change_request_plan', + :'change_request_risk' => :'change_request_risk', + :'change_request_type' => :'change_request_type', + :'description' => :'description', + :'end_date' => :'end_date', + :'project_id' => :'project_id', + :'requested_teams' => :'requested_teams', + :'start_date' => :'start_date', + :'title' => :'title' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'change_request_linked_incident_uuid' => :'String', + :'change_request_maintenance_window_query' => :'String', + :'change_request_plan' => :'String', + :'change_request_risk' => :'ChangeRequestRiskLevel', + :'change_request_type' => :'ChangeRequestChangeType', + :'description' => :'String', + :'end_date' => :'Time', + :'project_id' => :'String', + :'requested_teams' => :'Array', + :'start_date' => :'Time', + :'title' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestCreateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'change_request_linked_incident_uuid') + self.change_request_linked_incident_uuid = attributes[:'change_request_linked_incident_uuid'] + end + + if attributes.key?(:'change_request_maintenance_window_query') + self.change_request_maintenance_window_query = attributes[:'change_request_maintenance_window_query'] + end + + if attributes.key?(:'change_request_plan') + self.change_request_plan = attributes[:'change_request_plan'] + end + + if attributes.key?(:'change_request_risk') + self.change_request_risk = attributes[:'change_request_risk'] + end + + if attributes.key?(:'change_request_type') + self.change_request_type = attributes[:'change_request_type'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'end_date') + self.end_date = attributes[:'end_date'] + end + + if attributes.key?(:'project_id') + self.project_id = attributes[:'project_id'] + end + + if attributes.key?(:'requested_teams') + if (value = attributes[:'requested_teams']).is_a?(Array) + self.requested_teams = value + end + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @title.nil? + true + end + + # Custom attribute writer method with validation + # @param title [Object] Object to be assigned + # @!visibility private + def title=(title) + if title.nil? + fail ArgumentError, 'invalid value for "title", title cannot be nil.' + end + @title = title + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + change_request_linked_incident_uuid == o.change_request_linked_incident_uuid && + change_request_maintenance_window_query == o.change_request_maintenance_window_query && + change_request_plan == o.change_request_plan && + change_request_risk == o.change_request_risk && + change_request_type == o.change_request_type && + description == o.description && + end_date == o.end_date && + project_id == o.project_id && + requested_teams == o.requested_teams && + start_date == o.start_date && + title == o.title && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [change_request_linked_incident_uuid, change_request_maintenance_window_query, change_request_plan, change_request_risk, change_request_type, description, end_date, project_id, requested_teams, start_date, title, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_create_data.rb b/lib/datadog_api_client/v2/models/change_request_create_data.rb new file mode 100644 index 00000000000..113c6ab4a6f --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_create_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data object to create a change request. + class ChangeRequestCreateData + include BaseGenericModel + + # Attributes for creating a change request. + attr_reader :attributes + + # Change request resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ChangeRequestCreateAttributes', + :'type' => :'ChangeRequestResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestCreateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_create_request.rb b/lib/datadog_api_client/v2/models/change_request_create_request.rb new file mode 100644 index 00000000000..11af53fddcc --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request object to create a change request. + class ChangeRequestCreateRequest + include BaseGenericModel + + # Data object to create a change request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ChangeRequestCreateData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_decision_create_attributes.rb b/lib/datadog_api_client/v2/models/change_request_decision_create_attributes.rb new file mode 100644 index 00000000000..5920896e157 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_decision_create_attributes.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for creating a change request decision. + class ChangeRequestDecisionCreateAttributes + include BaseGenericModel + + # The status of a change request decision. + attr_accessor :change_request_status + + # The reason for requesting the decision. + attr_accessor :request_reason + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'change_request_status' => :'change_request_status', + :'request_reason' => :'request_reason' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'change_request_status' => :'ChangeRequestDecisionStatusType', + :'request_reason' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestDecisionCreateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'change_request_status') + self.change_request_status = attributes[:'change_request_status'] + end + + if attributes.key?(:'request_reason') + self.request_reason = attributes[:'request_reason'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + change_request_status == o.change_request_status && + request_reason == o.request_reason && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [change_request_status, request_reason, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_decision_create_item.rb b/lib/datadog_api_client/v2/models/change_request_decision_create_item.rb new file mode 100644 index 00000000000..30da753cf6d --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_decision_create_item.rb @@ -0,0 +1,164 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # An included change request decision for a create or update operation. + class ChangeRequestDecisionCreateItem + include BaseGenericModel + + # Attributes for creating a change request decision. + attr_accessor :attributes + + # The decision identifier. + attr_reader :id + + # Relationships for creating a change request decision. + attr_accessor :relationships + + # Change request decision resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ChangeRequestDecisionCreateAttributes', + :'id' => :'String', + :'relationships' => :'ChangeRequestDecisionCreateRelationships', + :'type' => :'ChangeRequestDecisionResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestDecisionCreateItem` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_decision_create_relationships.rb b/lib/datadog_api_client/v2/models/change_request_decision_create_relationships.rb new file mode 100644 index 00000000000..c287f9bab82 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_decision_create_relationships.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationships for creating a change request decision. + class ChangeRequestDecisionCreateRelationships + include BaseGenericModel + + # Relationship to a user. + attr_accessor :requested_user + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'requested_user' => :'requested_user' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'requested_user' => :'ChangeRequestUserRelationship' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestDecisionCreateRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'requested_user') + self.requested_user = attributes[:'requested_user'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + requested_user == o.requested_user && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [requested_user, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_decision_relationship_data.rb b/lib/datadog_api_client/v2/models/change_request_decision_relationship_data.rb new file mode 100644 index 00000000000..305f11a6c22 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_decision_relationship_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Change request decision relationship data. + class ChangeRequestDecisionRelationshipData + include BaseGenericModel + + # The decision UUID. + attr_reader :id + + # Change request decision resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'ChangeRequestDecisionResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestDecisionRelationshipData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_decision_relationships.rb b/lib/datadog_api_client/v2/models/change_request_decision_relationships.rb new file mode 100644 index 00000000000..631468ad37d --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_decision_relationships.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationships of a change request decision. + class ChangeRequestDecisionRelationships + include BaseGenericModel + + # Relationship to a user. + attr_reader :modified_by + + # Relationship to a user. + attr_reader :requested_by_user + + # Relationship to a user. + attr_reader :requested_user + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'modified_by' => :'modified_by', + :'requested_by_user' => :'requested_by_user', + :'requested_user' => :'requested_user' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'modified_by' => :'ChangeRequestUserRelationship', + :'requested_by_user' => :'ChangeRequestUserRelationship', + :'requested_user' => :'ChangeRequestUserRelationship' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestDecisionRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'modified_by') + self.modified_by = attributes[:'modified_by'] + end + + if attributes.key?(:'requested_by_user') + self.requested_by_user = attributes[:'requested_by_user'] + end + + if attributes.key?(:'requested_user') + self.requested_user = attributes[:'requested_user'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @modified_by.nil? + return false if @requested_by_user.nil? + return false if @requested_user.nil? + true + end + + # Custom attribute writer method with validation + # @param modified_by [Object] Object to be assigned + # @!visibility private + def modified_by=(modified_by) + if modified_by.nil? + fail ArgumentError, 'invalid value for "modified_by", modified_by cannot be nil.' + end + @modified_by = modified_by + end + + # Custom attribute writer method with validation + # @param requested_by_user [Object] Object to be assigned + # @!visibility private + def requested_by_user=(requested_by_user) + if requested_by_user.nil? + fail ArgumentError, 'invalid value for "requested_by_user", requested_by_user cannot be nil.' + end + @requested_by_user = requested_by_user + end + + # Custom attribute writer method with validation + # @param requested_user [Object] Object to be assigned + # @!visibility private + def requested_user=(requested_user) + if requested_user.nil? + fail ArgumentError, 'invalid value for "requested_user", requested_user cannot be nil.' + end + @requested_user = requested_user + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + modified_by == o.modified_by && + requested_by_user == o.requested_by_user && + requested_user == o.requested_user && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [modified_by, requested_by_user, requested_user, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_decision_resource_type.rb b/lib/datadog_api_client/v2/models/change_request_decision_resource_type.rb new file mode 100644 index 00000000000..d9d63fe42a6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_decision_resource_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Change request decision resource type. + class ChangeRequestDecisionResourceType + include BaseEnumModel + + CHANGE_REQUEST_DECISION = "change_request_decision".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_decision_response_attributes.rb b/lib/datadog_api_client/v2/models/change_request_decision_response_attributes.rb new file mode 100644 index 00000000000..707946b7ba0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_decision_response_attributes.rb @@ -0,0 +1,228 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of a change request decision in a response. + class ChangeRequestDecisionResponseAttributes + include BaseGenericModel + + # The status of a change request decision. + attr_reader :change_request_status + + # Timestamp of when the decision was made. + attr_reader :decided_at + + # The reason for the decision. + attr_reader :decision_reason + + # Timestamp of when the decision was deleted. + attr_reader :deleted_at + + # The reason for requesting the decision. + attr_reader :request_reason + + # Timestamp of when the decision was requested. + attr_reader :requested_at + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'change_request_status' => :'change_request_status', + :'decided_at' => :'decided_at', + :'decision_reason' => :'decision_reason', + :'deleted_at' => :'deleted_at', + :'request_reason' => :'request_reason', + :'requested_at' => :'requested_at' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'change_request_status' => :'ChangeRequestDecisionStatusType', + :'decided_at' => :'Time', + :'decision_reason' => :'String', + :'deleted_at' => :'Time', + :'request_reason' => :'String', + :'requested_at' => :'Time' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestDecisionResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'change_request_status') + self.change_request_status = attributes[:'change_request_status'] + end + + if attributes.key?(:'decided_at') + self.decided_at = attributes[:'decided_at'] + end + + if attributes.key?(:'decision_reason') + self.decision_reason = attributes[:'decision_reason'] + end + + if attributes.key?(:'deleted_at') + self.deleted_at = attributes[:'deleted_at'] + end + + if attributes.key?(:'request_reason') + self.request_reason = attributes[:'request_reason'] + end + + if attributes.key?(:'requested_at') + self.requested_at = attributes[:'requested_at'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @change_request_status.nil? + return false if @decided_at.nil? + return false if @decision_reason.nil? + return false if @deleted_at.nil? + return false if @request_reason.nil? + return false if @requested_at.nil? + true + end + + # Custom attribute writer method with validation + # @param change_request_status [Object] Object to be assigned + # @!visibility private + def change_request_status=(change_request_status) + if change_request_status.nil? + fail ArgumentError, 'invalid value for "change_request_status", change_request_status cannot be nil.' + end + @change_request_status = change_request_status + end + + # Custom attribute writer method with validation + # @param decided_at [Object] Object to be assigned + # @!visibility private + def decided_at=(decided_at) + if decided_at.nil? + fail ArgumentError, 'invalid value for "decided_at", decided_at cannot be nil.' + end + @decided_at = decided_at + end + + # Custom attribute writer method with validation + # @param decision_reason [Object] Object to be assigned + # @!visibility private + def decision_reason=(decision_reason) + if decision_reason.nil? + fail ArgumentError, 'invalid value for "decision_reason", decision_reason cannot be nil.' + end + @decision_reason = decision_reason + end + + # Custom attribute writer method with validation + # @param deleted_at [Object] Object to be assigned + # @!visibility private + def deleted_at=(deleted_at) + if deleted_at.nil? + fail ArgumentError, 'invalid value for "deleted_at", deleted_at cannot be nil.' + end + @deleted_at = deleted_at + end + + # Custom attribute writer method with validation + # @param request_reason [Object] Object to be assigned + # @!visibility private + def request_reason=(request_reason) + if request_reason.nil? + fail ArgumentError, 'invalid value for "request_reason", request_reason cannot be nil.' + end + @request_reason = request_reason + end + + # Custom attribute writer method with validation + # @param requested_at [Object] Object to be assigned + # @!visibility private + def requested_at=(requested_at) + if requested_at.nil? + fail ArgumentError, 'invalid value for "requested_at", requested_at cannot be nil.' + end + @requested_at = requested_at + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + change_request_status == o.change_request_status && + decided_at == o.decided_at && + decision_reason == o.decision_reason && + deleted_at == o.deleted_at && + request_reason == o.request_reason && + requested_at == o.requested_at && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [change_request_status, decided_at, decision_reason, deleted_at, request_reason, requested_at, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_decision_status_type.rb b/lib/datadog_api_client/v2/models/change_request_decision_status_type.rb new file mode 100644 index 00000000000..c50190b0832 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_decision_status_type.rb @@ -0,0 +1,28 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The status of a change request decision. + class ChangeRequestDecisionStatusType + include BaseEnumModel + + REQUESTED = "REQUESTED".freeze + APPROVED = "APPROVED".freeze + DECLINED = "DECLINED".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_decision_update_data.rb b/lib/datadog_api_client/v2/models/change_request_decision_update_data.rb new file mode 100644 index 00000000000..8f57a65d278 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_decision_update_data.rb @@ -0,0 +1,143 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data object to update a change request decision. + class ChangeRequestDecisionUpdateData + include BaseGenericModel + + # Attributes of the parent change request for a decision update. + attr_accessor :attributes + + # Relationships for updating a change request decision. + attr_accessor :relationships + + # Change request resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ChangeRequestDecisionUpdateDataAttributes', + :'relationships' => :'ChangeRequestDecisionUpdateDataRelationships', + :'type' => :'ChangeRequestResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestDecisionUpdateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_decision_update_data_attributes.rb b/lib/datadog_api_client/v2/models/change_request_decision_update_data_attributes.rb new file mode 100644 index 00000000000..7027871095d --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_decision_update_data_attributes.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the parent change request for a decision update. + class ChangeRequestDecisionUpdateDataAttributes + include BaseGenericModel + + # The identifier of the change request. + attr_accessor :id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestDecisionUpdateDataAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_decision_update_data_relationships.rb b/lib/datadog_api_client/v2/models/change_request_decision_update_data_relationships.rb new file mode 100644 index 00000000000..f45955dd801 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_decision_update_data_relationships.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationships for updating a change request decision. + class ChangeRequestDecisionUpdateDataRelationships + include BaseGenericModel + + # Relationship to change request decisions. + attr_reader :change_request_decisions + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'change_request_decisions' => :'change_request_decisions' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'change_request_decisions' => :'ChangeRequestDecisionsRelationship' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestDecisionUpdateDataRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'change_request_decisions') + self.change_request_decisions = attributes[:'change_request_decisions'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @change_request_decisions.nil? + true + end + + # Custom attribute writer method with validation + # @param change_request_decisions [Object] Object to be assigned + # @!visibility private + def change_request_decisions=(change_request_decisions) + if change_request_decisions.nil? + fail ArgumentError, 'invalid value for "change_request_decisions", change_request_decisions cannot be nil.' + end + @change_request_decisions = change_request_decisions + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + change_request_decisions == o.change_request_decisions && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [change_request_decisions, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_decision_update_request.rb b/lib/datadog_api_client/v2/models/change_request_decision_update_request.rb new file mode 100644 index 00000000000..0c19f93ebae --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_decision_update_request.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request object to update a change request decision. + class ChangeRequestDecisionUpdateRequest + include BaseGenericModel + + # Data object to update a change request decision. + attr_reader :data + + # Included resources for the change request update. + attr_accessor :included + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ChangeRequestDecisionUpdateData', + :'included' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestDecisionUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_decisions_relationship.rb b/lib/datadog_api_client/v2/models/change_request_decisions_relationship.rb new file mode 100644 index 00000000000..6fcebdf4a4e --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_decisions_relationship.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationship to change request decisions. + class ChangeRequestDecisionsRelationship + include BaseGenericModel + + # Array of decision relationship data. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestDecisionsRelationship` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_included_decision.rb b/lib/datadog_api_client/v2/models/change_request_included_decision.rb new file mode 100644 index 00000000000..5350cc0cf35 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_included_decision.rb @@ -0,0 +1,175 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # An included change request decision resource. + class ChangeRequestIncludedDecision + include BaseGenericModel + + # Attributes of a change request decision in a response. + attr_reader :attributes + + # The decision UUID. + attr_reader :id + + # Relationships of a change request decision. + attr_accessor :relationships + + # Change request decision resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ChangeRequestDecisionResponseAttributes', + :'id' => :'String', + :'relationships' => :'ChangeRequestDecisionRelationships', + :'type' => :'ChangeRequestDecisionResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestIncludedDecision` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_included_item.rb b/lib/datadog_api_client/v2/models/change_request_included_item.rb new file mode 100644 index 00000000000..45f5b592597 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_included_item.rb @@ -0,0 +1,63 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # An included resource item in the change request response. + module ChangeRequestIncludedItem + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'ChangeRequestIncludedUser', + :'ChangeRequestIncludedDecision' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_included_user.rb b/lib/datadog_api_client/v2/models/change_request_included_user.rb new file mode 100644 index 00000000000..6fdd312b996 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_included_user.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # An included user resource. + class ChangeRequestIncludedUser + include BaseGenericModel + + # Attributes of an included user. + attr_reader :attributes + + # The user UUID. + attr_reader :id + + # The resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ChangeRequestIncludedUserAttributes', + :'id' => :'String', + :'type' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestIncludedUser` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_included_user_attributes.rb b/lib/datadog_api_client/v2/models/change_request_included_user_attributes.rb new file mode 100644 index 00000000000..a192d273034 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_included_user_attributes.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of an included user. + class ChangeRequestIncludedUserAttributes + include BaseGenericModel + + # The email of the user. + attr_reader :email + + # The handle of the user. + attr_reader :handle + + # The name of the user. + attr_reader :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'email' => :'email', + :'handle' => :'handle', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'email' => :'String', + :'handle' => :'String', + :'name' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestIncludedUserAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'handle') + self.handle = attributes[:'handle'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @email.nil? + return false if @handle.nil? + return false if @name.nil? + true + end + + # Custom attribute writer method with validation + # @param email [Object] Object to be assigned + # @!visibility private + def email=(email) + if email.nil? + fail ArgumentError, 'invalid value for "email", email cannot be nil.' + end + @email = email + end + + # Custom attribute writer method with validation + # @param handle [Object] Object to be assigned + # @!visibility private + def handle=(handle) + if handle.nil? + fail ArgumentError, 'invalid value for "handle", handle cannot be nil.' + end + @handle = handle + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + email == o.email && + handle == o.handle && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [email, handle, name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_relationships.rb b/lib/datadog_api_client/v2/models/change_request_relationships.rb new file mode 100644 index 00000000000..fc78d0a9c36 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_relationships.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationships of a change request. + class ChangeRequestRelationships + include BaseGenericModel + + # Relationship to change request decisions. + attr_reader :change_request_decisions + + # Relationship to a user. + attr_reader :created_by + + # Relationship to a user. + attr_reader :modified_by + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'change_request_decisions' => :'change_request_decisions', + :'created_by' => :'created_by', + :'modified_by' => :'modified_by' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'change_request_decisions' => :'ChangeRequestDecisionsRelationship', + :'created_by' => :'ChangeRequestUserRelationship', + :'modified_by' => :'ChangeRequestUserRelationship' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'change_request_decisions') + self.change_request_decisions = attributes[:'change_request_decisions'] + end + + if attributes.key?(:'created_by') + self.created_by = attributes[:'created_by'] + end + + if attributes.key?(:'modified_by') + self.modified_by = attributes[:'modified_by'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @change_request_decisions.nil? + return false if @created_by.nil? + return false if @modified_by.nil? + true + end + + # Custom attribute writer method with validation + # @param change_request_decisions [Object] Object to be assigned + # @!visibility private + def change_request_decisions=(change_request_decisions) + if change_request_decisions.nil? + fail ArgumentError, 'invalid value for "change_request_decisions", change_request_decisions cannot be nil.' + end + @change_request_decisions = change_request_decisions + end + + # Custom attribute writer method with validation + # @param created_by [Object] Object to be assigned + # @!visibility private + def created_by=(created_by) + if created_by.nil? + fail ArgumentError, 'invalid value for "created_by", created_by cannot be nil.' + end + @created_by = created_by + end + + # Custom attribute writer method with validation + # @param modified_by [Object] Object to be assigned + # @!visibility private + def modified_by=(modified_by) + if modified_by.nil? + fail ArgumentError, 'invalid value for "modified_by", modified_by cannot be nil.' + end + @modified_by = modified_by + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + change_request_decisions == o.change_request_decisions && + created_by == o.created_by && + modified_by == o.modified_by && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [change_request_decisions, created_by, modified_by, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_resource_type.rb b/lib/datadog_api_client/v2/models/change_request_resource_type.rb new file mode 100644 index 00000000000..cc6760b01c5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_resource_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Change request resource type. + class ChangeRequestResourceType + include BaseEnumModel + + CHANGE_REQUEST = "change_request".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_response.rb b/lib/datadog_api_client/v2/models/change_request_response.rb new file mode 100644 index 00000000000..023ccbfa1e9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_response.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response object for a change request. + class ChangeRequestResponse + include BaseGenericModel + + # Data object for a change request response. + attr_reader :data + + # Included resources related to the change request. + attr_accessor :included + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ChangeRequestResponseData', + :'included' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_response_attributes.rb b/lib/datadog_api_client/v2/models/change_request_response_attributes.rb new file mode 100644 index 00000000000..c8df74db9f1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_response_attributes.rb @@ -0,0 +1,508 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of a change request response. + class ChangeRequestResponseAttributes + include BaseGenericModel + + # Timestamp of when the change request was archived. + attr_accessor :archived_at + + # Custom attributes of the change request as key-value pairs. + attr_reader :attributes + + # The UUID of the linked incident. + attr_reader :change_request_linked_incident_uuid + + # The maintenance window query for the change request. + attr_reader :change_request_maintenance_window_query + + # The plan associated with the change request. + attr_reader :change_request_plan + + # The risk level of the change request. + attr_reader :change_request_risk + + # The type of the change request. + attr_reader :change_request_type + + # Timestamp of when the change request was closed. + attr_accessor :closed_at + + # Timestamp of when the change request was created. + attr_reader :created_at + + # The source from which the change request was created. + attr_reader :creation_source + + # The description of the change request. + attr_reader :description + + # The planned end date of the change request. + attr_accessor :end_date + + # The human-readable key of the change request. + attr_reader :key + + # Timestamp of when the change request was last modified. + attr_reader :modified_at + + # The notebook ID associated with the change request plan. + attr_reader :plan_notebook_id + + # The priority of the change request. + attr_reader :priority + + # The project UUID associated with the change request. + attr_reader :project_id + + # The planned start date of the change request. + attr_accessor :start_date + + # The current status of the change request. + attr_reader :status + + # The title of the change request. + attr_reader :title + + # The case type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'archived_at' => :'archived_at', + :'attributes' => :'attributes', + :'change_request_linked_incident_uuid' => :'change_request_linked_incident_uuid', + :'change_request_maintenance_window_query' => :'change_request_maintenance_window_query', + :'change_request_plan' => :'change_request_plan', + :'change_request_risk' => :'change_request_risk', + :'change_request_type' => :'change_request_type', + :'closed_at' => :'closed_at', + :'created_at' => :'created_at', + :'creation_source' => :'creation_source', + :'description' => :'description', + :'end_date' => :'end_date', + :'key' => :'key', + :'modified_at' => :'modified_at', + :'plan_notebook_id' => :'plan_notebook_id', + :'priority' => :'priority', + :'project_id' => :'project_id', + :'start_date' => :'start_date', + :'status' => :'status', + :'title' => :'title', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'archived_at' => :'Time', + :'attributes' => :'Hash>', + :'change_request_linked_incident_uuid' => :'String', + :'change_request_maintenance_window_query' => :'String', + :'change_request_plan' => :'String', + :'change_request_risk' => :'ChangeRequestRiskLevel', + :'change_request_type' => :'ChangeRequestChangeType', + :'closed_at' => :'Time', + :'created_at' => :'Time', + :'creation_source' => :'String', + :'description' => :'String', + :'end_date' => :'Time', + :'key' => :'String', + :'modified_at' => :'Time', + :'plan_notebook_id' => :'Integer', + :'priority' => :'String', + :'project_id' => :'String', + :'start_date' => :'Time', + :'status' => :'String', + :'title' => :'String', + :'type' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'archived_at', + :'closed_at', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'archived_at') + self.archived_at = attributes[:'archived_at'] + end + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'change_request_linked_incident_uuid') + self.change_request_linked_incident_uuid = attributes[:'change_request_linked_incident_uuid'] + end + + if attributes.key?(:'change_request_maintenance_window_query') + self.change_request_maintenance_window_query = attributes[:'change_request_maintenance_window_query'] + end + + if attributes.key?(:'change_request_plan') + self.change_request_plan = attributes[:'change_request_plan'] + end + + if attributes.key?(:'change_request_risk') + self.change_request_risk = attributes[:'change_request_risk'] + end + + if attributes.key?(:'change_request_type') + self.change_request_type = attributes[:'change_request_type'] + end + + if attributes.key?(:'closed_at') + self.closed_at = attributes[:'closed_at'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'creation_source') + self.creation_source = attributes[:'creation_source'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'end_date') + self.end_date = attributes[:'end_date'] + end + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'modified_at') + self.modified_at = attributes[:'modified_at'] + end + + if attributes.key?(:'plan_notebook_id') + self.plan_notebook_id = attributes[:'plan_notebook_id'] + end + + if attributes.key?(:'priority') + self.priority = attributes[:'priority'] + end + + if attributes.key?(:'project_id') + self.project_id = attributes[:'project_id'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @change_request_linked_incident_uuid.nil? + return false if @change_request_maintenance_window_query.nil? + return false if @change_request_plan.nil? + return false if @change_request_risk.nil? + return false if @change_request_type.nil? + return false if @created_at.nil? + return false if @creation_source.nil? + return false if @description.nil? + return false if @key.nil? + return false if @modified_at.nil? + return false if @plan_notebook_id.nil? + return false if @priority.nil? + return false if @project_id.nil? + return false if @status.nil? + return false if @title.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param change_request_linked_incident_uuid [Object] Object to be assigned + # @!visibility private + def change_request_linked_incident_uuid=(change_request_linked_incident_uuid) + if change_request_linked_incident_uuid.nil? + fail ArgumentError, 'invalid value for "change_request_linked_incident_uuid", change_request_linked_incident_uuid cannot be nil.' + end + @change_request_linked_incident_uuid = change_request_linked_incident_uuid + end + + # Custom attribute writer method with validation + # @param change_request_maintenance_window_query [Object] Object to be assigned + # @!visibility private + def change_request_maintenance_window_query=(change_request_maintenance_window_query) + if change_request_maintenance_window_query.nil? + fail ArgumentError, 'invalid value for "change_request_maintenance_window_query", change_request_maintenance_window_query cannot be nil.' + end + @change_request_maintenance_window_query = change_request_maintenance_window_query + end + + # Custom attribute writer method with validation + # @param change_request_plan [Object] Object to be assigned + # @!visibility private + def change_request_plan=(change_request_plan) + if change_request_plan.nil? + fail ArgumentError, 'invalid value for "change_request_plan", change_request_plan cannot be nil.' + end + @change_request_plan = change_request_plan + end + + # Custom attribute writer method with validation + # @param change_request_risk [Object] Object to be assigned + # @!visibility private + def change_request_risk=(change_request_risk) + if change_request_risk.nil? + fail ArgumentError, 'invalid value for "change_request_risk", change_request_risk cannot be nil.' + end + @change_request_risk = change_request_risk + end + + # Custom attribute writer method with validation + # @param change_request_type [Object] Object to be assigned + # @!visibility private + def change_request_type=(change_request_type) + if change_request_type.nil? + fail ArgumentError, 'invalid value for "change_request_type", change_request_type cannot be nil.' + end + @change_request_type = change_request_type + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param creation_source [Object] Object to be assigned + # @!visibility private + def creation_source=(creation_source) + if creation_source.nil? + fail ArgumentError, 'invalid value for "creation_source", creation_source cannot be nil.' + end + @creation_source = creation_source + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if description.nil? + fail ArgumentError, 'invalid value for "description", description cannot be nil.' + end + @description = description + end + + # Custom attribute writer method with validation + # @param key [Object] Object to be assigned + # @!visibility private + def key=(key) + if key.nil? + fail ArgumentError, 'invalid value for "key", key cannot be nil.' + end + @key = key + end + + # Custom attribute writer method with validation + # @param modified_at [Object] Object to be assigned + # @!visibility private + def modified_at=(modified_at) + if modified_at.nil? + fail ArgumentError, 'invalid value for "modified_at", modified_at cannot be nil.' + end + @modified_at = modified_at + end + + # Custom attribute writer method with validation + # @param plan_notebook_id [Object] Object to be assigned + # @!visibility private + def plan_notebook_id=(plan_notebook_id) + if plan_notebook_id.nil? + fail ArgumentError, 'invalid value for "plan_notebook_id", plan_notebook_id cannot be nil.' + end + @plan_notebook_id = plan_notebook_id + end + + # Custom attribute writer method with validation + # @param priority [Object] Object to be assigned + # @!visibility private + def priority=(priority) + if priority.nil? + fail ArgumentError, 'invalid value for "priority", priority cannot be nil.' + end + @priority = priority + end + + # Custom attribute writer method with validation + # @param project_id [Object] Object to be assigned + # @!visibility private + def project_id=(project_id) + if project_id.nil? + fail ArgumentError, 'invalid value for "project_id", project_id cannot be nil.' + end + @project_id = project_id + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Custom attribute writer method with validation + # @param title [Object] Object to be assigned + # @!visibility private + def title=(title) + if title.nil? + fail ArgumentError, 'invalid value for "title", title cannot be nil.' + end + @title = title + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + archived_at == o.archived_at && + attributes == o.attributes && + change_request_linked_incident_uuid == o.change_request_linked_incident_uuid && + change_request_maintenance_window_query == o.change_request_maintenance_window_query && + change_request_plan == o.change_request_plan && + change_request_risk == o.change_request_risk && + change_request_type == o.change_request_type && + closed_at == o.closed_at && + created_at == o.created_at && + creation_source == o.creation_source && + description == o.description && + end_date == o.end_date && + key == o.key && + modified_at == o.modified_at && + plan_notebook_id == o.plan_notebook_id && + priority == o.priority && + project_id == o.project_id && + start_date == o.start_date && + status == o.status && + title == o.title && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [archived_at, attributes, change_request_linked_incident_uuid, change_request_maintenance_window_query, change_request_plan, change_request_risk, change_request_type, closed_at, created_at, creation_source, description, end_date, key, modified_at, plan_notebook_id, priority, project_id, start_date, status, title, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_response_data.rb b/lib/datadog_api_client/v2/models/change_request_response_data.rb new file mode 100644 index 00000000000..1df867281ac --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_response_data.rb @@ -0,0 +1,175 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data object for a change request response. + class ChangeRequestResponseData + include BaseGenericModel + + # Attributes of a change request response. + attr_reader :attributes + + # The identifier of the change request. + attr_reader :id + + # Relationships of a change request. + attr_accessor :relationships + + # Change request resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ChangeRequestResponseAttributes', + :'id' => :'String', + :'relationships' => :'ChangeRequestRelationships', + :'type' => :'ChangeRequestResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_risk_level.rb b/lib/datadog_api_client/v2/models/change_request_risk_level.rb new file mode 100644 index 00000000000..939cf42b5bb --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_risk_level.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The risk level of the change request. + class ChangeRequestRiskLevel + include BaseEnumModel + + UNDEFINED = "UNDEFINED".freeze + LOW = "LOW".freeze + MEDIUM = "MEDIUM".freeze + HIGH = "HIGH".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_update_attributes.rb b/lib/datadog_api_client/v2/models/change_request_update_attributes.rb new file mode 100644 index 00000000000..83349c0db21 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_update_attributes.rb @@ -0,0 +1,155 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes for updating a change request. + class ChangeRequestUpdateAttributes + include BaseGenericModel + + # The plan associated with the change request. + attr_accessor :change_request_plan + + # The risk level of the change request. + attr_accessor :change_request_risk + + # The type of the change request. + attr_accessor :change_request_type + + # The planned end date of the change request. + attr_accessor :end_date + + # The identifier of the change request to update. + attr_accessor :id + + # The planned start date of the change request. + attr_accessor :start_date + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'change_request_plan' => :'change_request_plan', + :'change_request_risk' => :'change_request_risk', + :'change_request_type' => :'change_request_type', + :'end_date' => :'end_date', + :'id' => :'id', + :'start_date' => :'start_date' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'change_request_plan' => :'String', + :'change_request_risk' => :'ChangeRequestRiskLevel', + :'change_request_type' => :'ChangeRequestChangeType', + :'end_date' => :'Time', + :'id' => :'String', + :'start_date' => :'Time' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestUpdateAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'change_request_plan') + self.change_request_plan = attributes[:'change_request_plan'] + end + + if attributes.key?(:'change_request_risk') + self.change_request_risk = attributes[:'change_request_risk'] + end + + if attributes.key?(:'change_request_type') + self.change_request_type = attributes[:'change_request_type'] + end + + if attributes.key?(:'end_date') + self.end_date = attributes[:'end_date'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'start_date') + self.start_date = attributes[:'start_date'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + change_request_plan == o.change_request_plan && + change_request_risk == o.change_request_risk && + change_request_type == o.change_request_type && + end_date == o.end_date && + id == o.id && + start_date == o.start_date && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [change_request_plan, change_request_risk, change_request_type, end_date, id, start_date, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_update_data.rb b/lib/datadog_api_client/v2/models/change_request_update_data.rb new file mode 100644 index 00000000000..b053b90e1bb --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_update_data.rb @@ -0,0 +1,143 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data object to update a change request. + class ChangeRequestUpdateData + include BaseGenericModel + + # Attributes for updating a change request. + attr_accessor :attributes + + # Relationships for updating a change request. + attr_accessor :relationships + + # Change request resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ChangeRequestUpdateAttributes', + :'relationships' => :'ChangeRequestUpdateRelationships', + :'type' => :'ChangeRequestResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestUpdateData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_update_relationships.rb b/lib/datadog_api_client/v2/models/change_request_update_relationships.rb new file mode 100644 index 00000000000..a613369d6db --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_update_relationships.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationships for updating a change request. + class ChangeRequestUpdateRelationships + include BaseGenericModel + + # Relationship to change request decisions. + attr_accessor :change_request_decisions + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'change_request_decisions' => :'change_request_decisions' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'change_request_decisions' => :'ChangeRequestDecisionsRelationship' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestUpdateRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'change_request_decisions') + self.change_request_decisions = attributes[:'change_request_decisions'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + change_request_decisions == o.change_request_decisions && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [change_request_decisions, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_update_request.rb b/lib/datadog_api_client/v2/models/change_request_update_request.rb new file mode 100644 index 00000000000..8e3bafd4cf4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_update_request.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request object to update a change request. + class ChangeRequestUpdateRequest + include BaseGenericModel + + # Data object to update a change request. + attr_reader :data + + # Included resources for the change request update. + attr_accessor :included + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ChangeRequestUpdateData', + :'included' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_user_relationship.rb b/lib/datadog_api_client/v2/models/change_request_user_relationship.rb new file mode 100644 index 00000000000..efe7030658e --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_user_relationship.rb @@ -0,0 +1,113 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationship to a user. + class ChangeRequestUserRelationship + include BaseGenericModel + + # User relationship data. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ChangeRequestUserRelationshipData' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'data', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestUserRelationship` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/change_request_user_relationship_data.rb b/lib/datadog_api_client/v2/models/change_request_user_relationship_data.rb new file mode 100644 index 00000000000..fc5303d6b3e --- /dev/null +++ b/lib/datadog_api_client/v2/models/change_request_user_relationship_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # User relationship data. + class ChangeRequestUserRelationshipData + include BaseGenericModel + + # The user UUID. + attr_reader :id + + # The user resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ChangeRequestUserRelationshipData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end