diff --git a/changelog/18625.txt b/changelog/18625.txt new file mode 100644 index 000000000..526d6b63e --- /dev/null +++ b/changelog/18625.txt @@ -0,0 +1,3 @@ +```release-note:improvement +openapi: add openapi response definitions to /sys/seal endpoints +``` \ No newline at end of file diff --git a/vault/logical_system_paths.go b/vault/logical_system_paths.go index 656df7566..c0ebe478f 100644 --- a/vault/logical_system_paths.go +++ b/vault/logical_system_paths.go @@ -958,6 +958,11 @@ func (b *SystemBackend) rekeyPaths() []*framework.Path { Operations: map[logical.Operation]framework.OperationHandler{ logical.UpdateOperation: &framework.PathOperation{ Summary: "Seal the Vault.", + Responses: map[int][]framework.Response{ + http.StatusNoContent: {{ + Description: "OK", + }}, + }, }, }, HelpSynopsis: strings.TrimSpace(sysHelp["seal"][0]), @@ -980,6 +985,77 @@ func (b *SystemBackend) rekeyPaths() []*framework.Path { Operations: map[logical.Operation]framework.OperationHandler{ logical.UpdateOperation: &framework.PathOperation{ Summary: "Unseal the Vault.", + Responses: map[int][]framework.Response{ + http.StatusOK: {{ + // unseal returns `vault.SealStatusResponse` struct + Fields: map[string]*framework.FieldSchema{ + "type": { + Type: framework.TypeString, + Required: true, + }, + "initialized": { + Type: framework.TypeBool, + Required: true, + }, + "sealed": { + Type: framework.TypeBool, + Required: true, + }, + "t": { + Type: framework.TypeInt, + Required: true, + }, + "n": { + Type: framework.TypeInt, + Required: true, + }, + "progress": { + Type: framework.TypeInt, + Required: true, + }, + "nonce": { + Type: framework.TypeString, + Required: true, + }, + "version": { + Type: framework.TypeString, + Required: true, + }, + "build_date": { + Type: framework.TypeString, + Required: true, + }, + "migration": { + Type: framework.TypeBool, + Required: true, + }, + "cluster_name": { + Type: framework.TypeString, + Required: false, + }, + "cluster_id": { + Type: framework.TypeString, + Required: false, + }, + "recovery_seal": { + Type: framework.TypeBool, + Required: true, + }, + "storage_type": { + Type: framework.TypeString, + Required: false, + }, + "hcp_link_status": { + Type: framework.TypeString, + Required: false, + }, + "hcp_link_resource_ID": { + Type: framework.TypeString, + Required: false, + }, + }, + }}, + }, }, }, @@ -1058,6 +1134,77 @@ func (b *SystemBackend) statusPaths() []*framework.Path { logical.ReadOperation: &framework.PathOperation{ Callback: b.handleSealStatus, Summary: "Check the seal status of a Vault.", + Responses: map[int][]framework.Response{ + http.StatusOK: {{ + // unseal returns `vault.SealStatusResponse` struct + Fields: map[string]*framework.FieldSchema{ + "type": { + Type: framework.TypeString, + Required: true, + }, + "initialized": { + Type: framework.TypeBool, + Required: true, + }, + "sealed": { + Type: framework.TypeBool, + Required: true, + }, + "t": { + Type: framework.TypeInt, + Required: true, + }, + "n": { + Type: framework.TypeInt, + Required: true, + }, + "progress": { + Type: framework.TypeInt, + Required: true, + }, + "nonce": { + Type: framework.TypeString, + Required: true, + }, + "version": { + Type: framework.TypeString, + Required: true, + }, + "build_date": { + Type: framework.TypeString, + Required: true, + }, + "migration": { + Type: framework.TypeBool, + Required: true, + }, + "cluster_name": { + Type: framework.TypeString, + Required: false, + }, + "cluster_id": { + Type: framework.TypeString, + Required: false, + }, + "recovery_seal": { + Type: framework.TypeBool, + Required: true, + }, + "storage_type": { + Type: framework.TypeString, + Required: false, + }, + "hcp_link_status": { + Type: framework.TypeString, + Required: false, + }, + "hcp_link_resource_ID": { + Type: framework.TypeString, + Required: false, + }, + }, + }}, + }, }, },