Skip to content

Commit

Permalink
Add display attributes for OpenAPI OperationID's (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
averche authored Apr 18, 2023
1 parent 212e9e2 commit ab6494b
Show file tree
Hide file tree
Showing 16 changed files with 179 additions and 35 deletions.
7 changes: 6 additions & 1 deletion backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ import (
kmsapi "cloud.google.com/go/kms/apiv1"
)

const userAgentPluginName = "secrets-gcpkms"
const (
userAgentPluginName = "secrets-gcpkms"

// operationPrefixGoogleCloudKMS is used as a prefix for OpenAPI operation id's.
operationPrefixGoogleCloudKMS = "google-cloud-kms"
)

var (
// defaultClientLifetime is the amount of time to cache the KMS client. This
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2
github.com/hashicorp/vault/api v1.9.0
github.com/hashicorp/vault/sdk v0.8.1
github.com/hashicorp/vault/sdk v0.9.0
github.com/jeffchao/backoff v0.0.0-20140404060208-9d7fd7aa17f2
github.com/satori/go.uuid v1.2.0
golang.org/x/oauth2 v0.0.0-20220524215830-622c5d57e401
Expand All @@ -37,7 +37,7 @@ require (
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-kms-wrapping/entropy/v2 v2.0.0 // indirect
github.com/hashicorp/go-kms-wrapping/v2 v2.0.7 // indirect
github.com/hashicorp/go-kms-wrapping/v2 v2.0.8 // indirect
github.com/hashicorp/go-plugin v1.4.5 // indirect
github.com/hashicorp/go-retryablehttp v0.6.6 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
Expand All @@ -62,10 +62,10 @@ require (
github.com/ryanuber/go-glob v1.0.0 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
golang.org/x/crypto v0.6.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.0 // indirect
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJ
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-kms-wrapping/entropy/v2 v2.0.0 h1:pSjQfW3vPtrOTcasTUKgCTQT7OGPPTTMVRrOfU6FJD8=
github.com/hashicorp/go-kms-wrapping/entropy/v2 v2.0.0/go.mod h1:xvb32K2keAc+R8DSFG2IwDcydK9DBQE+fGA5fsw6hSk=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.7 h1:P+dh3M6k5aNl2wXrA9s6zquMHWPaYIkotCffiMIYt6U=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.7/go.mod h1:sDQAfwJGv25uGPZA04x87ERglCG6avnRcBT9wYoMII8=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.8 h1:9Q2lu1YbbmiAgvYZ7Pr31RdlVonUpX+mmDL7Z7qTA2U=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.8/go.mod h1:qTCjxGig/kjuj3hk1z8pOUrzbse/GxB1tGfbrq8tGJg=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
Expand Down Expand Up @@ -260,8 +260,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/vault/api v1.9.0 h1:ab7dI6W8DuCY7yCU8blo0UCYl2oHre/dloCmzMWg9w8=
github.com/hashicorp/vault/api v1.9.0/go.mod h1:lloELQP4EyhjnCQhF8agKvWIVTmxbpEJj70b98959sM=
github.com/hashicorp/vault/sdk v0.8.1 h1:bdlhIpxBmJuOZ5Anumao1xeiLocR2eQrBRuJynZfTac=
github.com/hashicorp/vault/sdk v0.8.1/go.mod h1:kEpyfUU2ECGWf6XohKVFzvJ97ybSnXvxsTsBkbeVcQg=
github.com/hashicorp/vault/sdk v0.9.0 h1:Cbu9ezaZafZTXnen98QKVmufEPquhZ+r1ORZ7csNLFU=
github.com/hashicorp/vault/sdk v0.9.0/go.mod h1:VX9d+xF62YBNtiEc4l3Z2aea9HVtAS49EoniuXzHtC4=
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ=
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
Expand Down Expand Up @@ -380,8 +380,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE=
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -460,8 +460,8 @@ golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su
golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -558,8 +558,8 @@ golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -571,8 +571,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
36 changes: 31 additions & 5 deletions path_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ func (b *backend) pathConfig() *framework.Path {
return &framework.Path{
Pattern: "config",

DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixGoogleCloudKMS,
},

HelpSynopsis: "Configure the GCP KMS secrets engine",
HelpDescription: "Configure the GCP KMS secrets engine with credentials " +
"or manage the requested scope(s).",
Expand All @@ -40,11 +44,33 @@ requests https://www.googleapis.com/auth/cloudkms.

ExistenceCheck: b.pathConfigExists,

Callbacks: map[logical.Operation]framework.OperationFunc{
logical.CreateOperation: withFieldValidator(b.pathConfigWrite),
logical.UpdateOperation: withFieldValidator(b.pathConfigWrite),
logical.ReadOperation: withFieldValidator(b.pathConfigRead),
logical.DeleteOperation: withFieldValidator(b.pathConfigDelete),
Operations: map[logical.Operation]framework.OperationHandler{
logical.CreateOperation: &framework.PathOperation{
Callback: withFieldValidator(b.pathConfigWrite),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "configure",
},
},
logical.UpdateOperation: &framework.PathOperation{
Callback: withFieldValidator(b.pathConfigWrite),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "configure",
},
},
logical.ReadOperation: &framework.PathOperation{
Callback: withFieldValidator(b.pathConfigRead),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "read",
OperationSuffix: "configuration",
},
},
logical.DeleteOperation: &framework.PathOperation{
Callback: withFieldValidator(b.pathConfigDelete),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "delete",
OperationSuffix: "configuration",
},
},
},
}
}
Expand Down
5 changes: 5 additions & 0 deletions path_decrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ func (b *backend) pathDecrypt() *framework.Path {
return &framework.Path{
Pattern: "decrypt/" + framework.GenericNameRegex("key"),

DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixGoogleCloudKMS,
OperationVerb: "decrypt",
},

HelpSynopsis: "Decrypt a ciphertext value using a named key",
HelpDescription: `
Use the named encryption key to decrypt a ciphertext string previously
Expand Down
5 changes: 5 additions & 0 deletions path_encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ func (b *backend) pathEncrypt() *framework.Path {
return &framework.Path{
Pattern: "encrypt/" + framework.GenericNameRegex("key"),

DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixGoogleCloudKMS,
OperationVerb: "encrypt",
},

HelpSynopsis: "Encrypt a plaintext value using a named key",
HelpDescription: `
Use the named encryption key to encrypt an arbitrary plaintext string. The
Expand Down
11 changes: 11 additions & 0 deletions path_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ func (b *backend) pathKeys() *framework.Path {
return &framework.Path{
Pattern: "keys/?$",

DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixGoogleCloudKMS,
OperationVerb: "list",
OperationSuffix: "keys",
},

HelpSynopsis: "List named keys",
HelpDescription: "List the named keys available for use.",

Expand All @@ -44,6 +50,11 @@ func (b *backend) pathKeysCRUD() *framework.Path {
return &framework.Path{
Pattern: "keys/" + framework.GenericNameRegex("key"),

DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixGoogleCloudKMS,
OperationSuffix: "key",
},

HelpSynopsis: "Interact with crypto keys in Vault and Google Cloud KMS",
HelpDescription: `
This endpoint is used for the CRUD operations for keys in Vault.
Expand Down
32 changes: 28 additions & 4 deletions path_keys_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ func (b *backend) pathKeysConfigCRUD() *framework.Path {
return &framework.Path{
Pattern: "keys/config/" + framework.GenericNameRegex("key"),

DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixGoogleCloudKMS,
OperationVerb: "configure",
OperationSuffix: "key",
},

HelpSynopsis: "Configure the key in Vault",
HelpDescription: `
Update the Vault's configuration of this key such as the minimum allowed key
Expand Down Expand Up @@ -52,10 +58,28 @@ negative value, there is no maximum key version.

ExistenceCheck: b.pathKeysExistenceCheck,

Callbacks: map[logical.Operation]framework.OperationFunc{
logical.ReadOperation: withFieldValidator(b.pathKeysConfigRead),
logical.CreateOperation: withFieldValidator(b.pathKeysConfigWrite),
logical.UpdateOperation: withFieldValidator(b.pathKeysConfigWrite),
Operations: map[logical.Operation]framework.OperationHandler{
logical.ReadOperation: &framework.PathOperation{
Callback: withFieldValidator(b.pathKeysConfigRead),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "read",
OperationSuffix: "key-configuration",
},
},
logical.CreateOperation: &framework.PathOperation{
Callback: withFieldValidator(b.pathKeysConfigWrite),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "configure",
OperationSuffix: "key",
},
},
logical.UpdateOperation: &framework.PathOperation{
Callback: withFieldValidator(b.pathKeysConfigWrite),
DisplayAttrs: &framework.DisplayAttributes{
OperationVerb: "configure",
OperationSuffix: "key",
},
},
},
}
}
Expand Down
21 changes: 18 additions & 3 deletions path_keys_deregister.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ func (b *backend) pathKeysDeregister() *framework.Path {
return &framework.Path{
Pattern: "keys/deregister/" + framework.GenericNameRegex("key"),

DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixGoogleCloudKMS,
OperationVerb: "deregister",
},

HelpSynopsis: "Deregister an existing key in Vault",
HelpDescription: `
This endpoint deregisters an existing reference Vault has to a crypto key in
Expand All @@ -31,9 +36,19 @@ it will be left untouched.
},
},

Callbacks: map[logical.Operation]framework.OperationFunc{
logical.UpdateOperation: withFieldValidator(b.pathKeysDeregisterWrite),
logical.DeleteOperation: withFieldValidator(b.pathKeysDeregisterWrite),
Operations: map[logical.Operation]framework.OperationHandler{
logical.UpdateOperation: &framework.PathOperation{
Callback: withFieldValidator(b.pathKeysDeregisterWrite),
DisplayAttrs: &framework.DisplayAttributes{
OperationSuffix: "key",
},
},
logical.DeleteOperation: &framework.PathOperation{
Callback: withFieldValidator(b.pathKeysDeregisterWrite),
DisplayAttrs: &framework.DisplayAttributes{
OperationSuffix: "key2",
},
},
},
}
}
Expand Down
6 changes: 6 additions & 0 deletions path_keys_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ func (b *backend) pathKeysRegister() *framework.Path {
return &framework.Path{
Pattern: "keys/register/" + framework.GenericNameRegex("key"),

DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixGoogleCloudKMS,
OperationVerb: "register",
OperationSuffix: "key",
},

HelpSynopsis: "Register an existing crypto key in Google Cloud KMS",
HelpDescription: `
Registers an existing crypto key in Google Cloud KMS and make it available for
Expand Down
6 changes: 6 additions & 0 deletions path_keys_rotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ func (b *backend) pathKeysRotate() *framework.Path {
return &framework.Path{
Pattern: "keys/rotate/" + framework.GenericNameRegex("key"),

DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixGoogleCloudKMS,
OperationVerb: "rotate",
OperationSuffix: "key",
},

HelpSynopsis: "Rotate a crypto key to a new primary version",
HelpDescription: `
This endpoint creates a new crypto key version for the corresponding Google
Expand Down
28 changes: 24 additions & 4 deletions path_keys_trim.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ func (b *backend) pathKeysTrim() *framework.Path {
return &framework.Path{
Pattern: "keys/trim/" + framework.GenericNameRegex("key"),

DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixGoogleCloudKMS,
OperationVerb: "trim",
},

HelpSynopsis: "Delete old crypto key versions from Google Cloud KMS",
HelpDescription: `
This endpoint deletes old crypto key versions from Google Cloud KMS that are
Expand Down Expand Up @@ -56,10 +61,25 @@ Name of the key in Vault.

ExistenceCheck: b.pathKeysExistenceCheck,

Callbacks: map[logical.Operation]framework.OperationFunc{
logical.CreateOperation: withFieldValidator(b.pathKeysTrimWrite),
logical.UpdateOperation: withFieldValidator(b.pathKeysTrimWrite),
logical.DeleteOperation: withFieldValidator(b.pathKeysTrimWrite),
Operations: map[logical.Operation]framework.OperationHandler{
logical.CreateOperation: &framework.PathOperation{
Callback: withFieldValidator(b.pathKeysTrimWrite),
DisplayAttrs: &framework.DisplayAttributes{
OperationSuffix: "key-versions",
},
},
logical.UpdateOperation: &framework.PathOperation{
Callback: withFieldValidator(b.pathKeysTrimWrite),
DisplayAttrs: &framework.DisplayAttributes{
OperationSuffix: "key-versions",
},
},
logical.DeleteOperation: &framework.PathOperation{
Callback: withFieldValidator(b.pathKeysTrimWrite),
DisplayAttrs: &framework.DisplayAttributes{
OperationSuffix: "key-versions2",
},
},
},
}
}
Expand Down
5 changes: 5 additions & 0 deletions path_keys_verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ func (b *backend) pathVerify() *framework.Path {
return &framework.Path{
Pattern: "verify/" + framework.GenericNameRegex("key"),

DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixGoogleCloudKMS,
OperationVerb: "verify",
},

HelpSynopsis: "Verify a signature using a named key",
HelpDescription: `
Use the named key to verify the given signature. The response will be the
Expand Down
6 changes: 6 additions & 0 deletions path_pubkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ func (b *backend) pathPubkey() *framework.Path {
return &framework.Path{
Pattern: "pubkey/" + framework.GenericNameRegex("key"),

DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixGoogleCloudKMS,
OperationVerb: "retrieve",
OperationSuffix: "public-key",
},

HelpSynopsis: "Retrieve the public key associated with the named key",
HelpDescription: `
Retrieve the PEM-encoded Google Cloud KMS public key associated with the Vault
Expand Down
5 changes: 5 additions & 0 deletions path_reencrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ func (b *backend) pathReencrypt() *framework.Path {
return &framework.Path{
Pattern: "reencrypt/" + framework.GenericNameRegex("key"),

DisplayAttrs: &framework.DisplayAttributes{
OperationPrefix: operationPrefixGoogleCloudKMS,
OperationVerb: "reencrypt",
},

HelpSynopsis: "Re-encrypt existing ciphertext data to a new version",
HelpDescription: `
Use the named encryption key to re-encrypt the underlying cryptokey to the latest
Expand Down
Loading

0 comments on commit ab6494b

Please sign in to comment.