Implement KMS handlers (#2367)
This commit is contained in:
@@ -1708,31 +1708,31 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/kms/policy/{name}/assign"] = k_m_s.NewKMSAssignPolicy(o.context, o.KmsKMSAssignPolicyHandler)
|
||||
o.handlers["POST"]["/kms/policies/{name}/assign"] = k_m_s.NewKMSAssignPolicy(o.context, o.KmsKMSAssignPolicyHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/kms/key"] = k_m_s.NewKMSCreateKey(o.context, o.KmsKMSCreateKeyHandler)
|
||||
o.handlers["POST"]["/kms/keys"] = k_m_s.NewKMSCreateKey(o.context, o.KmsKMSCreateKeyHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/kms/identity/{name}"] = k_m_s.NewKMSDeleteIdentity(o.context, o.KmsKMSDeleteIdentityHandler)
|
||||
o.handlers["DELETE"]["/kms/identities/{name}"] = k_m_s.NewKMSDeleteIdentity(o.context, o.KmsKMSDeleteIdentityHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/kms/key/{name}"] = k_m_s.NewKMSDeleteKey(o.context, o.KmsKMSDeleteKeyHandler)
|
||||
o.handlers["DELETE"]["/kms/keys/{name}"] = k_m_s.NewKMSDeleteKey(o.context, o.KmsKMSDeleteKeyHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/kms/policy/{name}"] = k_m_s.NewKMSDeletePolicy(o.context, o.KmsKMSDeletePolicyHandler)
|
||||
o.handlers["DELETE"]["/kms/policies/{name}"] = k_m_s.NewKMSDeletePolicy(o.context, o.KmsKMSDeletePolicyHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/identity/{name}/describe"] = k_m_s.NewKMSDescribeIdentity(o.context, o.KmsKMSDescribeIdentityHandler)
|
||||
o.handlers["GET"]["/kms/identities/{name}/describe"] = k_m_s.NewKMSDescribeIdentity(o.context, o.KmsKMSDescribeIdentityHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/policy/{name}/describe"] = k_m_s.NewKMSDescribePolicy(o.context, o.KmsKMSDescribePolicyHandler)
|
||||
o.handlers["GET"]["/kms/policies/{name}/describe"] = k_m_s.NewKMSDescribePolicy(o.context, o.KmsKMSDescribePolicyHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
@@ -1740,31 +1740,31 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/policy/{name}"] = k_m_s.NewKMSGetPolicy(o.context, o.KmsKMSGetPolicyHandler)
|
||||
o.handlers["GET"]["/kms/policies/{name}"] = k_m_s.NewKMSGetPolicy(o.context, o.KmsKMSGetPolicyHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/kms/key/{name}/import"] = k_m_s.NewKMSImportKey(o.context, o.KmsKMSImportKeyHandler)
|
||||
o.handlers["POST"]["/kms/keys/{name}/import"] = k_m_s.NewKMSImportKey(o.context, o.KmsKMSImportKeyHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/key/{name}"] = k_m_s.NewKMSKeyStatus(o.context, o.KmsKMSKeyStatusHandler)
|
||||
o.handlers["GET"]["/kms/keys/{name}"] = k_m_s.NewKMSKeyStatus(o.context, o.KmsKMSKeyStatusHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/identity"] = k_m_s.NewKMSListIdentities(o.context, o.KmsKMSListIdentitiesHandler)
|
||||
o.handlers["GET"]["/kms/identities"] = k_m_s.NewKMSListIdentities(o.context, o.KmsKMSListIdentitiesHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/key"] = k_m_s.NewKMSListKeys(o.context, o.KmsKMSListKeysHandler)
|
||||
o.handlers["GET"]["/kms/keys"] = k_m_s.NewKMSListKeys(o.context, o.KmsKMSListKeysHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/policy"] = k_m_s.NewKMSListPolicies(o.context, o.KmsKMSListPoliciesHandler)
|
||||
o.handlers["GET"]["/kms/policies"] = k_m_s.NewKMSListPolicies(o.context, o.KmsKMSListPoliciesHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/kms/policy"] = k_m_s.NewKMSSetPolicy(o.context, o.KmsKMSSetPolicyHandler)
|
||||
o.handlers["POST"]["/kms/policies"] = k_m_s.NewKMSSetPolicy(o.context, o.KmsKMSSetPolicyHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ func NewKMSAssignPolicy(ctx *middleware.Context, handler KMSAssignPolicyHandler)
|
||||
}
|
||||
|
||||
/*
|
||||
KMSAssignPolicy swagger:route POST /kms/policy/{name}/assign KMS kMSAssignPolicy
|
||||
KMSAssignPolicy swagger:route POST /kms/policies/{name}/assign KMS kMSAssignPolicy
|
||||
|
||||
KMS assign policy
|
||||
*/
|
||||
|
||||
@@ -30,6 +30,7 @@ import (
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
@@ -55,7 +56,7 @@ type KMSAssignPolicyParams struct {
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body models.KmsAssignPolicyRequest
|
||||
Body *models.KmsAssignPolicyRequest
|
||||
/*KMS policy name
|
||||
Required: true
|
||||
In: path
|
||||
@@ -82,8 +83,19 @@ func (o *KMSAssignPolicyParams) BindRequest(r *http.Request, route *middleware.M
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
}
|
||||
} else {
|
||||
// no validation on generic interface
|
||||
o.Body = body
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(r.Context())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
|
||||
@@ -57,7 +57,7 @@ func (o *KMSAssignPolicyURL) SetBasePath(bp string) {
|
||||
func (o *KMSAssignPolicyURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/policy/{name}/assign"
|
||||
var _path = "/kms/policies/{name}/assign"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
|
||||
@@ -49,7 +49,7 @@ func NewKMSCreateKey(ctx *middleware.Context, handler KMSCreateKeyHandler) *KMSC
|
||||
}
|
||||
|
||||
/*
|
||||
KMSCreateKey swagger:route POST /kms/key KMS kMSCreateKey
|
||||
KMSCreateKey swagger:route POST /kms/keys KMS kMSCreateKey
|
||||
|
||||
KMS create key
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,7 @@ import (
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
@@ -54,7 +55,7 @@ type KMSCreateKeyParams struct {
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body models.KmsCreateKeyRequest
|
||||
Body *models.KmsCreateKeyRequest
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
@@ -76,8 +77,19 @@ func (o *KMSCreateKeyParams) BindRequest(r *http.Request, route *middleware.Matc
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
}
|
||||
} else {
|
||||
// no validation on generic interface
|
||||
o.Body = body
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(r.Context())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
|
||||
@@ -52,7 +52,7 @@ func (o *KMSCreateKeyURL) SetBasePath(bp string) {
|
||||
func (o *KMSCreateKeyURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/key"
|
||||
var _path = "/kms/keys"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
|
||||
@@ -49,7 +49,7 @@ func NewKMSDeleteIdentity(ctx *middleware.Context, handler KMSDeleteIdentityHand
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDeleteIdentity swagger:route DELETE /kms/identity/{name} KMS kMSDeleteIdentity
|
||||
KMSDeleteIdentity swagger:route DELETE /kms/identities/{name} KMS kMSDeleteIdentity
|
||||
|
||||
KMS delete identity
|
||||
*/
|
||||
|
||||
@@ -57,7 +57,7 @@ func (o *KMSDeleteIdentityURL) SetBasePath(bp string) {
|
||||
func (o *KMSDeleteIdentityURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/identity/{name}"
|
||||
var _path = "/kms/identities/{name}"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
|
||||
@@ -49,7 +49,7 @@ func NewKMSDeleteKey(ctx *middleware.Context, handler KMSDeleteKeyHandler) *KMSD
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDeleteKey swagger:route DELETE /kms/key/{name} KMS kMSDeleteKey
|
||||
KMSDeleteKey swagger:route DELETE /kms/keys/{name} KMS kMSDeleteKey
|
||||
|
||||
KMS delete key
|
||||
*/
|
||||
|
||||
@@ -57,7 +57,7 @@ func (o *KMSDeleteKeyURL) SetBasePath(bp string) {
|
||||
func (o *KMSDeleteKeyURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/key/{name}"
|
||||
var _path = "/kms/keys/{name}"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
|
||||
@@ -49,7 +49,7 @@ func NewKMSDeletePolicy(ctx *middleware.Context, handler KMSDeletePolicyHandler)
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDeletePolicy swagger:route DELETE /kms/policy/{name} KMS kMSDeletePolicy
|
||||
KMSDeletePolicy swagger:route DELETE /kms/policies/{name} KMS kMSDeletePolicy
|
||||
|
||||
KMS delete policy
|
||||
*/
|
||||
|
||||
@@ -57,7 +57,7 @@ func (o *KMSDeletePolicyURL) SetBasePath(bp string) {
|
||||
func (o *KMSDeletePolicyURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/policy/{name}"
|
||||
var _path = "/kms/policies/{name}"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
|
||||
@@ -49,7 +49,7 @@ func NewKMSDescribeIdentity(ctx *middleware.Context, handler KMSDescribeIdentity
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDescribeIdentity swagger:route GET /kms/identity/{name}/describe KMS kMSDescribeIdentity
|
||||
KMSDescribeIdentity swagger:route GET /kms/identities/{name}/describe KMS kMSDescribeIdentity
|
||||
|
||||
KMS describe identity
|
||||
*/
|
||||
|
||||
@@ -43,7 +43,7 @@ type KMSDescribeIdentityOK struct {
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.KmsDescribeIdentityResponse `json:"body,omitempty"`
|
||||
Payload *models.KmsDescribeIdentityResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSDescribeIdentityOK creates KMSDescribeIdentityOK with default headers values
|
||||
@@ -53,13 +53,13 @@ func NewKMSDescribeIdentityOK() *KMSDescribeIdentityOK {
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s describe identity o k response
|
||||
func (o *KMSDescribeIdentityOK) WithPayload(payload models.KmsDescribeIdentityResponse) *KMSDescribeIdentityOK {
|
||||
func (o *KMSDescribeIdentityOK) WithPayload(payload *models.KmsDescribeIdentityResponse) *KMSDescribeIdentityOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s describe identity o k response
|
||||
func (o *KMSDescribeIdentityOK) SetPayload(payload models.KmsDescribeIdentityResponse) {
|
||||
func (o *KMSDescribeIdentityOK) SetPayload(payload *models.KmsDescribeIdentityResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
@@ -67,9 +67,11 @@ func (o *KMSDescribeIdentityOK) SetPayload(payload models.KmsDescribeIdentityRes
|
||||
func (o *KMSDescribeIdentityOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ func (o *KMSDescribeIdentityURL) SetBasePath(bp string) {
|
||||
func (o *KMSDescribeIdentityURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/identity/{name}/describe"
|
||||
var _path = "/kms/identities/{name}/describe"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
|
||||
@@ -49,7 +49,7 @@ func NewKMSDescribePolicy(ctx *middleware.Context, handler KMSDescribePolicyHand
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDescribePolicy swagger:route GET /kms/policy/{name}/describe KMS kMSDescribePolicy
|
||||
KMSDescribePolicy swagger:route GET /kms/policies/{name}/describe KMS kMSDescribePolicy
|
||||
|
||||
KMS describe policy
|
||||
*/
|
||||
|
||||
@@ -43,7 +43,7 @@ type KMSDescribePolicyOK struct {
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.KmsDescribePolicyResponse `json:"body,omitempty"`
|
||||
Payload *models.KmsDescribePolicyResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSDescribePolicyOK creates KMSDescribePolicyOK with default headers values
|
||||
@@ -53,13 +53,13 @@ func NewKMSDescribePolicyOK() *KMSDescribePolicyOK {
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s describe policy o k response
|
||||
func (o *KMSDescribePolicyOK) WithPayload(payload models.KmsDescribePolicyResponse) *KMSDescribePolicyOK {
|
||||
func (o *KMSDescribePolicyOK) WithPayload(payload *models.KmsDescribePolicyResponse) *KMSDescribePolicyOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s describe policy o k response
|
||||
func (o *KMSDescribePolicyOK) SetPayload(payload models.KmsDescribePolicyResponse) {
|
||||
func (o *KMSDescribePolicyOK) SetPayload(payload *models.KmsDescribePolicyResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
@@ -67,9 +67,11 @@ func (o *KMSDescribePolicyOK) SetPayload(payload models.KmsDescribePolicyRespons
|
||||
func (o *KMSDescribePolicyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ func (o *KMSDescribePolicyURL) SetBasePath(bp string) {
|
||||
func (o *KMSDescribePolicyURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/policy/{name}/describe"
|
||||
var _path = "/kms/policies/{name}/describe"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
|
||||
@@ -43,7 +43,7 @@ type KMSDescribeSelfIdentityOK struct {
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.KmsDescribeSelfIdentityResponse `json:"body,omitempty"`
|
||||
Payload *models.KmsDescribeSelfIdentityResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSDescribeSelfIdentityOK creates KMSDescribeSelfIdentityOK with default headers values
|
||||
@@ -53,13 +53,13 @@ func NewKMSDescribeSelfIdentityOK() *KMSDescribeSelfIdentityOK {
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s describe self identity o k response
|
||||
func (o *KMSDescribeSelfIdentityOK) WithPayload(payload models.KmsDescribeSelfIdentityResponse) *KMSDescribeSelfIdentityOK {
|
||||
func (o *KMSDescribeSelfIdentityOK) WithPayload(payload *models.KmsDescribeSelfIdentityResponse) *KMSDescribeSelfIdentityOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s describe self identity o k response
|
||||
func (o *KMSDescribeSelfIdentityOK) SetPayload(payload models.KmsDescribeSelfIdentityResponse) {
|
||||
func (o *KMSDescribeSelfIdentityOK) SetPayload(payload *models.KmsDescribeSelfIdentityResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
@@ -67,9 +67,11 @@ func (o *KMSDescribeSelfIdentityOK) SetPayload(payload models.KmsDescribeSelfIde
|
||||
func (o *KMSDescribeSelfIdentityOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ func NewKMSGetPolicy(ctx *middleware.Context, handler KMSGetPolicyHandler) *KMSG
|
||||
}
|
||||
|
||||
/*
|
||||
KMSGetPolicy swagger:route GET /kms/policy/{name} KMS kMSGetPolicy
|
||||
KMSGetPolicy swagger:route GET /kms/policies/{name} KMS kMSGetPolicy
|
||||
|
||||
KMS get policy
|
||||
*/
|
||||
|
||||
@@ -43,7 +43,7 @@ type KMSGetPolicyOK struct {
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.KmsGetPolicyResponse `json:"body,omitempty"`
|
||||
Payload *models.KmsGetPolicyResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSGetPolicyOK creates KMSGetPolicyOK with default headers values
|
||||
@@ -53,13 +53,13 @@ func NewKMSGetPolicyOK() *KMSGetPolicyOK {
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s get policy o k response
|
||||
func (o *KMSGetPolicyOK) WithPayload(payload models.KmsGetPolicyResponse) *KMSGetPolicyOK {
|
||||
func (o *KMSGetPolicyOK) WithPayload(payload *models.KmsGetPolicyResponse) *KMSGetPolicyOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s get policy o k response
|
||||
func (o *KMSGetPolicyOK) SetPayload(payload models.KmsGetPolicyResponse) {
|
||||
func (o *KMSGetPolicyOK) SetPayload(payload *models.KmsGetPolicyResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
@@ -67,9 +67,11 @@ func (o *KMSGetPolicyOK) SetPayload(payload models.KmsGetPolicyResponse) {
|
||||
func (o *KMSGetPolicyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ func (o *KMSGetPolicyURL) SetBasePath(bp string) {
|
||||
func (o *KMSGetPolicyURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/policy/{name}"
|
||||
var _path = "/kms/policies/{name}"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
|
||||
@@ -49,7 +49,7 @@ func NewKMSImportKey(ctx *middleware.Context, handler KMSImportKeyHandler) *KMSI
|
||||
}
|
||||
|
||||
/*
|
||||
KMSImportKey swagger:route POST /kms/key/{name}/import KMS kMSImportKey
|
||||
KMSImportKey swagger:route POST /kms/keys/{name}/import KMS kMSImportKey
|
||||
|
||||
KMS import key
|
||||
*/
|
||||
|
||||
@@ -30,6 +30,7 @@ import (
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
@@ -55,7 +56,7 @@ type KMSImportKeyParams struct {
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body models.KmsImportKeyRequest
|
||||
Body *models.KmsImportKeyRequest
|
||||
/*KMS key name
|
||||
Required: true
|
||||
In: path
|
||||
@@ -82,8 +83,19 @@ func (o *KMSImportKeyParams) BindRequest(r *http.Request, route *middleware.Matc
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
}
|
||||
} else {
|
||||
// no validation on generic interface
|
||||
o.Body = body
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(r.Context())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
|
||||
@@ -57,7 +57,7 @@ func (o *KMSImportKeyURL) SetBasePath(bp string) {
|
||||
func (o *KMSImportKeyURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/key/{name}/import"
|
||||
var _path = "/kms/keys/{name}/import"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
|
||||
@@ -49,7 +49,7 @@ func NewKMSKeyStatus(ctx *middleware.Context, handler KMSKeyStatusHandler) *KMSK
|
||||
}
|
||||
|
||||
/*
|
||||
KMSKeyStatus swagger:route GET /kms/key/{name} KMS kMSKeyStatus
|
||||
KMSKeyStatus swagger:route GET /kms/keys/{name} KMS kMSKeyStatus
|
||||
|
||||
KMS key status
|
||||
*/
|
||||
|
||||
@@ -43,7 +43,7 @@ type KMSKeyStatusOK struct {
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.KmsKeyStatusResponse `json:"body,omitempty"`
|
||||
Payload *models.KmsKeyStatusResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSKeyStatusOK creates KMSKeyStatusOK with default headers values
|
||||
@@ -53,13 +53,13 @@ func NewKMSKeyStatusOK() *KMSKeyStatusOK {
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s key status o k response
|
||||
func (o *KMSKeyStatusOK) WithPayload(payload models.KmsKeyStatusResponse) *KMSKeyStatusOK {
|
||||
func (o *KMSKeyStatusOK) WithPayload(payload *models.KmsKeyStatusResponse) *KMSKeyStatusOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s key status o k response
|
||||
func (o *KMSKeyStatusOK) SetPayload(payload models.KmsKeyStatusResponse) {
|
||||
func (o *KMSKeyStatusOK) SetPayload(payload *models.KmsKeyStatusResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
@@ -67,9 +67,11 @@ func (o *KMSKeyStatusOK) SetPayload(payload models.KmsKeyStatusResponse) {
|
||||
func (o *KMSKeyStatusOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ func (o *KMSKeyStatusURL) SetBasePath(bp string) {
|
||||
func (o *KMSKeyStatusURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/key/{name}"
|
||||
var _path = "/kms/keys/{name}"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
|
||||
@@ -49,7 +49,7 @@ func NewKMSListIdentities(ctx *middleware.Context, handler KMSListIdentitiesHand
|
||||
}
|
||||
|
||||
/*
|
||||
KMSListIdentities swagger:route GET /kms/identity KMS kMSListIdentities
|
||||
KMSListIdentities swagger:route GET /kms/identities KMS kMSListIdentities
|
||||
|
||||
KMS list identities
|
||||
*/
|
||||
|
||||
@@ -43,7 +43,7 @@ type KMSListIdentitiesOK struct {
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.KmsListIdentitiesResponse `json:"body,omitempty"`
|
||||
Payload *models.KmsListIdentitiesResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSListIdentitiesOK creates KMSListIdentitiesOK with default headers values
|
||||
@@ -53,13 +53,13 @@ func NewKMSListIdentitiesOK() *KMSListIdentitiesOK {
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s list identities o k response
|
||||
func (o *KMSListIdentitiesOK) WithPayload(payload models.KmsListIdentitiesResponse) *KMSListIdentitiesOK {
|
||||
func (o *KMSListIdentitiesOK) WithPayload(payload *models.KmsListIdentitiesResponse) *KMSListIdentitiesOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s list identities o k response
|
||||
func (o *KMSListIdentitiesOK) SetPayload(payload models.KmsListIdentitiesResponse) {
|
||||
func (o *KMSListIdentitiesOK) SetPayload(payload *models.KmsListIdentitiesResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
@@ -67,9 +67,11 @@ func (o *KMSListIdentitiesOK) SetPayload(payload models.KmsListIdentitiesRespons
|
||||
func (o *KMSListIdentitiesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ func (o *KMSListIdentitiesURL) SetBasePath(bp string) {
|
||||
func (o *KMSListIdentitiesURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/identity"
|
||||
var _path = "/kms/identities"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
|
||||
@@ -49,7 +49,7 @@ func NewKMSListKeys(ctx *middleware.Context, handler KMSListKeysHandler) *KMSLis
|
||||
}
|
||||
|
||||
/*
|
||||
KMSListKeys swagger:route GET /kms/key KMS kMSListKeys
|
||||
KMSListKeys swagger:route GET /kms/keys KMS kMSListKeys
|
||||
|
||||
KMS list keys
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,6 @@ import (
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// NewKMSListKeysParams creates a new KMSListKeysParams object
|
||||
@@ -50,10 +49,9 @@ type KMSListKeysParams struct {
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*pattern to retrieve keys
|
||||
Required: true
|
||||
In: query
|
||||
*/
|
||||
Pattern string
|
||||
Pattern *string
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
@@ -79,21 +77,18 @@ func (o *KMSListKeysParams) BindRequest(r *http.Request, route *middleware.Match
|
||||
|
||||
// bindPattern binds and validates parameter Pattern from query.
|
||||
func (o *KMSListKeysParams) bindPattern(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
if !hasKey {
|
||||
return errors.Required("pattern", "query", rawData)
|
||||
}
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Required: false
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if err := validate.RequiredString("pattern", "query", raw); err != nil {
|
||||
return err
|
||||
if raw == "" { // empty values pass all other validations
|
||||
return nil
|
||||
}
|
||||
o.Pattern = raw
|
||||
o.Pattern = &raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ type KMSListKeysOK struct {
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.KmsListKeysResponse `json:"body,omitempty"`
|
||||
Payload *models.KmsListKeysResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSListKeysOK creates KMSListKeysOK with default headers values
|
||||
@@ -53,13 +53,13 @@ func NewKMSListKeysOK() *KMSListKeysOK {
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s list keys o k response
|
||||
func (o *KMSListKeysOK) WithPayload(payload models.KmsListKeysResponse) *KMSListKeysOK {
|
||||
func (o *KMSListKeysOK) WithPayload(payload *models.KmsListKeysResponse) *KMSListKeysOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s list keys o k response
|
||||
func (o *KMSListKeysOK) SetPayload(payload models.KmsListKeysResponse) {
|
||||
func (o *KMSListKeysOK) SetPayload(payload *models.KmsListKeysResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
@@ -67,9 +67,11 @@ func (o *KMSListKeysOK) SetPayload(payload models.KmsListKeysResponse) {
|
||||
func (o *KMSListKeysOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
|
||||
// KMSListKeysURL generates an URL for the k m s list keys operation
|
||||
type KMSListKeysURL struct {
|
||||
Pattern string
|
||||
Pattern *string
|
||||
|
||||
_basePath string
|
||||
// avoid unkeyed usage
|
||||
@@ -56,7 +56,7 @@ func (o *KMSListKeysURL) SetBasePath(bp string) {
|
||||
func (o *KMSListKeysURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/key"
|
||||
var _path = "/kms/keys"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
@@ -66,7 +66,10 @@ func (o *KMSListKeysURL) Build() (*url.URL, error) {
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
patternQ := o.Pattern
|
||||
var patternQ string
|
||||
if o.Pattern != nil {
|
||||
patternQ = *o.Pattern
|
||||
}
|
||||
if patternQ != "" {
|
||||
qs.Set("pattern", patternQ)
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ func NewKMSListPolicies(ctx *middleware.Context, handler KMSListPoliciesHandler)
|
||||
}
|
||||
|
||||
/*
|
||||
KMSListPolicies swagger:route GET /kms/policy KMS kMSListPolicies
|
||||
KMSListPolicies swagger:route GET /kms/policies KMS kMSListPolicies
|
||||
|
||||
KMS list policies
|
||||
*/
|
||||
|
||||
@@ -43,7 +43,7 @@ type KMSListPoliciesOK struct {
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.KmsListPoliciesResponse `json:"body,omitempty"`
|
||||
Payload *models.KmsListPoliciesResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSListPoliciesOK creates KMSListPoliciesOK with default headers values
|
||||
@@ -53,13 +53,13 @@ func NewKMSListPoliciesOK() *KMSListPoliciesOK {
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s list policies o k response
|
||||
func (o *KMSListPoliciesOK) WithPayload(payload models.KmsListPoliciesResponse) *KMSListPoliciesOK {
|
||||
func (o *KMSListPoliciesOK) WithPayload(payload *models.KmsListPoliciesResponse) *KMSListPoliciesOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s list policies o k response
|
||||
func (o *KMSListPoliciesOK) SetPayload(payload models.KmsListPoliciesResponse) {
|
||||
func (o *KMSListPoliciesOK) SetPayload(payload *models.KmsListPoliciesResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
@@ -67,9 +67,11 @@ func (o *KMSListPoliciesOK) SetPayload(payload models.KmsListPoliciesResponse) {
|
||||
func (o *KMSListPoliciesOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ func (o *KMSListPoliciesURL) SetBasePath(bp string) {
|
||||
func (o *KMSListPoliciesURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/policy"
|
||||
var _path = "/kms/policies"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
|
||||
@@ -49,7 +49,7 @@ func NewKMSSetPolicy(ctx *middleware.Context, handler KMSSetPolicyHandler) *KMSS
|
||||
}
|
||||
|
||||
/*
|
||||
KMSSetPolicy swagger:route POST /kms/policy KMS kMSSetPolicy
|
||||
KMSSetPolicy swagger:route POST /kms/policies KMS kMSSetPolicy
|
||||
|
||||
KMS set policy
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,7 @@ import (
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
@@ -54,7 +55,7 @@ type KMSSetPolicyParams struct {
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body models.KmsSetPolicyRequest
|
||||
Body *models.KmsSetPolicyRequest
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
@@ -76,8 +77,19 @@ func (o *KMSSetPolicyParams) BindRequest(r *http.Request, route *middleware.Matc
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
}
|
||||
} else {
|
||||
// no validation on generic interface
|
||||
o.Body = body
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(r.Context())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
|
||||
@@ -52,7 +52,7 @@ func (o *KMSSetPolicyURL) SetBasePath(bp string) {
|
||||
func (o *KMSSetPolicyURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/policy"
|
||||
var _path = "/kms/policies"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
|
||||
@@ -43,7 +43,7 @@ type KMSStatusOK struct {
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload models.KmsStatusResponse `json:"body,omitempty"`
|
||||
Payload *models.KmsStatusResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSStatusOK creates KMSStatusOK with default headers values
|
||||
@@ -53,13 +53,13 @@ func NewKMSStatusOK() *KMSStatusOK {
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s status o k response
|
||||
func (o *KMSStatusOK) WithPayload(payload models.KmsStatusResponse) *KMSStatusOK {
|
||||
func (o *KMSStatusOK) WithPayload(payload *models.KmsStatusResponse) *KMSStatusOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s status o k response
|
||||
func (o *KMSStatusOK) SetPayload(payload models.KmsStatusResponse) {
|
||||
func (o *KMSStatusOK) SetPayload(payload *models.KmsStatusResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
@@ -67,9 +67,11 @@ func (o *KMSStatusOK) SetPayload(payload models.KmsStatusResponse) {
|
||||
func (o *KMSStatusOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user