diff --git a/api/find.go b/api/find.go index 0a0111124..69fae67b9 100644 --- a/api/find.go +++ b/api/find.go @@ -13,9 +13,24 @@ import ( "github.com/puppetlabs/wash/plugin" ) -// swagger:route GET /fs/find find listEntries +// swagger:response +//nolint:deadcode,unused +type findResponse struct { + // in: body + Entries []apitypes.Entry +} + +// swagger:parameters findResponse +//nolint:deadcode,unused +type findParams struct { + params + rql.Options +} + +// swagger:route GET /fs/find find findResponse // -// Recursively descends the given path returning it and its children. +// Recursively descends the given path, returning all children that satisfy +// the given RQL query. // // Consumes: // - application/json diff --git a/api/rql/options.go b/api/rql/options.go index c5bf06e13..90174add5 100644 --- a/api/rql/options.go +++ b/api/rql/options.go @@ -2,8 +2,24 @@ package rql // Options represent the RQL's options type Options struct { + // Mindepth is the minimum depth. Descendants at lesser depths are not included + // in the RQL's returned list of entries. + // + // Depth starts from 0. For example, given paths "foo", "foo/bar", "foo/bar/baz", + // assume "foo" is the start path. Then "foo" is at depth 0, "foo/bar" is at depth 1, + // "foo/bar/baz" is at depth 2, etc. Mindepth int + // Maxdepth is the maximum depth. Descendants at greater depths are not included + // in the RQL's returned list of entries. See Mindepth's comments to understand how + // depth is calculated. Maxdepth int + // Fullmeta is short for "full metadata". If set, then meta primary queries act on + // the entry's full metadata, and the returned list of entries will include the entry's + // full metadata. If unset then the RQL uses the partial metadata instead. + // + // Note that setting Fullmeta could result in O(N) extra requests to fetch the metadata, + // where N is the number of visited entries. Using the partial metadata (unsetting Fullmeta) + // does not result in any extra request. Fullmeta bool } diff --git a/docs/README.md b/docs/README.md index 67b0a6030..51a6945c4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -31,8 +31,8 @@ go get -u github.com/go-swagger/go-swagger/cmd/swagger Then run it and [redoc-cli](https://github.com/Rebilly/ReDoc/blob/master/cli/README.md) from the project root to update the static docs page. ``` -swagger generate spec > docs/docs/api.json -npx redoc-cli bundle docs/docs/api.json -o docs/docs/api.html --options.nativeScrollbars +swagger generate spec > docs/_docs/api.json +npx redoc-cli bundle docs/_docs/api.json -o docs/_docs/api.html --options.nativeScrollbars ``` ## Extending the screencasts diff --git a/docs/_docs/api.html b/docs/_docs/api.html index 6c8c71165..d70b497a4 100644 --- a/docs/_docs/api.html +++ b/docs/_docs/api.html @@ -15,10 +15,10 @@ @@ -257,7 +272,7 @@ -

Download OpenAPI specification:Download

cache

Remove items from the cache

Removes the specified entry and its children from the cache.

-
query Parameters
Path
string

uniquely identifies an entry

+
query Parameters
Path
string

uniquely identifies an entry

Responses

200
500
delete /cache
/cache

delete

Deletes the entry at the specified path.

On success, returns a boolean that describes whether the delete was applied immediately or is pending.

-
query Parameters
Path
string

uniquely identifies an entry

+
query Parameters
Path
string

uniquely identifies an entry

Responses

200
400
404
500
delete /fs/delete
/fs/delete

exec

Execute a command on a remote system

Executes a command on the remote system described by the supplied path.

-
query Parameters
Path
string

uniquely identifies an entry

-
Request Body schema: application/json
args
Array of strings

Array of arguments to the executable

-
cmd
string

Name of the executable to invoke

-
opts
object (ExecOptions are options that can be passed as part of an Exec call.)

These are not identical to plugin.ExecOptions because initially the API only +

query Parameters
Path
string

uniquely identifies an entry

+
Request Body schema: application/json
args
Array of strings

Array of arguments to the executable

+
cmd
string

Name of the executable to invoke

+
opts
object (ExecOptions are options that can be passed as part of an Exec call.)

These are not identical to plugin.ExecOptions because initially the API only supports receiving a string of input, not a reader.

-

Responses

200
400
404
500
post /fs/exec
/fs/exec

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "args":
    [
    ],
  • "cmd": "string",
  • "opts":
    {
    }
}

info

Info about entry at path

Returns an Entry object describing the given path.

-
query Parameters
Path
string

uniquely identifies an entry

+

Responses

200
400
404
500
post /fs/exec
/fs/exec

Request samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "args":
    [
    ],
  • "cmd": "string",
  • "opts":
    {
    }
}

find

findResponse

Recursively descends the given path, returning all children that satisfy +the given RQL query.

+
query Parameters
Path
string

uniquely identifies an entry

+
Mindepth
integer <int64>

Mindepth is the minimum depth. Descendants at lesser depths are not included +in the RQL's returned list of entries.

+

Depth starts from 0. For example, given paths "foo", "foo/bar", "foo/bar/baz", +assume "foo" is the start path. Then "foo" is at depth 0, "foo/bar" is at depth 1, +"foo/bar/baz" is at depth 2, etc.

+
Maxdepth
integer <int64>

Maxdepth is the maximum depth. Descendants at greater depths are not included +in the RQL's returned list of entries. See Mindepth's comments to understand how +depth is calculated.

+
Fullmeta
boolean

Fullmeta is short for "full metadata". If set, then meta primary queries act on +the entry's full metadata, and the returned list of entries will include the entry's +full metadata. If unset then the RQL uses the partial metadata instead.

+

Note that setting Fullmeta could result in O(N) extra requests to fetch the metadata, +where N is the number of visited entries. Using the partial metadata (unsetting Fullmeta) +does not result in any extra request.

+

Responses

200
400
404
500
get /fs/find
/fs/find

info

Info about entry at path

Returns an Entry object describing the given path.

+
query Parameters
Path
string

uniquely identifies an entry

Responses

200

Entry represents a Wash entry as interpreted by the API.

-
400
404
500
get /fs/info
/fs/info

list

Lists children of a path

Returns a list of Entry objects describing children of the given path.

-
query Parameters
Path
string

uniquely identifies an entry

+
400
404
500
get /fs/info
/fs/info

list

Lists children of a path

Returns a list of Entry objects describing children of the given path. +The "metadata" key is set to the partial metadata.

+
query Parameters
Path
string

uniquely identifies an entry

Responses

200
400
404
500
get /fs/list
/fs/list

metadata

Get metadata

Get metadata about the specified entry.

-
query Parameters
Path
string

uniquely identifies an entry

+
query Parameters
Path
string

uniquely identifies an entry

Responses

200
404
500
get /fs/metadata
/fs/metadata

schema

Schema for an entry at path

Returns a map of Type IDs to EntrySchema objects describing the plugin schema starting at the given path. The first key in the map corresponds to the path's schema.

-
query Parameters
Path
string

uniquely identifies an entry

-

Responses

200
400
404
500
get /fs/schema
/fs/schema

signal

Sends a signal to the entry at the specified path.

query Parameters
Path
string

uniquely identifies an entry

+
query Parameters
Path
string

uniquely identifies an entry

+

Responses

200
400
404
500
get /fs/schema
/fs/schema

signal

Sends a signal to the entry at the specified path.

query Parameters
Path
string

uniquely identifies an entry

Responses

200
400
404
500
post /fs/signal
/fs/signal

stream

Stream updates

Get a stream of new updates to the specified entry.

-
query Parameters
Path
string

uniquely identifies an entry

+
query Parameters
Path
string

uniquely identifies an entry

Responses

200
404
500
get /fs/stream
/fs/stream

history

Get command history

Get a list of commands that have been run via 'wash' and when they were run.

-
query Parameters
Follow
boolean

stream updates when true

+
query Parameters
Follow
boolean

stream updates when true

Responses

200

HistoryResponse describes the result returned by the /history endpoint.

400
404
500
get /history
/history

journal

Get logs for a particular entry in history

Get the logs related to a particular command run via 'wash', requested by index within its activity history.

-
query Parameters
Follow
boolean

stream updates when true

+
query Parameters
Follow
boolean

stream updates when true

Responses

200
400
404
500
get /history/{id}
/history/{id}