openapi: Add display attributes for /sys (p2) (#19707)

This commit is contained in:
Anton Averchenkov 2023-04-13 11:32:57 -04:00 committed by GitHub
parent 254c5e2568
commit 14ac4fc045
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 159 additions and 3 deletions

View File

@ -319,6 +319,11 @@ func rawPaths(prefix string, r *RawBackend) []*framework.Path {
Operations: map[logical.Operation]framework.OperationHandler{
logical.ReadOperation: &framework.PathOperation{
Callback: r.handleRawRead,
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "raw",
OperationVerb: "read",
OperationSuffix: "|path",
},
Responses: map[int][]framework.Response{
http.StatusOK: {{
Description: "OK",
@ -334,6 +339,11 @@ func rawPaths(prefix string, r *RawBackend) []*framework.Path {
},
logical.UpdateOperation: &framework.PathOperation{
Callback: r.handleRawWrite,
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "raw",
OperationVerb: "write",
OperationSuffix: "|path",
},
Responses: map[int][]framework.Response{
http.StatusOK: {{
Description: "OK",
@ -343,6 +353,11 @@ func rawPaths(prefix string, r *RawBackend) []*framework.Path {
},
logical.CreateOperation: &framework.PathOperation{
Callback: r.handleRawWrite,
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "raw",
OperationVerb: "write",
OperationSuffix: "|path",
},
Responses: map[int][]framework.Response{
http.StatusNoContent: {{
Description: "OK",
@ -352,6 +367,11 @@ func rawPaths(prefix string, r *RawBackend) []*framework.Path {
},
logical.DeleteOperation: &framework.PathOperation{
Callback: r.handleRawDelete,
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "raw",
OperationVerb: "delete",
OperationSuffix: "|path",
},
Responses: map[int][]framework.Response{
http.StatusNoContent: {{
Description: "OK",
@ -361,6 +381,11 @@ func rawPaths(prefix string, r *RawBackend) []*framework.Path {
},
logical.ListOperation: &framework.PathOperation{
Callback: r.handleRawList,
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "raw",
OperationVerb: "list",
OperationSuffix: "|path",
},
Responses: map[int][]framework.Response{
http.StatusOK: {{
Description: "OK",

View File

@ -21,6 +21,13 @@ import (
func (b *SystemBackend) activityQueryPath() *framework.Path {
return &framework.Path{
Pattern: "internal/counters/activity$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "internal-client-activity",
OperationVerb: "report",
OperationSuffix: "counts",
},
Fields: map[string]*framework.FieldSchema{
"start_time": {
Type: framework.TypeTime,
@ -52,6 +59,13 @@ func (b *SystemBackend) activityQueryPath() *framework.Path {
func (b *SystemBackend) monthlyActivityCountPath() *framework.Path {
return &framework.Path{
Pattern: "internal/counters/activity/monthly$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "internal-client-activity",
OperationVerb: "report",
OperationSuffix: "counts-this-month",
},
HelpSynopsis: strings.TrimSpace(sysHelp["activity-monthly"][0]),
HelpDescription: strings.TrimSpace(sysHelp["activity-monthly"][1]),
Operations: map[logical.Operation]framework.OperationHandler{
@ -77,6 +91,11 @@ func (b *SystemBackend) rootActivityPaths() []*framework.Path {
b.monthlyActivityCountPath(),
{
Pattern: "internal/counters/config$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "internal-client-activity",
},
Fields: map[string]*framework.FieldSchema{
"default_report_months": {
Type: framework.TypeInt,
@ -99,16 +118,29 @@ func (b *SystemBackend) rootActivityPaths() []*framework.Path {
Operations: map[logical.Operation]framework.OperationHandler{
logical.ReadOperation: &framework.PathOperation{
Callback: b.handleActivityConfigRead,
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "read",
OperationSuffix: "configuration",
},
Summary: "Read the client count tracking configuration.",
},
logical.UpdateOperation: &framework.PathOperation{
Callback: b.handleActivityConfigUpdate,
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "configure",
},
Summary: "Enable or disable collection of client count, set retention period, or set default reporting period.",
},
},
},
{
Pattern: "internal/counters/activity/export$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "internal-client-activity",
OperationVerb: "export",
},
Fields: map[string]*framework.FieldSchema{
"start_time": {
Type: framework.TypeTime,
@ -124,6 +156,7 @@ func (b *SystemBackend) rootActivityPaths() []*framework.Path {
Default: "json",
},
},
HelpSynopsis: strings.TrimSpace(sysHelp["activity-export"][0]),
HelpDescription: strings.TrimSpace(sysHelp["activity-export"][1]),

View File

@ -64,6 +64,12 @@ var (
return []*framework.Path{
{
Pattern: "replication/status",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "replication",
OperationVerb: "status",
},
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.ReadOperation: func(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) {
resp := &logical.Response{

View File

@ -20,6 +20,11 @@ func (b *SystemBackend) pprofPaths() []*framework.Path {
{
Pattern: "pprof/$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "pprof",
OperationVerb: "index",
},
Operations: map[logical.Operation]framework.OperationHandler{
logical.ReadOperation: &framework.PathOperation{
Callback: b.handlePprofIndex,
@ -38,6 +43,11 @@ render pages.`,
{
Pattern: "pprof/cmdline",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "pprof",
OperationVerb: "command-line",
},
Operations: map[logical.Operation]framework.OperationHandler{
logical.ReadOperation: &framework.PathOperation{
Callback: b.handlePprofCmdline,
@ -54,6 +64,11 @@ render pages.`,
{
Pattern: "pprof/goroutine",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "pprof",
OperationVerb: "goroutines",
},
Operations: map[logical.Operation]framework.OperationHandler{
logical.ReadOperation: &framework.PathOperation{
Callback: b.handlePprofGoroutine,
@ -70,6 +85,11 @@ render pages.`,
{
Pattern: "pprof/heap",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "pprof",
OperationVerb: "memory-allocations-live",
},
Operations: map[logical.Operation]framework.OperationHandler{
logical.ReadOperation: &framework.PathOperation{
Callback: b.handlePprofHeap,
@ -86,6 +106,11 @@ render pages.`,
{
Pattern: "pprof/allocs",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "pprof",
OperationVerb: "memory-allocations",
},
Operations: map[logical.Operation]framework.OperationHandler{
logical.ReadOperation: &framework.PathOperation{
Callback: b.handlePprofAllocs,
@ -102,6 +127,11 @@ render pages.`,
{
Pattern: "pprof/threadcreate",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "pprof",
OperationVerb: "thread-creations",
},
Operations: map[logical.Operation]framework.OperationHandler{
logical.ReadOperation: &framework.PathOperation{
Callback: b.handlePprofThreadcreate,
@ -119,6 +149,11 @@ render pages.`,
{
Pattern: "pprof/block",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "pprof",
OperationVerb: "blocking",
},
Operations: map[logical.Operation]framework.OperationHandler{
logical.ReadOperation: &framework.PathOperation{
Callback: b.handlePprofBlock,
@ -135,6 +170,11 @@ render pages.`,
{
Pattern: "pprof/mutex",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "pprof",
OperationVerb: "mutexes",
},
Operations: map[logical.Operation]framework.OperationHandler{
logical.ReadOperation: &framework.PathOperation{
Callback: b.handlePprofMutex,
@ -151,6 +191,11 @@ render pages.`,
{
Pattern: "pprof/profile",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "pprof",
OperationVerb: "cpu-profile",
},
Fields: map[string]*framework.FieldSchema{
"seconds": {
Type: framework.TypeInt,
@ -174,6 +219,11 @@ render pages.`,
{
Pattern: "pprof/symbol",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "pprof",
OperationVerb: "symbols",
},
Operations: map[logical.Operation]framework.OperationHandler{
logical.ReadOperation: &framework.PathOperation{
Callback: b.handlePprofSymbol,
@ -191,6 +241,11 @@ render pages.`,
{
Pattern: "pprof/trace",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "pprof",
OperationVerb: "execution-trace",
},
Fields: map[string]*framework.FieldSchema{
"seconds": {
Type: framework.TypeInt,

View File

@ -21,6 +21,11 @@ func (b *SystemBackend) quotasPaths() []*framework.Path {
return []*framework.Path{
{
Pattern: "quotas/config$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "rate-limit-quotas",
},
Fields: map[string]*framework.FieldSchema{
"rate_limit_exempt_paths": {
Type: framework.TypeStringSlice,
@ -38,6 +43,9 @@ func (b *SystemBackend) quotasPaths() []*framework.Path {
Operations: map[logical.Operation]framework.OperationHandler{
logical.UpdateOperation: &framework.PathOperation{
Callback: b.handleQuotasConfigUpdate(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "configure",
},
Responses: map[int][]framework.Response{
http.StatusNoContent: {{
Description: "OK",
@ -46,6 +54,9 @@ func (b *SystemBackend) quotasPaths() []*framework.Path {
},
logical.ReadOperation: &framework.PathOperation{
Callback: b.handleQuotasConfigRead(),
DisplayAttrs: &framework.DisplayAttributes{
OperationSuffix: "configuration",
},
Responses: map[int][]framework.Response{
http.StatusOK: {{
Description: "OK",
@ -72,6 +83,12 @@ func (b *SystemBackend) quotasPaths() []*framework.Path {
},
{
Pattern: "quotas/rate-limit/?$",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "rate-limit-quotas",
OperationVerb: "list",
},
Operations: map[logical.Operation]framework.OperationHandler{
logical.ListOperation: &framework.PathOperation{
Callback: b.handleRateLimitQuotasList(),
@ -93,6 +110,11 @@ func (b *SystemBackend) quotasPaths() []*framework.Path {
},
{
Pattern: "quotas/rate-limit/" + framework.GenericNameRegex("name"),
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "rate-limit-quotas",
},
Fields: map[string]*framework.FieldSchema{
"type": {
Type: framework.TypeString,
@ -131,6 +153,9 @@ from any further requests until after the 'block_interval' has elapsed.`,
Operations: map[logical.Operation]framework.OperationHandler{
logical.UpdateOperation: &framework.PathOperation{
Callback: b.handleRateLimitQuotasUpdate(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "write",
},
Responses: map[int][]framework.Response{
http.StatusNoContent: {{
Description: http.StatusText(http.StatusNoContent),
@ -139,6 +164,9 @@ from any further requests until after the 'block_interval' has elapsed.`,
},
logical.ReadOperation: &framework.PathOperation{
Callback: b.handleRateLimitQuotasRead(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "read",
},
Responses: map[int][]framework.Response{
http.StatusOK: {{
Description: "OK",
@ -177,6 +205,9 @@ from any further requests until after the 'block_interval' has elapsed.`,
},
logical.DeleteOperation: &framework.PathOperation{
Callback: b.handleRateLimitQuotasDelete(),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "delete",
},
Responses: map[int][]framework.Response{
http.StatusNoContent: {{
Description: "OK",

View File

@ -72,6 +72,12 @@ func (b *SystemBackend) loginMFAPaths() []*framework.Path {
return []*framework.Path{
{
Pattern: "mfa/validate",
DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: "mfa",
OperationVerb: "validate",
},
Fields: map[string]*framework.FieldSchema{
"mfa_request_id": {
Type: framework.TypeString,