Skip to content

Commit

Permalink
tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
jmpesp committed Feb 27, 2024
1 parent 0cd8601 commit d2bf5f5
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 12 deletions.
1 change: 1 addition & 0 deletions common/src/api/internal/nexus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ pub enum HostIdentifier {
}

#[derive(Debug, Deserialize, Serialize, JsonSchema, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum UpstairsRepairType {
Live,
Reconciliation,
Expand Down
3 changes: 2 additions & 1 deletion nexus/db-queries/src/db/pool_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ static CUSTOM_TYPE_KEYS: &'static [&'static str] = &[
"ip_attach_state",
"ip_kind",
"ip_pool_resource_type",
"live_repair_notification_type",
"network_interface_kind",
"physical_disk_kind",
"producer_kind",
Expand All @@ -69,6 +68,8 @@ static CUSTOM_TYPE_KEYS: &'static [&'static str] = &[
"switch_link_fec",
"switch_link_speed",
"switch_port_geometry",
"upstairs_repair_notification_type",
"upstairs_repair_type",
"user_provision_type",
"vpc_firewall_rule_action",
"vpc_firewall_rule_direction",
Expand Down
114 changes: 103 additions & 11 deletions openapi/nexus-internal.json
Original file line number Diff line number Diff line change
Expand Up @@ -962,10 +962,55 @@
}
}
},
"/upstairs/{upstairs_id}/live-repair-finish": {
"/upstairs/{upstairs_id}/repair/{repair_id}/progress": {
"post": {
"summary": "An Upstairs will notify this endpoint when a live repair finishes.",
"operationId": "cpapi_live_repair_finish",
"summary": "An Upstairs will update this endpoint with the progress of a repair",
"operationId": "cpapi_upstairs_repair_progress",
"parameters": [
{
"in": "path",
"name": "repair_id",
"required": true,
"schema": {
"$ref": "#/components/schemas/TypedUuidForUpstairsRepairKind"
}
},
{
"in": "path",
"name": "upstairs_id",
"required": true,
"schema": {
"$ref": "#/components/schemas/TypedUuidForUpstairsKind"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RepairProgress"
}
}
},
"required": true
},
"responses": {
"204": {
"description": "resource updated"
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
}
},
"/upstairs/{upstairs_id}/repair-finish": {
"post": {
"summary": "An Upstairs will notify this endpoint when a repair finishes.",
"operationId": "cpapi_upstairs_repair_finish",
"parameters": [
{
"in": "path",
Expand Down Expand Up @@ -999,10 +1044,10 @@
}
}
},
"/upstairs/{upstairs_id}/live-repair-start": {
"/upstairs/{upstairs_id}/repair-start": {
"post": {
"summary": "An Upstairs will notify this endpoint when a live repair starts",
"operationId": "cpapi_live_repair_start",
"summary": "An Upstairs will notify this endpoint when a repair starts",
"operationId": "cpapi_upstairs_repair_start",
"parameters": [
{
"in": "path",
Expand Down Expand Up @@ -5855,7 +5900,10 @@
"type": "boolean"
},
"repair_id": {
"$ref": "#/components/schemas/TypedUuidForLiveRepairKind"
"$ref": "#/components/schemas/TypedUuidForUpstairsRepairKind"
},
"repair_type": {
"$ref": "#/components/schemas/UpstairsRepairType"
},
"repairs": {
"type": "array",
Expand All @@ -5865,20 +5913,51 @@
},
"session_id": {
"$ref": "#/components/schemas/TypedUuidForUpstairsSessionKind"
},
"time": {
"type": "string",
"format": "date-time"
}
},
"required": [
"aborted",
"repair_id",
"repair_type",
"repairs",
"session_id"
"session_id",
"time"
]
},
"RepairProgress": {
"type": "object",
"properties": {
"current_item": {
"type": "integer",
"format": "int64"
},
"time": {
"type": "string",
"format": "date-time"
},
"total_items": {
"type": "integer",
"format": "int64"
}
},
"required": [
"current_item",
"time",
"total_items"
]
},
"RepairStartInfo": {
"type": "object",
"properties": {
"repair_id": {
"$ref": "#/components/schemas/TypedUuidForLiveRepairKind"
"$ref": "#/components/schemas/TypedUuidForUpstairsRepairKind"
},
"repair_type": {
"$ref": "#/components/schemas/UpstairsRepairType"
},
"repairs": {
"type": "array",
Expand All @@ -5888,12 +5967,18 @@
},
"session_id": {
"$ref": "#/components/schemas/TypedUuidForUpstairsSessionKind"
},
"time": {
"type": "string",
"format": "date-time"
}
},
"required": [
"repair_id",
"repair_type",
"repairs",
"session_id"
"session_id",
"time"
]
},
"RouteConfig": {
Expand Down Expand Up @@ -6687,14 +6772,21 @@
"type": "string",
"format": "uuid"
},
"TypedUuidForLiveRepairKind": {
"TypedUuidForUpstairsRepairKind": {
"type": "string",
"format": "uuid"
},
"TypedUuidForUpstairsSessionKind": {
"type": "string",
"format": "uuid"
},
"UpstairsRepairType": {
"type": "string",
"enum": [
"live",
"reconciliation"
]
},
"UserId": {
"title": "A name unique within the parent collection",
"description": "Names must begin with a lower case ASCII letter, be composed exclusively of lowercase ASCII, uppercase ASCII, numbers, and '-', and may not end with a '-'. Names cannot be a UUID though they may contain a UUID.",
Expand Down

0 comments on commit d2bf5f5

Please sign in to comment.