diff --git a/.apigentools-info b/.apigentools-info index 58998a259df9..0c486fbbb5f7 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-03-05 14:38:28.313596", - "spec_repo_commit": "0c376cca" + "regenerated": "2025-03-05 15:55:07.219977", + "spec_repo_commit": "fe5af5dc" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-03-05 14:38:28.329295", - "spec_repo_commit": "0c376cca" + "regenerated": "2025-03-05 15:55:07.235503", + "spec_repo_commit": "fe5af5dc" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 35f18bce723f..9f21c1aa9db2 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -554,6 +554,14 @@ components: required: false schema: type: string + OnDemandTaskId: + description: The UUID of the task. + example: 6d09294c-9ad9-42fd-a759-a0c1599b4828 + in: path + name: task_id + required: true + schema: + type: string OpsgenieServiceIDPathParameter: description: The UUID of the service. in: path @@ -1750,10 +1758,6 @@ components: type: string type: array type: object - AccountId: - description: The ID of the AWS account. - example: '184366314700' - type: string ActionConnectionAttributes: description: The definition of `ActionConnectionAttributes` object. properties: @@ -3093,7 +3097,7 @@ components: x-enum-varnames: - AUTHN_MAPPINGS AwsAccountId: - description: The ID of an AWS account. + description: The ID of the AWS account. example: '123456789012' type: string AwsCURConfig: @@ -3300,6 +3304,100 @@ components: $ref: '#/components/schemas/AwsCURConfig' type: array type: object + AwsOnDemandAttributes: + description: Attributes for the AWS on demand task. + properties: + arn: + description: The arn of the resource to scan. + example: arn:aws:ec2:us-east-1:727000456123:instance/i-0eabb50529b67a1ba + type: string + assigned_at: + description: Specifies the assignment timestamp if the task has been already + assigned to a scanner. + example: '2025-02-11T18:25:04.550564Z' + type: string + created_at: + description: The task submission timestamp. + example: '2025-02-11T18:13:24.576915Z' + type: string + status: + description: 'Indicates the status of the task. + + QUEUED: the task has been submitted successfully and the resource has + not been assigned to a scanner yet. + + ASSIGNED: the task has been assigned. + + ABORTED: the scan has been aborted after a period of time due to technical + reasons, such as resource not found, insufficient permissions, or the + absence of a configured scanner.' + example: QUEUED + type: string + type: object + AwsOnDemandCreateAttributes: + description: Attributes for the AWS on demand task. + properties: + arn: + description: The arn of the resource to scan. Agentless supports the scan + of EC2 instances, lambda functions, AMI, ECR, RDS and S3 buckets. + example: arn:aws:ec2:us-east-1:727000456123:instance/i-0eabb50529b67a1ba + type: string + type: object + AwsOnDemandCreateData: + description: Object for a single AWS on demand task. + properties: + attributes: + $ref: '#/components/schemas/AwsOnDemandCreateAttributes' + type: + $ref: '#/components/schemas/AwsOnDemandType' + required: + - type + - attributes + type: object + AwsOnDemandCreateRequest: + description: Request object that includes the on demand task to submit. + properties: + data: + $ref: '#/components/schemas/AwsOnDemandCreateData' + required: + - data + type: object + AwsOnDemandData: + description: Single AWS on demand task. + properties: + attributes: + $ref: '#/components/schemas/AwsOnDemandAttributes' + id: + description: The UUID of the task. + example: 6d09294c-9ad9-42fd-a759-a0c1599b4828 + type: string + type: + $ref: '#/components/schemas/AwsOnDemandType' + type: object + AwsOnDemandListResponse: + description: Response object that includes a list of AWS on demand tasks. + properties: + data: + description: A list of on demand tasks. + items: + $ref: '#/components/schemas/AwsOnDemandData' + type: array + type: object + AwsOnDemandResponse: + description: Response object that includes an AWS on demand task. + properties: + data: + $ref: '#/components/schemas/AwsOnDemandData' + type: object + AwsOnDemandType: + default: aws_resource + description: The type of the on demand task. The value should always be `aws_resource`. + enum: + - aws_resource + example: aws_resource + type: string + x-enum-varnames: + - AWS_RESOURCE AwsScanOptionsAttributes: description: Attributes for the AWS scan options. properties: @@ -3321,19 +3419,40 @@ components: example: true type: boolean type: object + AwsScanOptionsCreateAttributes: + description: Attributes for the AWS scan options to create. + properties: + lambda: + description: Indicates if scanning of Lambda functions is enabled. + example: true + type: boolean + sensitive_data: + description: Indicates if scanning for sensitive data is enabled. + example: false + type: boolean + vuln_containers_os: + description: Indicates if scanning for vulnerabilities in containers is + enabled. + example: true + type: boolean + vuln_host_os: + description: Indicates if scanning for vulnerabilities in hosts is enabled. + example: true + type: boolean + type: object AwsScanOptionsCreateData: description: Object for the scan options of a single AWS account. properties: attributes: - $ref: '#/components/schemas/AwsScanOptionsAttributes' + $ref: '#/components/schemas/AwsScanOptionsCreateAttributes' id: $ref: '#/components/schemas/AwsAccountId' type: $ref: '#/components/schemas/AwsScanOptionsType' required: - id - - attributes - type + - attributes type: object AwsScanOptionsCreateRequest: description: Request object that includes the scan options to create. @@ -3406,12 +3525,13 @@ components: attributes: $ref: '#/components/schemas/AwsScanOptionsUpdateAttributes' id: - $ref: '#/components/schemas/AccountId' + $ref: '#/components/schemas/AwsAccountId' type: $ref: '#/components/schemas/AwsScanOptionsType' required: - - attributes + - id - type + - attributes type: object AwsScanOptionsUpdateRequest: description: Request object that includes the scan options to update. @@ -33059,6 +33179,87 @@ paths: tags: - Agentless Scanning x-codegen-request-body-name: body + /api/v2/agentless_scanning/ondemand/aws: + get: + description: Fetches the most recent 1000 AWS on demand tasks. + operationId: ListAwsOnDemandTasks + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AwsOnDemandListResponse' + description: OK + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get AWS On Demand tasks + tags: + - Agentless Scanning + x-permission: + operator: OR + permissions: + - security_monitoring_findings_read + post: + description: Trigger the scan of an AWS resource with a high priority. + operationId: CreateAwsOnDemandTask + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AwsOnDemandCreateRequest' + description: The definition of the on demand task. + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/AwsOnDemandResponse' + description: AWS on demand task created successfully. + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Post an AWS on demand task + tags: + - Agentless Scanning + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - security_monitoring_findings_write + /api/v2/agentless_scanning/ondemand/aws/{task_id}: + get: + description: Fetch the data of a specific on demand task. + operationId: RetrieveAwsOnDemandTask + parameters: + - $ref: '#/components/parameters/OnDemandTaskId' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AwsOnDemandResponse' + description: OK. + '400': + $ref: '#/components/responses/BadRequestResponse' + '403': + $ref: '#/components/responses/NotAuthorizedResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get AWS On Demand task by id + tags: + - Agentless Scanning + x-permission: + operator: OR + permissions: + - security_monitoring_findings_read /api/v2/api_keys: get: description: List all API keys available for your account. diff --git a/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-Bad-Request-response.frozen b/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..4f8c861ebd51 --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-03-05T15:30:08.481Z \ No newline at end of file diff --git a/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-Bad-Request-response.yml b/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..a91a02b78aee --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-Bad-Request-response.yml @@ -0,0 +1,21 @@ +http_interactions: +- recorded_at: Wed, 05 Mar 2025 15:30:08 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/agentless_scanning/ondemand/aws/invalid-uuid + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"missing or invalid url + parameter ''taskId'', expected uuid format ''6d09294c-9ad9-42fd-a759-a0c1599b4843''"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-Not-Found-response.frozen b/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..53f971f7cdad --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2025-03-05T15:30:08.801Z \ No newline at end of file diff --git a/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-Not-Found-response.yml b/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-Not-Found-response.yml new file mode 100644 index 000000000000..9ec2e290f08e --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-Not-Found-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Wed, 05 Mar 2025 15:30:08 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/agentless_scanning/ondemand/aws/00000000-0000-0000-824a-000000000000 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"404","detail":"no task found with id ''00000000-0000-0000-824a-000000000000''"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-OK-response.frozen b/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-OK-response.frozen new file mode 100644 index 000000000000..aef71dff70d3 --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-03-05T15:30:08.891Z \ No newline at end of file diff --git a/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-OK-response.yml b/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-OK-response.yml new file mode 100644 index 000000000000..fb1f6449ac03 --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-task-by-id-returns-OK-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Wed, 05 Mar 2025 15:30:08 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/agentless_scanning/ondemand/aws/63d6b4f5-e5d0-4d90-824a-9580f05f026a + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"63d6b4f5-e5d0-4d90-824a-9580f05f026a","type":"aws_resource","attributes":{"arn":"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test","created_at":"2025-03-05T14:24:46.915915Z","status":"QUEUED"}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-tasks-returns-OK-response.frozen b/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-tasks-returns-OK-response.frozen new file mode 100644 index 000000000000..80426ffe120e --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-tasks-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-03-05T15:30:08.978Z \ No newline at end of file diff --git a/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-tasks-returns-OK-response.yml b/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-tasks-returns-OK-response.yml new file mode 100644 index 000000000000..b036a720bd68 --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/Get-AWS-On-Demand-tasks-returns-OK-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Wed, 05 Mar 2025 15:30:08 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/agentless_scanning/ondemand/aws + response: + body: + encoding: UTF-8 + string: '{"data":[{"id":"32ee93e6-7433-4d86-9693-be88093efa77","type":"aws_resource","attributes":{"arn":"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test","created_at":"2025-03-05T15:25:35.357991Z","status":"QUEUED"}},{"id":"82b9e788-43d3-45da-a2a9-8f538436fed3","type":"aws_resource","attributes":{"arn":"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test","created_at":"2025-03-05T15:15:23.375332Z","status":"QUEUED"}},{"id":"63d6b4f5-e5d0-4d90-824a-9580f05f026a","type":"aws_resource","attributes":{"arn":"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test","created_at":"2025-03-05T14:24:46.915915Z","status":"QUEUED"}},{"id":"2c72b302-df17-47e7-9b00-3bf4e0223dc3","type":"aws_resource","attributes":{"arn":"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test","created_at":"2025-03-05T14:24:14.313176Z","status":"QUEUED"}},{"id":"abc87e8d-b450-4141-b596-8bf1a3883c56","type":"aws_resource","attributes":{"arn":"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test","created_at":"2025-03-05T14:22:17.132833Z","status":"QUEUED"}},{"id":"fbee88e3-f898-4d73-8da8-f19500efd081","type":"aws_resource","attributes":{"arn":"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test","created_at":"2025-03-05T14:08:01.876649Z","status":"QUEUED"}},{"id":"ed30acf1-731e-410c-8559-53c290bd37f5","type":"aws_resource","attributes":{"arn":"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test","created_at":"2025-03-05T14:06:43.435923Z","status":"QUEUED"}}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/agentless_scanning/Post-an-AWS-on-demand-task-returns-AWS-on-demand-task-created-successfully-response.frozen b/cassettes/features/v2/agentless_scanning/Post-an-AWS-on-demand-task-returns-AWS-on-demand-task-created-successfully-response.frozen new file mode 100644 index 000000000000..28fd0505ba61 --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/Post-an-AWS-on-demand-task-returns-AWS-on-demand-task-created-successfully-response.frozen @@ -0,0 +1 @@ +2025-03-05T15:30:09.058Z \ No newline at end of file diff --git a/cassettes/features/v2/agentless_scanning/Post-an-AWS-on-demand-task-returns-AWS-on-demand-task-created-successfully-response.yml b/cassettes/features/v2/agentless_scanning/Post-an-AWS-on-demand-task-returns-AWS-on-demand-task-created-successfully-response.yml new file mode 100644 index 000000000000..e4f67695aa1f --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/Post-an-AWS-on-demand-task-returns-AWS-on-demand-task-created-successfully-response.yml @@ -0,0 +1,24 @@ +http_interactions: +- recorded_at: Wed, 05 Mar 2025 15:30:09 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"arn":"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test"},"type":"aws_resource"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/agentless_scanning/ondemand/aws + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"aaa12247-2b39-4b70-a2fd-a804840e17f5","type":"aws_resource","attributes":{"arn":"arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test","created_at":"2025-03-05T15:30:09.129732Z","status":"QUEUED"}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/agentless_scanning/Post-an-AWS-on-demand-task-returns-Bad-Request-response.frozen b/cassettes/features/v2/agentless_scanning/Post-an-AWS-on-demand-task-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..cb96998facd0 --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/Post-an-AWS-on-demand-task-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-03-05T15:30:09.154Z \ No newline at end of file diff --git a/cassettes/features/v2/agentless_scanning/Post-an-AWS-on-demand-task-returns-Bad-Request-response.yml b/cassettes/features/v2/agentless_scanning/Post-an-AWS-on-demand-task-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..ca6c0ac39add --- /dev/null +++ b/cassettes/features/v2/agentless_scanning/Post-an-AWS-on-demand-task-returns-Bad-Request-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Wed, 05 Mar 2025 15:30:09 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"arn":"invalid-arn"},"type":"aws_resource"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/agentless_scanning/ondemand/aws + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"invalid aws resource + arn"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/examples/v2/agentless-scanning/CreateAwsOnDemandTask.rb b/examples/v2/agentless-scanning/CreateAwsOnDemandTask.rb new file mode 100644 index 000000000000..e841e98b4023 --- /dev/null +++ b/examples/v2/agentless-scanning/CreateAwsOnDemandTask.rb @@ -0,0 +1,14 @@ +# Post an AWS on demand task returns "AWS on demand task created successfully." response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::AgentlessScanningAPI.new + +body = DatadogAPIClient::V2::AwsOnDemandCreateRequest.new({ + data: DatadogAPIClient::V2::AwsOnDemandCreateData.new({ + attributes: DatadogAPIClient::V2::AwsOnDemandCreateAttributes.new({ + arn: "arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test", + }), + type: DatadogAPIClient::V2::AwsOnDemandType::AWS_RESOURCE, + }), +}) +p api_instance.create_aws_on_demand_task(body) diff --git a/examples/v2/agentless-scanning/CreateAwsScanOptions.rb b/examples/v2/agentless-scanning/CreateAwsScanOptions.rb index af9ce53b1a3c..b5f9465d714a 100644 --- a/examples/v2/agentless-scanning/CreateAwsScanOptions.rb +++ b/examples/v2/agentless-scanning/CreateAwsScanOptions.rb @@ -7,7 +7,7 @@ data: DatadogAPIClient::V2::AwsScanOptionsCreateData.new({ id: "000000000003", type: DatadogAPIClient::V2::AwsScanOptionsType::AWS_SCAN_OPTIONS, - attributes: DatadogAPIClient::V2::AwsScanOptionsAttributes.new({ + attributes: DatadogAPIClient::V2::AwsScanOptionsCreateAttributes.new({ lambda: true, sensitive_data: false, vuln_containers_os: true, diff --git a/examples/v2/agentless-scanning/ListAwsOnDemandTasks.rb b/examples/v2/agentless-scanning/ListAwsOnDemandTasks.rb new file mode 100644 index 000000000000..4f9af9f0dd35 --- /dev/null +++ b/examples/v2/agentless-scanning/ListAwsOnDemandTasks.rb @@ -0,0 +1,5 @@ +# Get AWS On Demand tasks returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::AgentlessScanningAPI.new +p api_instance.list_aws_on_demand_tasks() diff --git a/examples/v2/agentless-scanning/RetrieveAwsOnDemandTask.rb b/examples/v2/agentless-scanning/RetrieveAwsOnDemandTask.rb new file mode 100644 index 000000000000..20949752e382 --- /dev/null +++ b/examples/v2/agentless-scanning/RetrieveAwsOnDemandTask.rb @@ -0,0 +1,5 @@ +# Get AWS On Demand task by id returns "OK." response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::AgentlessScanningAPI.new +p api_instance.retrieve_aws_on_demand_task("63d6b4f5-e5d0-4d90-824a-9580f05f026a") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index e112c0067c0a..9516bb51deb3 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -850,6 +850,12 @@ "account_id" => "String", "body" => "AwsScanOptionsUpdateRequest", }, + "v2.CreateAwsOnDemandTask" => { + "body" => "AwsOnDemandCreateRequest", + }, + "v2.RetrieveAwsOnDemandTask" => { + "task_id" => "String", + }, "v2.ListAPIKeys" => { "page_size" => "Integer", "page_number" => "Integer", diff --git a/features/v2/agentless_scanning.feature b/features/v2/agentless_scanning.feature index 2152f1335266..28723bdadfe6 100644 --- a/features/v2/agentless_scanning.feature +++ b/features/v2/agentless_scanning.feature @@ -11,41 +11,70 @@ Feature: Agentless Scanning And a valid "appKeyAuth" key in the system And an instance of "AgentlessScanning" API - @team:DataDog/k9-cloud-security-platform + @team:DataDog/k9-agentless Scenario: Delete AWS Scan Options returns "Bad Request" response Given new "DeleteAwsScanOptions" request And request contains "account_id" parameter with value "incorrectId" When the request is sent Then the response status is 400 Bad Request - @generated @skip @team:DataDog/k9-cloud-security-platform + @generated @skip @team:DataDog/k9-agentless Scenario: Delete AWS Scan Options returns "No Content" response Given new "DeleteAwsScanOptions" request And request contains "account_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 204 No Content - @team:DataDog/k9-cloud-security-platform + @team:DataDog/k9-agentless Scenario: Delete AWS Scan Options returns "Not Found" response Given new "DeleteAwsScanOptions" request And request contains "account_id" parameter with value "000000000005" When the request is sent Then the response status is 404 Not Found - @team:DataDog/k9-cloud-security-platform + @team:DataDog/k9-agentless + Scenario: Get AWS On Demand task by id returns "Bad Request" response + Given new "RetrieveAwsOnDemandTask" request + And request contains "task_id" parameter with value "invalid-uuid" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-agentless + Scenario: Get AWS On Demand task by id returns "Not Found" response + Given new "RetrieveAwsOnDemandTask" request + And request contains "task_id" parameter with value "00000000-0000-0000-824a-000000000000" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/k9-agentless + Scenario: Get AWS On Demand task by id returns "OK." response + Given new "RetrieveAwsOnDemandTask" request + And request contains "task_id" parameter with value "63d6b4f5-e5d0-4d90-824a-9580f05f026a" + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.arn" is equal to "arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test" + + @team:DataDog/k9-agentless + Scenario: Get AWS On Demand tasks returns "OK" response + Given new "ListAwsOnDemandTasks" request + When the request is sent + Then the response status is 200 OK + And the response "data[0].type" is equal to "aws_resource" + + @team:DataDog/k9-agentless Scenario: Get AWS Scan Options returns "OK" response Given new "ListAwsScanOptions" request When the request is sent Then the response status is 200 OK - @skip @team:DataDog/k9-cloud-security-platform + @skip @team:DataDog/k9-agentless Scenario: Patch AWS Scan Options returns "Bad Request" response Given new "UpdateAwsScanOptions" request And request contains "account_id" parameter with value "000000000003" When the request is sent Then the response status is 400 Bad Request - @team:DataDog/k9-cloud-security-platform + @team:DataDog/k9-agentless Scenario: Patch AWS Scan Options returns "Bad Request" response 2 Given new "UpdateAwsScanOptions" request And request contains "account_id" parameter with value "000000000003" @@ -53,7 +82,7 @@ Feature: Agentless Scanning When the request is sent Then the response status is 400 Bad Request - @team:DataDog/k9-cloud-security-platform + @team:DataDog/k9-agentless Scenario: Patch AWS Scan Options returns "No Content" response Given new "UpdateAwsScanOptions" request And request contains "account_id" parameter with value "000000000002" @@ -61,7 +90,7 @@ Feature: Agentless Scanning When the request is sent Then the response status is 204 No Content - @team:DataDog/k9-cloud-security-platform + @team:DataDog/k9-agentless Scenario: Patch AWS Scan Options returns "Not Found" response Given new "UpdateAwsScanOptions" request And request contains "account_id" parameter with value "000000000005" @@ -69,23 +98,39 @@ Feature: Agentless Scanning When the request is sent Then the response status is 404 Not Found - @skip @team:DataDog/k9-cloud-security-platform + @skip @team:DataDog/k9-agentless Scenario: Post AWS Scan Options returns "Agentless scan options enabled successfully." response Given new "CreateAwsScanOptions" request And body with value {"data": {"id": "000000000003", "type": "aws_scan_options", "attributes": {"lambda": true, "sensitive_data": false, "vuln_containers_os": true, "vuln_host_os": true}}} When the request is sent Then the response status is 201 Created - @team:DataDog/k9-cloud-security-platform + @team:DataDog/k9-agentless Scenario: Post AWS Scan Options returns "Bad Request" response Given new "CreateAwsScanOptions" request And body with value {"data": {"id": "123", "type": "aws_scan_options", "attributes": {"lambda": true, "sensitive_data": false, "vuln_containers_os": true, "vuln_host_os": true}}} When the request is sent Then the response status is 400 Bad Request - @team:DataDog/k9-cloud-security-platform + @team:DataDog/k9-agentless Scenario: Post AWS Scan Options returns "Conflict" response Given new "CreateAwsScanOptions" request And body with value {"data":{"type":"aws_scan_options","id":"000000000002","attributes":{"vuln_host_os":true,"vuln_containers_os":true,"lambda":false}}} When the request is sent Then the response status is 409 Conflict + + @team:DataDog/k9-agentless + Scenario: Post an AWS on demand task returns "AWS on demand task created successfully." response + Given new "CreateAwsOnDemandTask" request + And body with value {"data": {"attributes": {"arn": "arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test"}, "type": "aws_resource"}} + When the request is sent + Then the response status is 201 AWS on demand task created successfully + And the response "data.attributes.arn" is equal to "arn:aws:lambda:eu-west-3:376334461865:function:This-Is-An-Api-Spec-Test" + And the response "data.attributes.status" is equal to "QUEUED" + + @team:DataDog/k9-agentless + Scenario: Post an AWS on demand task returns "Bad Request" response + Given new "CreateAwsOnDemandTask" request + And body with value {"data": {"attributes": {"arn": "invalid-arn"}, "type": "aws_resource"}} + When the request is sent + Then the response status is 400 Bad Request diff --git a/features/v2/undo.json b/features/v2/undo.json index c54fe630b561..35fcbc9803e6 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -61,6 +61,24 @@ "type": "idempotent" } }, + "ListAwsOnDemandTasks": { + "tag": "Agentless Scanning", + "undo": { + "type": "safe" + } + }, + "CreateAwsOnDemandTask": { + "tag": "Agentless Scanning", + "undo": { + "type": "idempotent" + } + }, + "RetrieveAwsOnDemandTask": { + "tag": "Agentless Scanning", + "undo": { + "type": "safe" + } + }, "ListAPIKeys": { "tag": "Key Management", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 6bbf445470fc..3824dcd67841 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1095,11 +1095,20 @@ def overrides "v2.aws_new_external_id_response_attributes" => "AWSNewExternalIDResponseAttributes", "v2.aws_new_external_id_response_data" => "AWSNewExternalIDResponseData", "v2.aws_new_external_id_response_data_type" => "AWSNewExternalIDResponseDataType", + "v2.aws_on_demand_attributes" => "AwsOnDemandAttributes", + "v2.aws_on_demand_create_attributes" => "AwsOnDemandCreateAttributes", + "v2.aws_on_demand_create_data" => "AwsOnDemandCreateData", + "v2.aws_on_demand_create_request" => "AwsOnDemandCreateRequest", + "v2.aws_on_demand_data" => "AwsOnDemandData", + "v2.aws_on_demand_list_response" => "AwsOnDemandListResponse", + "v2.aws_on_demand_response" => "AwsOnDemandResponse", + "v2.aws_on_demand_type" => "AwsOnDemandType", "v2.aws_regions" => "AWSRegions", "v2.aws_regions_include_all" => "AWSRegionsIncludeAll", "v2.aws_regions_include_only" => "AWSRegionsIncludeOnly", "v2.aws_resources_config" => "AWSResourcesConfig", "v2.aws_scan_options_attributes" => "AwsScanOptionsAttributes", + "v2.aws_scan_options_create_attributes" => "AwsScanOptionsCreateAttributes", "v2.aws_scan_options_create_data" => "AwsScanOptionsCreateData", "v2.aws_scan_options_create_request" => "AwsScanOptionsCreateRequest", "v2.aws_scan_options_data" => "AwsScanOptionsData", diff --git a/lib/datadog_api_client/v2/api/agentless_scanning_api.rb b/lib/datadog_api_client/v2/api/agentless_scanning_api.rb index 831d197096b3..d8b0dcb27057 100644 --- a/lib/datadog_api_client/v2/api/agentless_scanning_api.rb +++ b/lib/datadog_api_client/v2/api/agentless_scanning_api.rb @@ -23,6 +23,73 @@ def initialize(api_client = DatadogAPIClient::APIClient.default) @api_client = api_client end + # Post an AWS on demand task. + # + # @see #create_aws_on_demand_task_with_http_info + def create_aws_on_demand_task(body, opts = {}) + data, _status_code, _headers = create_aws_on_demand_task_with_http_info(body, opts) + data + end + + # Post an AWS on demand task. + # + # Trigger the scan of an AWS resource with a high priority. + # + # @param body [AwsOnDemandCreateRequest] The definition of the on demand task. + # @param opts [Hash] the optional parameters + # @return [Array<(AwsOnDemandResponse, Integer, Hash)>] AwsOnDemandResponse data, response status code and response headers + def create_aws_on_demand_task_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AgentlessScanningAPI.create_aws_on_demand_task ...' + 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 AgentlessScanningAPI.create_aws_on_demand_task" + end + # resource path + local_var_path = '/api/v2/agentless_scanning/ondemand/aws' + + # 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] || 'AwsOnDemandResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_aws_on_demand_task, + :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: AgentlessScanningAPI#create_aws_on_demand_task\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Post AWS Scan Options. # # @see #create_aws_scan_options_with_http_info @@ -155,6 +222,66 @@ def delete_aws_scan_options_with_http_info(account_id, opts = {}) return data, status_code, headers end + # Get AWS On Demand tasks. + # + # @see #list_aws_on_demand_tasks_with_http_info + def list_aws_on_demand_tasks(opts = {}) + data, _status_code, _headers = list_aws_on_demand_tasks_with_http_info(opts) + data + end + + # Get AWS On Demand tasks. + # + # Fetches the most recent 1000 AWS on demand tasks. + # + # @param opts [Hash] the optional parameters + # @return [Array<(AwsOnDemandListResponse, Integer, Hash)>] AwsOnDemandListResponse data, response status code and response headers + def list_aws_on_demand_tasks_with_http_info(opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AgentlessScanningAPI.list_aws_on_demand_tasks ...' + end + # resource path + local_var_path = '/api/v2/agentless_scanning/ondemand/aws' + + # 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] || 'AwsOnDemandListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_aws_on_demand_tasks, + :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: AgentlessScanningAPI#list_aws_on_demand_tasks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get AWS Scan Options. # # @see #list_aws_scan_options_with_http_info @@ -215,6 +342,71 @@ def list_aws_scan_options_with_http_info(opts = {}) return data, status_code, headers end + # Get AWS On Demand task by id. + # + # @see #retrieve_aws_on_demand_task_with_http_info + def retrieve_aws_on_demand_task(task_id, opts = {}) + data, _status_code, _headers = retrieve_aws_on_demand_task_with_http_info(task_id, opts) + data + end + + # Get AWS On Demand task by id. + # + # Fetch the data of a specific on demand task. + # + # @param task_id [String] The UUID of the task. + # @param opts [Hash] the optional parameters + # @return [Array<(AwsOnDemandResponse, Integer, Hash)>] AwsOnDemandResponse data, response status code and response headers + def retrieve_aws_on_demand_task_with_http_info(task_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AgentlessScanningAPI.retrieve_aws_on_demand_task ...' + end + # verify the required parameter 'task_id' is set + if @api_client.config.client_side_validation && task_id.nil? + fail ArgumentError, "Missing the required parameter 'task_id' when calling AgentlessScanningAPI.retrieve_aws_on_demand_task" + end + # resource path + local_var_path = '/api/v2/agentless_scanning/ondemand/aws/{task_id}'.sub('{task_id}', CGI.escape(task_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] || 'AwsOnDemandResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :retrieve_aws_on_demand_task, + :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: AgentlessScanningAPI#retrieve_aws_on_demand_task\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Patch AWS Scan Options. # # @see #update_aws_scan_options_with_http_info diff --git a/lib/datadog_api_client/v2/models/aws_on_demand_attributes.rb b/lib/datadog_api_client/v2/models/aws_on_demand_attributes.rb new file mode 100644 index 000000000000..5cd698941a71 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_on_demand_attributes.rb @@ -0,0 +1,138 @@ +=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 the AWS on demand task. + class AwsOnDemandAttributes + include BaseGenericModel + + # The arn of the resource to scan. + attr_accessor :arn + + # Specifies the assignment timestamp if the task has been already assigned to a scanner. + attr_accessor :assigned_at + + # The task submission timestamp. + attr_accessor :created_at + + # Indicates the status of the task. + # QUEUED: the task has been submitted successfully and the resource has not been assigned to a scanner yet. + # ASSIGNED: the task has been assigned. + # ABORTED: the scan has been aborted after a period of time due to technical reasons, such as resource not found, insufficient permissions, or the absence of a configured scanner. + attr_accessor :status + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'arn' => :'arn', + :'assigned_at' => :'assigned_at', + :'created_at' => :'created_at', + :'status' => :'status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'arn' => :'String', + :'assigned_at' => :'String', + :'created_at' => :'String', + :'status' => :'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::AwsOnDemandAttributes` 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?(:'arn') + self.arn = attributes[:'arn'] + end + + if attributes.key?(:'assigned_at') + self.assigned_at = attributes[:'assigned_at'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + 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 && + arn == o.arn && + assigned_at == o.assigned_at && + created_at == o.created_at && + status == o.status && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [arn, assigned_at, created_at, status, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_on_demand_create_attributes.rb b/lib/datadog_api_client/v2/models/aws_on_demand_create_attributes.rb new file mode 100644 index 000000000000..4ba732a68889 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_on_demand_create_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 for the AWS on demand task. + class AwsOnDemandCreateAttributes + include BaseGenericModel + + # The arn of the resource to scan. Agentless supports the scan of EC2 instances, lambda functions, AMI, ECR, RDS and S3 buckets. + attr_accessor :arn + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'arn' => :'arn' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'arn' => :'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::AwsOnDemandCreateAttributes` 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?(:'arn') + self.arn = attributes[:'arn'] + 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 && + arn == o.arn && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [arn, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_on_demand_create_data.rb b/lib/datadog_api_client/v2/models/aws_on_demand_create_data.rb new file mode 100644 index 000000000000..b6555f5d13f0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_on_demand_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 + # Object for a single AWS on demand task. + class AwsOnDemandCreateData + include BaseGenericModel + + # Attributes for the AWS on demand task. + attr_reader :attributes + + # The type of the on demand task. The value should always be `aws_resource`. + 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' => :'AwsOnDemandCreateAttributes', + :'type' => :'AwsOnDemandType' + } + 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::AwsOnDemandCreateData` 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/aws_on_demand_create_request.rb b/lib/datadog_api_client/v2/models/aws_on_demand_create_request.rb new file mode 100644 index 000000000000..da761bfd8bc3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_on_demand_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 that includes the on demand task to submit. + class AwsOnDemandCreateRequest + include BaseGenericModel + + # Object for a single AWS on demand task. + 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' => :'AwsOnDemandCreateData' + } + 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::AwsOnDemandCreateRequest` 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/aws_on_demand_data.rb b/lib/datadog_api_client/v2/models/aws_on_demand_data.rb new file mode 100644 index 000000000000..2d86d45ebbde --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_on_demand_data.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 + # Single AWS on demand task. + class AwsOnDemandData + include BaseGenericModel + + # Attributes for the AWS on demand task. + attr_accessor :attributes + + # The UUID of the task. + attr_accessor :id + + # The type of the on demand task. The value should always be `aws_resource`. + attr_accessor :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' => :'AwsOnDemandAttributes', + :'id' => :'String', + :'type' => :'AwsOnDemandType' + } + 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::AwsOnDemandData` 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 + + # 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/aws_on_demand_list_response.rb b/lib/datadog_api_client/v2/models/aws_on_demand_list_response.rb new file mode 100644 index 000000000000..b19543c6e0a3 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_on_demand_list_response.rb @@ -0,0 +1,107 @@ +=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 that includes a list of AWS on demand tasks. + class AwsOnDemandListResponse + include BaseGenericModel + + # A list of on demand tasks. + 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' => :'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::AwsOnDemandListResponse` 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 + + # 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/aws_on_demand_response.rb b/lib/datadog_api_client/v2/models/aws_on_demand_response.rb new file mode 100644 index 000000000000..f2fa9a26b825 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_on_demand_response.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 + # Response object that includes an AWS on demand task. + class AwsOnDemandResponse + include BaseGenericModel + + # Single AWS on demand task. + 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' => :'AwsOnDemandData' + } + 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::AwsOnDemandResponse` 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/aws_on_demand_type.rb b/lib/datadog_api_client/v2/models/aws_on_demand_type.rb new file mode 100644 index 000000000000..95a774743370 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_on_demand_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 + # The type of the on demand task. The value should always be `aws_resource`. + class AwsOnDemandType + include BaseEnumModel + + AWS_RESOURCE = "aws_resource".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/aws_scan_options_create_attributes.rb b/lib/datadog_api_client/v2/models/aws_scan_options_create_attributes.rb new file mode 100644 index 000000000000..993a6740a841 --- /dev/null +++ b/lib/datadog_api_client/v2/models/aws_scan_options_create_attributes.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 + # Attributes for the AWS scan options to create. + class AwsScanOptionsCreateAttributes + include BaseGenericModel + + # Indicates if scanning of Lambda functions is enabled. + attr_accessor :lambda + + # Indicates if scanning for sensitive data is enabled. + attr_accessor :sensitive_data + + # Indicates if scanning for vulnerabilities in containers is enabled. + attr_accessor :vuln_containers_os + + # Indicates if scanning for vulnerabilities in hosts is enabled. + attr_accessor :vuln_host_os + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'lambda' => :'lambda', + :'sensitive_data' => :'sensitive_data', + :'vuln_containers_os' => :'vuln_containers_os', + :'vuln_host_os' => :'vuln_host_os' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'lambda' => :'Boolean', + :'sensitive_data' => :'Boolean', + :'vuln_containers_os' => :'Boolean', + :'vuln_host_os' => :'Boolean' + } + 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::AwsScanOptionsCreateAttributes` 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?(:'lambda') + self.lambda = attributes[:'lambda'] + end + + if attributes.key?(:'sensitive_data') + self.sensitive_data = attributes[:'sensitive_data'] + end + + if attributes.key?(:'vuln_containers_os') + self.vuln_containers_os = attributes[:'vuln_containers_os'] + end + + if attributes.key?(:'vuln_host_os') + self.vuln_host_os = attributes[:'vuln_host_os'] + 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 && + lambda == o.lambda && + sensitive_data == o.sensitive_data && + vuln_containers_os == o.vuln_containers_os && + vuln_host_os == o.vuln_host_os && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [lambda, sensitive_data, vuln_containers_os, vuln_host_os, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/aws_scan_options_create_data.rb b/lib/datadog_api_client/v2/models/aws_scan_options_create_data.rb index 992aa2ebc780..603a8d6bb552 100644 --- a/lib/datadog_api_client/v2/models/aws_scan_options_create_data.rb +++ b/lib/datadog_api_client/v2/models/aws_scan_options_create_data.rb @@ -21,10 +21,10 @@ module DatadogAPIClient::V2 class AwsScanOptionsCreateData include BaseGenericModel - # Attributes for the AWS scan options. + # Attributes for the AWS scan options to create. attr_reader :attributes - # The ID of an AWS account. + # The ID of the AWS account. attr_reader :id # The type of the resource. The value should always be `aws_scan_options`. @@ -46,7 +46,7 @@ def self.attribute_map # @!visibility private def self.openapi_types { - :'attributes' => :'AwsScanOptionsAttributes', + :'attributes' => :'AwsScanOptionsCreateAttributes', :'id' => :'String', :'type' => :'AwsScanOptionsType' } diff --git a/lib/datadog_api_client/v2/models/aws_scan_options_update_data.rb b/lib/datadog_api_client/v2/models/aws_scan_options_update_data.rb index dd9205ee17df..fdea67f2c81b 100644 --- a/lib/datadog_api_client/v2/models/aws_scan_options_update_data.rb +++ b/lib/datadog_api_client/v2/models/aws_scan_options_update_data.rb @@ -25,7 +25,7 @@ class AwsScanOptionsUpdateData attr_reader :attributes # The ID of the AWS account. - attr_accessor :id + attr_reader :id # The type of the resource. The value should always be `aws_scan_options`. attr_reader :type @@ -88,6 +88,7 @@ def initialize(attributes = {}) # @!visibility private def valid? return false if @attributes.nil? + return false if @id.nil? return false if @type.nil? true end @@ -102,6 +103,16 @@ def attributes=(attributes) @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