replace-insight-resource-results
dci replace-insight-resource-results <sourceID> <insightKey> [body] [flags]
Replaces all resource results for the specified insight. Any existing unresolved resource results not present in the new set will be removed. The response includes server-computed fields (severity, resolved, enhancement) for each resource result. To delete all resource results, send an empty array.
sourceID— Only insights created via the public API can be managed. Currently only "public-api" is supported.insightKey— The unique key identifying the insight.
Pass the request body as name: value arguments or pipe JSON on stdin — see Command structure.
Examples
# Replace the insight's resource results with the set in a file; unresolved results missing from it are removed.
dci replace-insight-resource-results public-api <insight-key> < resources.json
# resources.json
{"resourceResults": [{
"account": "123456789012", "cloudProvider": "aws",
"resourceId": "i-0abc123def4567890", "resourceType": "instance", "location": "eu-west-2",
"resultType": "potential_daily_savings_with_recommendation",
"result": {"value": 12.5, "current": "m5.2xlarge", "recommendation": "m5.large"}
}]}
# The same replacement, printing the stored results with their server-computed severity and resolved fields.
dci replace-insight-resource-results public-api <insight-key> --output json < resources.json
# Remove every resource result from the insight.
dci replace-insight-resource-results public-api <insight-key> resourceResults: []
Request
Content-Type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
resourceResults | array of object | yes | A list of resource-level results for creating or updating an insight. |
resourceResults[].resourceId | string | yes | The cloud resource identifier. |
resourceResults[].resourceType | string | What the resource actually is, e.g. for an EC2 resource ID, this field would be instance. Immutable after creation — updates to this field are silently ignored. | |
resourceResults[].cloudProvider | string | yes | Immutable after creation — updates to this field are silently ignored. |
resourceResults[].account | string | yes | The cloud account or project ID containing this resource. Immutable after creation — updates to this field are silently ignored. |
resourceResults[].location | string | Represents the region/zone of the resource in AWS, or equivalent for other providers. Immutable after creation — updates to this field are silently ignored. | |
resourceResults[].externalId | string | the external ID of the resource in the provider's system for the resource | |
resourceResults[].externalUrl | string | the URL to the resource-level issue in the provider's system | |
resourceResults[].metadata | object | contains any additional information for the resource results | |
resourceResults[].resultType | string | yes | The discriminator property that determines which fields are populated in the 'result' object. One of: "security_risk", "potential_daily_savings", "potential_daily_savings_with_recommendation", "potential_daily_savings_with_cluster_agent". |
resourceResults[].result | object | The result data for this resource. Which fields are populated depends on the resultType. For security_risk: critical, high, medium, low. For potential_daily_savings: value. For potential_daily_savings_with_recommendation: value, current, recommendation. For potential_daily_savings_with_cluster_agent: value, agentInstalled. | |
resourceResults[].result.value | number (double) | the daily saving amount for this result | |
resourceResults[].result.critical | integer | number of critical security risks | |
resourceResults[].result.high | integer | number of high security risks | |
resourceResults[].result.medium | integer | number of medium security risks | |
resourceResults[].result.low | integer | number of low security risks | |
resourceResults[].result.current | string | the current state (i.e. current instance type) | |
resourceResults[].result.recommendation | string | the recommended state (i.e. recommended instance type) | |
resourceResults[].result.agentInstalled | boolean | true if the agent is installed |
Raw JSON schema
{
"type": "object",
"description": "Request body for creating or replacing resource results for an insight.",
"required": [
"resourceResults"
],
"properties": {
"resourceResults": {
"type": "array",
"description": "A list of resource-level results for creating or updating an insight.",
"items": {
"type": "object",
"description": "A single resource-level result for creating or updating an insight. Server-computed fields (severity, resolved, enhancement) are not accepted here and will be ignored. Identity fields (resourceId, resultType, account, cloudProvider) form the composite key. The fields location and resource_type are set on creation only — any values provided for these fields during subsequent upserts are silently ignored.\n",
"required": [
"resourceId",
"resultType",
"account",
"cloudProvider"
],
"properties": {
"resourceId": {
"type": "string",
"description": "The cloud resource identifier."
},
"resourceType": {
"description": "What the resource actually is, e.g. for an EC2 resource ID, this field would be `instance`. Immutable after creation — updates to this field are silently ignored.\n",
"type": "string",
"example": "instance, disk, cache"
},
"cloudProvider": {
"description": "Immutable after creation — updates to this field are silently ignored.",
"allOf": [
{
"type": "string",
"example": "aws",
"description": "The cloud provider associated with the resource."
}
]
},
"account": {
"type": "string",
"description": "The cloud account or project ID containing this resource. Immutable after creation — updates to this field are silently ignored."
},
"location": {
"type": "string",
"description": "Represents the region/zone of the resource in AWS, or equivalent for other providers. Immutable after creation — updates to this field are silently ignored.\n",
"example": "eu-west-2"
},
"externalId": {
"type": "string",
"description": "the external ID of the resource in the provider's system for the resource"
},
"externalUrl": {
"type": "string",
"description": "the URL to the resource-level issue in the provider's system"
},
"metadata": {
"type": "object",
"description": "contains any additional information for the resource results"
},
"resultType": {
"type": "string",
"enum": [
"security_risk",
"potential_daily_savings",
"potential_daily_savings_with_recommendation",
"potential_daily_savings_with_cluster_agent"
],
"description": "The discriminator property that determines which fields are populated in the 'result' object."
},
"result": {
"description": "The result data for this resource. Which fields are populated depends on the resultType. For security_risk: critical, high, medium, low. For potential_daily_savings: value. For potential_daily_savings_with_recommendation: value, current, recommendation. For potential_daily_savings_with_cluster_agent: value, agentInstalled.\n",
"type": "object",
"properties": {
"value": {
"type": "number",
"format": "double",
"description": "the daily saving amount for this result"
},
"critical": {
"type": "integer",
"description": "number of critical security risks"
},
"high": {
"type": "integer",
"description": "number of high security risks"
},
"medium": {
"type": "integer",
"description": "number of medium security risks"
},
"low": {
"type": "integer",
"description": "number of low security risks"
},
"current": {
"type": "string",
"description": "the current state (i.e. current instance type)"
},
"recommendation": {
"type": "string",
"description": "the recommended state (i.e. recommended instance type)"
},
"agentInstalled": {
"type": "boolean",
"description": "true if the agent is installed"
}
}
}
}
}
}
}
}
Flags
| Flag | Type | Default | Example | Description |
|---|---|---|---|---|
--max-results | integer | 1000 | Maximum number of results per page in the response (default 1000, max 5000). |
Every command also accepts the CLI-wide flags for output shaping — see Output formats and Table output options.
Output
Resource results created/replaced successfully
By default dci renders the result as a table. Use --output json to get the full structure described below — see Output formats.
| Field | Type | Description |
|---|---|---|
resourceResults | array of object | |
resourceResults[].resourceId | string | The cloud resource identifier. |
resourceResults[].resourceType | string | What the resource actually is, eg. for an EC2 resource ID, this field would be instance |
resourceResults[].cloudProvider | string | The cloud provider associated with the resource. |
resourceResults[].account | string | The cloud account or project ID containing this resource. |
resourceResults[].location | string | represents the region/zone of the resource in AWS, or equivalent for other providers |
resourceResults[].resolved | boolean | Whether this resource-level issue has been resolved. Computed server-side. |
resourceResults[].severity | string | The severity level of the finding. Computed server-side from the security risk counts. One of: "critical", "high", "medium", "low". |
resourceResults[].externalId | string | the external ID of the resource in the provider's system for the resource |
resourceResults[].externalUrl | string | the URL to the resource-level issue in the provider's system |
resourceResults[].metadata | object | contains any additional information for the resource results |
resourceResults[].enhancement | object | DoiT-managed metadata associated with a resource result. |
resourceResults[].enhancement.tags | array of string | Tags assigned to this resource result. |
resourceResults[].enhancement.priority | object | Priority information for this resource result. |
resourceResults[].enhancement.priority.value | string | The priority level (e.g. Low, Medium, High). |
resourceResults[].enhancement.priority.priorityScore | number (double) | Numeric priority score. |
resourceResults[].enhancement.lastUpdatedBy | string | The user who last updated this enhancement. |
resourceResults[].enhancement.lastUpdatedAt | string (date-time) | Timestamp of the last update. |
resourceResults[].resultType | string | The discriminator property that determines which fields are populated in the 'result' object. One of: "security_risk", "potential_daily_savings", "potential_daily_savings_with_recommendation", "potential_daily_savings_with_cluster_agent". |
resourceResults[].result | object | The result data for this resource. Which fields are populated depends on the resultType. For security_risk: critical, high, medium, low. For potential_daily_savings: value. For potential_daily_savings_with_recommendation: value, current, recommendation. For potential_daily_savings_with_cluster_agent: value, agentInstalled. |
resourceResults[].result.value | number (double) | the daily saving amount for this result |
resourceResults[].result.critical | integer | number of critical security risks |
resourceResults[].result.high | integer | number of high security risks |
resourceResults[].result.medium | integer | number of medium security risks |
resourceResults[].result.low | integer | number of low security risks |
resourceResults[].result.current | string | the current state (i.e. current instance type) |
resourceResults[].result.recommendation | string | the recommended state (i.e. recommended instance type) |
resourceResults[].result.agentInstalled | boolean | true if the agent is installed |
pageToken | string | |
rowCount | integer |
Raw JSON schema
{
"type": "object",
"required": [
"resourceResults",
"rowCount"
],
"properties": {
"resourceResults": {
"type": "array",
"items": {
"type": "object",
"description": "A single resource-level result within an insight, as returned in API responses.",
"required": [
"resourceId",
"resultType",
"account",
"cloudProvider"
],
"properties": {
"resourceId": {
"description": "The cloud resource identifier.",
"type": "string"
},
"resourceType": {
"description": "What the resource actually is, eg. for an EC2 resource ID, this field would be `instance`",
"type": "string",
"example": "instance, disk, cache"
},
"cloudProvider": {
"type": "string",
"example": "aws",
"description": "The cloud provider associated with the resource."
},
"account": {
"type": "string",
"description": "The cloud account or project ID containing this resource."
},
"location": {
"type": "string",
"description": "represents the region/zone of the resource in AWS, or equivalent for other providers",
"example": "eu-west-2"
},
"resolved": {
"type": "boolean",
"description": "Whether this resource-level issue has been resolved. Computed server-side."
},
"severity": {
"type": "string",
"enum": [
"critical",
"high",
"medium",
"low"
],
"description": "The severity level of the finding. Computed server-side from the security risk counts."
},
"externalId": {
"type": "string",
"description": "the external ID of the resource in the provider's system for the resource"
},
"externalUrl": {
"type": "string",
"description": "the URL to the resource-level issue in the provider's system"
},
"metadata": {
"type": "object",
"description": "contains any additional information for the resource results"
},
"enhancement": {
"type": "object",
"description": "DoiT-managed metadata associated with a resource result.",
"properties": {
"tags": {
"type": "array",
"description": "Tags assigned to this resource result.",
"items": {
"type": "string"
}
},
"priority": {
"type": "object",
"description": "Priority information for this resource result.",
"properties": {
"value": {
"type": "string",
"description": "The priority level (e.g. Low, Medium, High)."
},
"priorityScore": {
"type": "number",
"format": "double",
"description": "Numeric priority score."
}
}
},
"lastUpdatedBy": {
"type": "string",
"description": "The user who last updated this enhancement."
},
"lastUpdatedAt": {
"type": "string",
"format": "date-time",
"description": "Timestamp of the last update."
}
}
},
"resultType": {
"type": "string",
"enum": [
"security_risk",
"potential_daily_savings",
"potential_daily_savings_with_recommendation",
"potential_daily_savings_with_cluster_agent"
],
"description": "The discriminator property that determines which fields are populated in the 'result' object."
},
"result": {
"description": "The result data for this resource. Which fields are populated depends on the resultType. For security_risk: critical, high, medium, low. For potential_daily_savings: value. For potential_daily_savings_with_recommendation: value, current, recommendation. For potential_daily_savings_with_cluster_agent: value, agentInstalled.\n",
"type": "object",
"properties": {
"value": {
"type": "number",
"format": "double",
"description": "the daily saving amount for this result"
},
"critical": {
"type": "integer",
"description": "number of critical security risks"
},
"high": {
"type": "integer",
"description": "number of high security risks"
},
"medium": {
"type": "integer",
"description": "number of medium security risks"
},
"low": {
"type": "integer",
"description": "number of low security risks"
},
"current": {
"type": "string",
"description": "the current state (i.e. current instance type)"
},
"recommendation": {
"type": "string",
"description": "the recommended state (i.e. recommended instance type)"
},
"agentInstalled": {
"type": "boolean",
"description": "true if the agent is installed"
}
}
}
}
}
},
"pageToken": {
"type": "string"
},
"rowCount": {
"type": "integer"
}
}
}
Errors
On failure, dci prints a single error message — with a hint when one is available — and exits with a typed code your scripts can branch on. See Errors and exit codes for the full contract.
HTTP status to exit code mapping
| HTTP status | Exit code | Error code | Meaning |
|---|---|---|---|
| 400 | 30 | VALIDATION_ERROR | The arguments or request body were rejected. Review the command's flags and payload. |
| 401 | 10 | AUTHENTICATION_FAILED | Not signed in, or the API token is invalid. Run dci login or check DCI_API_KEY. |
| 403 | 11 | PERMISSION_DENIED | The DoiT user or the active customer context does not have access. |
| 404 | 20 | RESOURCE_NOT_FOUND | The requested resource does not exist. Check the identifier argument. |
| 500 | 40 | API_SERVER_ERROR | The API failed to process the request. Retryable; contact DoiT support if it persists. |
Related
- list-insight-resource-results — List resource results for an insight
- create-insight — Create or update an insight
- create-insights — Create insights (batch)
- get-insight — Retrieve an insight
- API reference: POST /insights/v1/results/source/{sourceID}/insight/{insightKey}/resource-results
Aliases: post-insight-resource-results