Skip to content

Commit

Permalink
[spr] initial version
Browse files Browse the repository at this point in the history
Created using spr 1.3.6-beta.1
  • Loading branch information
papertigers committed Dec 10, 2024
2 parents 24b59fc + 16272d7 commit 3fa84e3
Show file tree
Hide file tree
Showing 16 changed files with 690 additions and 141 deletions.
18 changes: 18 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ members = [
"sled-agent/bootstrap-agent-api",
"sled-agent/repo-depot-api",
"sled-agent/types",
"sled-diagnostics",
"sled-hardware",
"sled-hardware/types",
"sled-storage",
Expand Down Expand Up @@ -240,6 +241,7 @@ default-members = [
"sled-agent/bootstrap-agent-api",
"sled-agent/repo-depot-api",
"sled-agent/types",
"sled-diagnostics",
"sled-hardware",
"sled-hardware/types",
"sled-storage",
Expand Down Expand Up @@ -596,6 +598,7 @@ sled = "=0.34.7"
sled-agent-api = { path = "sled-agent/api" }
sled-agent-client = { path = "clients/sled-agent-client" }
sled-agent-types = { path = "sled-agent/types" }
sled-diagnostics = { path = "sled-diagnostics" }
sled-hardware = { path = "sled-hardware" }
sled-hardware-types = { path = "sled-hardware/types" }
sled-storage = { path = "sled-storage" }
Expand Down
148 changes: 139 additions & 9 deletions openapi/sled-agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -678,10 +678,16 @@
"operationId": "support_dladm_info",
"responses": {
"200": {
"description": "",
"description": "successful operation",
"content": {
"*/*": {
"schema": {}
"application/json": {
"schema": {
"title": "Array_of_SledDiagnosticsQueryOutput",
"type": "array",
"items": {
"$ref": "#/components/schemas/SledDiagnosticsQueryOutput"
}
}
}
}
},
Expand All @@ -699,10 +705,70 @@
"operationId": "support_ipadm_info",
"responses": {
"200": {
"description": "",
"description": "successful operation",
"content": {
"*/*": {
"schema": {}
"application/json": {
"schema": {
"title": "Array_of_SledDiagnosticsQueryOutput",
"type": "array",
"items": {
"$ref": "#/components/schemas/SledDiagnosticsQueryOutput"
}
}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
}
},
"/support/pargs-info": {
"get": {
"operationId": "support_pargs_info",
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"title": "Array_of_SledDiagnosticsQueryOutput",
"type": "array",
"items": {
"$ref": "#/components/schemas/SledDiagnosticsQueryOutput"
}
}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
}
},
"/support/pstack-info": {
"get": {
"operationId": "support_pstack_info",
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"title": "Array_of_SledDiagnosticsQueryOutput",
"type": "array",
"items": {
"$ref": "#/components/schemas/SledDiagnosticsQueryOutput"
}
}
}
}
},
Expand All @@ -720,10 +786,12 @@
"operationId": "support_zoneadm_info",
"responses": {
"200": {
"description": "",
"description": "successful operation",
"content": {
"*/*": {
"schema": {}
"application/json": {
"schema": {
"$ref": "#/components/schemas/SledDiagnosticsQueryOutput"
}
}
}
},
Expand Down Expand Up @@ -5415,6 +5483,68 @@
"type": "string",
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
},
"SledDiagnosticsQueryOutput": {
"oneOf": [
{
"type": "object",
"properties": {
"success": {
"type": "object",
"properties": {
"command": {
"description": "The command and it's arguments.",
"type": "string"
},
"exit_code": {
"nullable": true,
"description": "The exit code if one was present when the comman exited.",
"type": "integer",
"format": "int32"
},
"exit_status": {
"description": "The exit status of the command. This will be the exit code (if any) and exit reason such as from a signal.",
"type": "string"
},
"stdio": {
"description": "Any stdout/stderr produced by the command.",
"type": "string"
}
},
"required": [
"command",
"exit_status",
"stdio"
]
}
},
"required": [
"success"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"failure": {
"type": "object",
"properties": {
"error": {
"description": "The reason the command failed to execute.",
"type": "string"
}
},
"required": [
"error"
]
}
},
"required": [
"failure"
],
"additionalProperties": false
}
]
},
"SledIdentifiers": {
"description": "Identifiers for a single sled.\n\nThis is intended primarily to be used in timeseries, to identify sled from which metric data originates.",
"type": "object",
Expand Down
1 change: 1 addition & 0 deletions sled-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ sha3.workspace = true
sled-agent-api.workspace = true
sled-agent-client.workspace = true
sled-agent-types.workspace = true
sled-diagnostics.workspace = true
sled-hardware.workspace = true
sled-hardware-types.workspace = true
sled-storage.workspace = true
Expand Down
1 change: 1 addition & 0 deletions sled-agent/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ schemars.workspace = true
serde.workspace = true
sled-agent-types.workspace = true
sled-hardware-types.workspace = true
sled-diagnostics.workspace = true
uuid.workspace = true
23 changes: 20 additions & 3 deletions sled-agent/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ use sled_agent_types::{
ZoneBundleId, ZoneBundleMetadata,
},
};
use sled_diagnostics::SledDiagnosticsQueryOutput;
use uuid::Uuid;

#[dropshot::api_description]
Expand Down Expand Up @@ -592,23 +593,39 @@ pub trait SledAgentApi {
}]
async fn support_zoneadm_info(
request_context: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<FreeformBody>, HttpError>;
) -> Result<HttpResponseOk<SledDiagnosticsQueryOutput>, HttpError>;

#[endpoint {
method = GET,
path = "/support/ipadm-info",
}]
async fn support_ipadm_info(
request_context: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<FreeformBody>, HttpError>;
) -> Result<HttpResponseOk<Vec<SledDiagnosticsQueryOutput>>, HttpError>;

#[endpoint {
method = GET,
path = "/support/dladm-info",
}]
async fn support_dladm_info(
request_context: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<FreeformBody>, HttpError>;
) -> Result<HttpResponseOk<Vec<SledDiagnosticsQueryOutput>>, HttpError>;

#[endpoint {
method = GET,
path = "/support/pargs-info",
}]
async fn support_pargs_info(
request_context: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<Vec<SledDiagnosticsQueryOutput>>, HttpError>;

#[endpoint {
method = GET,
path = "/support/pstack-info",
}]
async fn support_pstack_info(
request_context: RequestContext<Self::Context>,
) -> Result<HttpResponseOk<Vec<SledDiagnosticsQueryOutput>>, HttpError>;
}

#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)]
Expand Down
Loading

0 comments on commit 3fa84e3

Please sign in to comment.