Implement KMS handlers (#2367)

This commit is contained in:
Javier Adriel
2022-10-07 12:50:17 -05:00
committed by GitHub
parent 9e7a40abc8
commit 59b7406dd7
67 changed files with 3463 additions and 276 deletions

4
go.mod
View File

@@ -23,11 +23,11 @@ require (
github.com/minio/directpv v1.4.4-0.20220805090942-948ca4731651
github.com/minio/highwayhash v1.0.2
github.com/minio/kes v0.19.2
github.com/minio/madmin-go v1.5.3
github.com/minio/madmin-go v1.6.1
github.com/minio/mc v0.0.0-20221001175248-68ca2bf457e4
github.com/minio/minio-go/v7 v7.0.40-0.20220928095841-8848d8affe8a
github.com/minio/operator v0.0.0-20220902184351-21e4073132b0
github.com/minio/pkg v1.4.3
github.com/minio/pkg v1.4.5
github.com/minio/selfupdate v0.5.0
github.com/mitchellh/go-homedir v1.1.0
github.com/rs/xid v1.4.0

828
go.sum

File diff suppressed because it is too large Load Diff

View File

@@ -22,7 +22,46 @@ package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// KmsAssignPolicyRequest kms assign policy request
//
// swagger:model kmsAssignPolicyRequest
type KmsAssignPolicyRequest interface{}
type KmsAssignPolicyRequest struct {
// identity
Identity string `json:"identity,omitempty"`
}
// Validate validates this kms assign policy request
func (m *KmsAssignPolicyRequest) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this kms assign policy request based on context it is used
func (m *KmsAssignPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *KmsAssignPolicyRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsAssignPolicyRequest) UnmarshalBinary(b []byte) error {
var res KmsAssignPolicyRequest
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -22,7 +22,67 @@ package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// KmsCreateKeyRequest kms create key request
//
// swagger:model kmsCreateKeyRequest
type KmsCreateKeyRequest interface{}
type KmsCreateKeyRequest struct {
// key
// Required: true
Key *string `json:"key"`
}
// Validate validates this kms create key request
func (m *KmsCreateKeyRequest) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateKey(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *KmsCreateKeyRequest) validateKey(formats strfmt.Registry) error {
if err := validate.Required("key", "body", m.Key); err != nil {
return err
}
return nil
}
// ContextValidate validates this kms create key request based on context it is used
func (m *KmsCreateKeyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *KmsCreateKeyRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsCreateKeyRequest) UnmarshalBinary(b []byte) error {
var res KmsCreateKeyRequest
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -22,7 +22,58 @@ package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// KmsDescribeIdentityResponse kms describe identity response
//
// swagger:model kmsDescribeIdentityResponse
type KmsDescribeIdentityResponse interface{}
type KmsDescribeIdentityResponse struct {
// admin
Admin bool `json:"admin,omitempty"`
// created at
CreatedAt string `json:"createdAt,omitempty"`
// created by
CreatedBy string `json:"createdBy,omitempty"`
// identity
Identity string `json:"identity,omitempty"`
// policy
Policy string `json:"policy,omitempty"`
}
// Validate validates this kms describe identity response
func (m *KmsDescribeIdentityResponse) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this kms describe identity response based on context it is used
func (m *KmsDescribeIdentityResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *KmsDescribeIdentityResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsDescribeIdentityResponse) UnmarshalBinary(b []byte) error {
var res KmsDescribeIdentityResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -22,7 +22,52 @@ package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// KmsDescribePolicyResponse kms describe policy response
//
// swagger:model kmsDescribePolicyResponse
type KmsDescribePolicyResponse interface{}
type KmsDescribePolicyResponse struct {
// created at
CreatedAt string `json:"createdAt,omitempty"`
// created by
CreatedBy string `json:"createdBy,omitempty"`
// name
Name string `json:"name,omitempty"`
}
// Validate validates this kms describe policy response
func (m *KmsDescribePolicyResponse) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this kms describe policy response based on context it is used
func (m *KmsDescribePolicyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *KmsDescribePolicyResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsDescribePolicyResponse) UnmarshalBinary(b []byte) error {
var res KmsDescribePolicyResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -22,7 +22,115 @@ package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// KmsDescribeSelfIdentityResponse kms describe self identity response
//
// swagger:model kmsDescribeSelfIdentityResponse
type KmsDescribeSelfIdentityResponse interface{}
type KmsDescribeSelfIdentityResponse struct {
// admin
Admin bool `json:"admin,omitempty"`
// created at
CreatedAt string `json:"createdAt,omitempty"`
// created by
CreatedBy string `json:"createdBy,omitempty"`
// identity
Identity string `json:"identity,omitempty"`
// policy
Policy *KmsGetPolicyResponse `json:"policy,omitempty"`
// policy name
PolicyName string `json:"policyName,omitempty"`
}
// Validate validates this kms describe self identity response
func (m *KmsDescribeSelfIdentityResponse) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validatePolicy(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *KmsDescribeSelfIdentityResponse) validatePolicy(formats strfmt.Registry) error {
if swag.IsZero(m.Policy) { // not required
return nil
}
if m.Policy != nil {
if err := m.Policy.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("policy")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("policy")
}
return err
}
}
return nil
}
// ContextValidate validate this kms describe self identity response based on the context it is used
func (m *KmsDescribeSelfIdentityResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidatePolicy(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *KmsDescribeSelfIdentityResponse) contextValidatePolicy(ctx context.Context, formats strfmt.Registry) error {
if m.Policy != nil {
if err := m.Policy.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("policy")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("policy")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *KmsDescribeSelfIdentityResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsDescribeSelfIdentityResponse) UnmarshalBinary(b []byte) error {
var res KmsDescribeSelfIdentityResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

70
models/kms_endpoint.go Normal file
View File

@@ -0,0 +1,70 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// KmsEndpoint kms endpoint
//
// swagger:model kmsEndpoint
type KmsEndpoint struct {
// status
Status string `json:"status,omitempty"`
// url
URL string `json:"url,omitempty"`
}
// Validate validates this kms endpoint
func (m *KmsEndpoint) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this kms endpoint based on context it is used
func (m *KmsEndpoint) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *KmsEndpoint) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsEndpoint) UnmarshalBinary(b []byte) error {
var res KmsEndpoint
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -22,7 +22,49 @@ package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// KmsGetPolicyResponse kms get policy response
//
// swagger:model kmsGetPolicyResponse
type KmsGetPolicyResponse interface{}
type KmsGetPolicyResponse struct {
// allow
Allow []string `json:"allow"`
// deny
Deny []string `json:"deny"`
}
// Validate validates this kms get policy response
func (m *KmsGetPolicyResponse) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this kms get policy response based on context it is used
func (m *KmsGetPolicyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *KmsGetPolicyResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsGetPolicyResponse) UnmarshalBinary(b []byte) error {
var res KmsGetPolicyResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,79 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// KmsIdentityInfo kms identity info
//
// swagger:model kmsIdentityInfo
type KmsIdentityInfo struct {
// created at
CreatedAt string `json:"createdAt,omitempty"`
// created by
CreatedBy string `json:"createdBy,omitempty"`
// error
Error string `json:"error,omitempty"`
// identity
Identity string `json:"identity,omitempty"`
// policy
Policy string `json:"policy,omitempty"`
}
// Validate validates this kms identity info
func (m *KmsIdentityInfo) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this kms identity info based on context it is used
func (m *KmsIdentityInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *KmsIdentityInfo) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsIdentityInfo) UnmarshalBinary(b []byte) error {
var res KmsIdentityInfo
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -22,7 +22,67 @@ package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// KmsImportKeyRequest kms import key request
//
// swagger:model kmsImportKeyRequest
type KmsImportKeyRequest interface{}
type KmsImportKeyRequest struct {
// bytes
// Required: true
Bytes *string `json:"bytes"`
}
// Validate validates this kms import key request
func (m *KmsImportKeyRequest) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateBytes(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *KmsImportKeyRequest) validateBytes(formats strfmt.Registry) error {
if err := validate.Required("bytes", "body", m.Bytes); err != nil {
return err
}
return nil
}
// ContextValidate validates this kms import key request based on context it is used
func (m *KmsImportKeyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *KmsImportKeyRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsImportKeyRequest) UnmarshalBinary(b []byte) error {
var res KmsImportKeyRequest
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

73
models/kms_key_info.go Normal file
View File

@@ -0,0 +1,73 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// KmsKeyInfo kms key info
//
// swagger:model kmsKeyInfo
type KmsKeyInfo struct {
// created at
CreatedAt string `json:"createdAt,omitempty"`
// created by
CreatedBy string `json:"createdBy,omitempty"`
// name
Name string `json:"name,omitempty"`
}
// Validate validates this kms key info
func (m *KmsKeyInfo) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this kms key info based on context it is used
func (m *KmsKeyInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *KmsKeyInfo) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsKeyInfo) UnmarshalBinary(b []byte) error {
var res KmsKeyInfo
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -22,7 +22,52 @@ package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// KmsKeyStatusResponse kms key status response
//
// swagger:model kmsKeyStatusResponse
type KmsKeyStatusResponse interface{}
type KmsKeyStatusResponse struct {
// decryption err
DecryptionErr string `json:"decryptionErr,omitempty"`
// encryption err
EncryptionErr string `json:"encryptionErr,omitempty"`
// key ID
KeyID string `json:"keyID,omitempty"`
}
// Validate validates this kms key status response
func (m *KmsKeyStatusResponse) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this kms key status response based on context it is used
func (m *KmsKeyStatusResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *KmsKeyStatusResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsKeyStatusResponse) UnmarshalBinary(b []byte) error {
var res KmsKeyStatusResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -22,7 +22,112 @@ package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// KmsListIdentitiesResponse kms list identities response
//
// swagger:model kmsListIdentitiesResponse
type KmsListIdentitiesResponse interface{}
type KmsListIdentitiesResponse struct {
// results
Results []*KmsIdentityInfo `json:"results"`
}
// Validate validates this kms list identities response
func (m *KmsListIdentitiesResponse) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateResults(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *KmsListIdentitiesResponse) validateResults(formats strfmt.Registry) error {
if swag.IsZero(m.Results) { // not required
return nil
}
for i := 0; i < len(m.Results); i++ {
if swag.IsZero(m.Results[i]) { // not required
continue
}
if m.Results[i] != nil {
if err := m.Results[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("results" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("results" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this kms list identities response based on the context it is used
func (m *KmsListIdentitiesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateResults(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *KmsListIdentitiesResponse) contextValidateResults(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Results); i++ {
if m.Results[i] != nil {
if err := m.Results[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("results" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("results" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *KmsListIdentitiesResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsListIdentitiesResponse) UnmarshalBinary(b []byte) error {
var res KmsListIdentitiesResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -22,7 +22,112 @@ package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// KmsListKeysResponse kms list keys response
//
// swagger:model kmsListKeysResponse
type KmsListKeysResponse interface{}
type KmsListKeysResponse struct {
// results
Results []*KmsKeyInfo `json:"results"`
}
// Validate validates this kms list keys response
func (m *KmsListKeysResponse) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateResults(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *KmsListKeysResponse) validateResults(formats strfmt.Registry) error {
if swag.IsZero(m.Results) { // not required
return nil
}
for i := 0; i < len(m.Results); i++ {
if swag.IsZero(m.Results[i]) { // not required
continue
}
if m.Results[i] != nil {
if err := m.Results[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("results" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("results" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this kms list keys response based on the context it is used
func (m *KmsListKeysResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateResults(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *KmsListKeysResponse) contextValidateResults(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Results); i++ {
if m.Results[i] != nil {
if err := m.Results[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("results" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("results" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *KmsListKeysResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsListKeysResponse) UnmarshalBinary(b []byte) error {
var res KmsListKeysResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -22,7 +22,112 @@ package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// KmsListPoliciesResponse kms list policies response
//
// swagger:model kmsListPoliciesResponse
type KmsListPoliciesResponse interface{}
type KmsListPoliciesResponse struct {
// results
Results []*KmsPolicyInfo `json:"results"`
}
// Validate validates this kms list policies response
func (m *KmsListPoliciesResponse) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateResults(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *KmsListPoliciesResponse) validateResults(formats strfmt.Registry) error {
if swag.IsZero(m.Results) { // not required
return nil
}
for i := 0; i < len(m.Results); i++ {
if swag.IsZero(m.Results[i]) { // not required
continue
}
if m.Results[i] != nil {
if err := m.Results[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("results" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("results" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this kms list policies response based on the context it is used
func (m *KmsListPoliciesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateResults(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *KmsListPoliciesResponse) contextValidateResults(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Results); i++ {
if m.Results[i] != nil {
if err := m.Results[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("results" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("results" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *KmsListPoliciesResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsListPoliciesResponse) UnmarshalBinary(b []byte) error {
var res KmsListPoliciesResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

73
models/kms_policy_info.go Normal file
View File

@@ -0,0 +1,73 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// KmsPolicyInfo kms policy info
//
// swagger:model kmsPolicyInfo
type KmsPolicyInfo struct {
// created at
CreatedAt string `json:"createdAt,omitempty"`
// created by
CreatedBy string `json:"createdBy,omitempty"`
// name
Name string `json:"name,omitempty"`
}
// Validate validates this kms policy info
func (m *KmsPolicyInfo) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this kms policy info based on context it is used
func (m *KmsPolicyInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *KmsPolicyInfo) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsPolicyInfo) UnmarshalBinary(b []byte) error {
var res KmsPolicyInfo
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -22,7 +22,73 @@ package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// KmsSetPolicyRequest kms set policy request
//
// swagger:model kmsSetPolicyRequest
type KmsSetPolicyRequest interface{}
type KmsSetPolicyRequest struct {
// allow
Allow []string `json:"allow"`
// deny
Deny []string `json:"deny"`
// policy
// Required: true
Policy *string `json:"policy"`
}
// Validate validates this kms set policy request
func (m *KmsSetPolicyRequest) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validatePolicy(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *KmsSetPolicyRequest) validatePolicy(formats strfmt.Registry) error {
if err := validate.Required("policy", "body", m.Policy); err != nil {
return err
}
return nil
}
// ContextValidate validates this kms set policy request based on context it is used
func (m *KmsSetPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *KmsSetPolicyRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsSetPolicyRequest) UnmarshalBinary(b []byte) error {
var res KmsSetPolicyRequest
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -22,7 +22,118 @@ package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// KmsStatusResponse kms status response
//
// swagger:model kmsStatusResponse
type KmsStatusResponse interface{}
type KmsStatusResponse struct {
// default key ID
DefaultKeyID string `json:"defaultKeyID,omitempty"`
// endpoints
Endpoints []*KmsEndpoint `json:"endpoints"`
// name
Name string `json:"name,omitempty"`
}
// Validate validates this kms status response
func (m *KmsStatusResponse) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateEndpoints(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *KmsStatusResponse) validateEndpoints(formats strfmt.Registry) error {
if swag.IsZero(m.Endpoints) { // not required
return nil
}
for i := 0; i < len(m.Endpoints); i++ {
if swag.IsZero(m.Endpoints[i]) { // not required
continue
}
if m.Endpoints[i] != nil {
if err := m.Endpoints[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("endpoints" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("endpoints" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this kms status response based on the context it is used
func (m *KmsStatusResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateEndpoints(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *KmsStatusResponse) contextValidateEndpoints(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Endpoints); i++ {
if m.Endpoints[i] != nil {
if err := m.Endpoints[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("endpoints" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("endpoints" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *KmsStatusResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *KmsStatusResponse) UnmarshalBinary(b []byte) error {
var res KmsStatusResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -19,11 +19,13 @@ package restapi
import (
"context"
"encoding/json"
"github.com/go-openapi/runtime/middleware"
"github.com/minio/console/models"
"github.com/minio/console/restapi/operations"
kmsAPI "github.com/minio/console/restapi/operations/k_m_s"
"github.com/minio/madmin-go"
)
func registerKMSHandlers(api *operations.ConsoleAPI) {
@@ -84,37 +86,140 @@ func registerKMSKeyHandlers(api *operations.ConsoleAPI) {
func GetKMSStatusResponse(session *models.Principal, params kmsAPI.KMSStatusParams) (*models.KmsStatusResponse, *models.Error) {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
return nil, ErrorWithContext(ctx, ErrDefault)
mAdmin, err := NewMinioAdminClient(session)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
return kmsStatus(ctx, AdminClient{Client: mAdmin})
}
func kmsStatus(ctx context.Context, minioClient MinioAdmin) (*models.KmsStatusResponse, *models.Error) {
st, err := minioClient.kmsStatus(ctx)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
return &models.KmsStatusResponse{
DefaultKeyID: st.DefaultKeyID,
Name: st.Name,
Endpoints: parseStatusEndpoints(st.Endpoints),
}, nil
}
func parseStatusEndpoints(endpoints map[string]madmin.ItemState) (kmsEndpoints []*models.KmsEndpoint) {
for key, value := range endpoints {
kmsEndpoints = append(kmsEndpoints, &models.KmsEndpoint{URL: key, Status: string(value)})
}
return kmsEndpoints
}
func GetKMSCreateKeyResponse(session *models.Principal, params kmsAPI.KMSCreateKeyParams) *models.Error {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
return ErrorWithContext(ctx, ErrDefault)
mAdmin, err := NewMinioAdminClient(session)
if err != nil {
return ErrorWithContext(ctx, err)
}
return createKey(ctx, *params.Body.Key, AdminClient{Client: mAdmin})
}
func createKey(ctx context.Context, key string, minioClient MinioAdmin) *models.Error {
if err := minioClient.createKey(ctx, key); err != nil {
return ErrorWithContext(ctx, err)
}
return nil
}
func GetKMSImportKeyResponse(session *models.Principal, params kmsAPI.KMSImportKeyParams) *models.Error {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
return ErrorWithContext(ctx, ErrDefault)
mAdmin, err := NewMinioAdminClient(session)
if err != nil {
return ErrorWithContext(ctx, err)
}
bytes, err := json.Marshal(params.Body)
if err != nil {
return ErrorWithContext(ctx, err)
}
return importKey(ctx, params.Name, bytes, AdminClient{Client: mAdmin})
}
func importKey(ctx context.Context, key string, bytes []byte, minioClient MinioAdmin) *models.Error {
if err := minioClient.importKey(ctx, key, bytes); err != nil {
return ErrorWithContext(ctx, err)
}
return nil
}
func GetKMSListKeysResponse(session *models.Principal, params kmsAPI.KMSListKeysParams) (*models.KmsListKeysResponse, *models.Error) {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
return nil, ErrorWithContext(ctx, ErrDefault)
mAdmin, err := NewMinioAdminClient(session)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
pattern := ""
if params.Pattern != nil {
pattern = *params.Pattern
}
return listKeys(ctx, pattern, AdminClient{Client: mAdmin})
}
func listKeys(ctx context.Context, pattern string, minioClient MinioAdmin) (*models.KmsListKeysResponse, *models.Error) {
results, err := minioClient.listKeys(ctx, pattern)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
return &models.KmsListKeysResponse{Results: parseKeys(results)}, nil
}
func parseKeys(results []madmin.KMSKeyInfo) (data []*models.KmsKeyInfo) {
for _, key := range results {
data = append(data, &models.KmsKeyInfo{
CreatedAt: key.CreatedAt,
CreatedBy: key.CreatedBy,
Name: key.Name,
})
}
return data
}
func GetKMSKeyStatusResponse(session *models.Principal, params kmsAPI.KMSKeyStatusParams) (*models.KmsKeyStatusResponse, *models.Error) {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
return nil, ErrorWithContext(ctx, ErrDefault)
mAdmin, err := NewMinioAdminClient(session)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
return keyStatus(ctx, params.Name, AdminClient{Client: mAdmin})
}
func keyStatus(ctx context.Context, key string, minioClient MinioAdmin) (*models.KmsKeyStatusResponse, *models.Error) {
ks, err := minioClient.keyStatus(ctx, key)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
return &models.KmsKeyStatusResponse{
KeyID: ks.KeyID,
EncryptionErr: ks.EncryptionErr,
DecryptionErr: ks.DecryptionErr,
}, nil
}
func GetKMSDeleteKeyResponse(session *models.Principal, params kmsAPI.KMSDeleteKeyParams) *models.Error {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
return ErrorWithContext(ctx, ErrDefault)
mAdmin, err := NewMinioAdminClient(session)
if err != nil {
return ErrorWithContext(ctx, err)
}
return deleteKey(ctx, params.Name, AdminClient{Client: mAdmin})
}
func deleteKey(ctx context.Context, key string, minioClient MinioAdmin) *models.Error {
if err := minioClient.deleteKey(ctx, key); err != nil {
return ErrorWithContext(ctx, err)
}
return nil
}
func registerKMSPolicyHandlers(api *operations.ConsoleAPI) {
@@ -157,6 +262,7 @@ func registerKMSPolicyHandlers(api *operations.ConsoleAPI) {
}
return kmsAPI.NewKMSListPoliciesOK().WithPayload(resp)
})
api.KmsKMSDeletePolicyHandler = kmsAPI.KMSDeletePolicyHandlerFunc(func(params kmsAPI.KMSDeletePolicyParams, session *models.Principal) middleware.Responder {
err := GetKMSDeletePolicyResponse(session, params)
if err != nil {
@@ -169,37 +275,136 @@ func registerKMSPolicyHandlers(api *operations.ConsoleAPI) {
func GetKMSSetPolicyResponse(session *models.Principal, params kmsAPI.KMSSetPolicyParams) *models.Error {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
return ErrorWithContext(ctx, ErrDefault)
mAdmin, err := NewMinioAdminClient(session)
if err != nil {
return ErrorWithContext(ctx, err)
}
bytes, err := json.Marshal(params.Body)
if err != nil {
return ErrorWithContext(ctx, err)
}
return setPolicy(ctx, *params.Body.Policy, bytes, AdminClient{Client: mAdmin})
}
func setPolicy(ctx context.Context, policy string, content []byte, minioClient MinioAdmin) *models.Error {
if err := minioClient.setKMSPolicy(ctx, policy, content); err != nil {
return ErrorWithContext(ctx, err)
}
return nil
}
func GetKMSAssignPolicyResponse(session *models.Principal, params kmsAPI.KMSAssignPolicyParams) *models.Error {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
return ErrorWithContext(ctx, ErrDefault)
mAdmin, err := NewMinioAdminClient(session)
if err != nil {
return ErrorWithContext(ctx, err)
}
bytes, err := json.Marshal(params.Body)
if err != nil {
return ErrorWithContext(ctx, err)
}
return assignPolicy(ctx, params.Name, bytes, AdminClient{Client: mAdmin})
}
func assignPolicy(ctx context.Context, policy string, content []byte, minioClient MinioAdmin) *models.Error {
if err := minioClient.assignPolicy(ctx, policy, content); err != nil {
return ErrorWithContext(ctx, err)
}
return nil
}
func GetKMSDescribePolicyResponse(session *models.Principal, params kmsAPI.KMSDescribePolicyParams) (*models.KmsDescribePolicyResponse, *models.Error) {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
return nil, ErrorWithContext(ctx, ErrDefault)
mAdmin, err := NewMinioAdminClient(session)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
return describePolicy(ctx, params.Name, AdminClient{Client: mAdmin})
}
func describePolicy(ctx context.Context, policy string, minioClient MinioAdmin) (*models.KmsDescribePolicyResponse, *models.Error) {
dp, err := minioClient.describePolicy(ctx, policy)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
return &models.KmsDescribePolicyResponse{
Name: dp.Name,
CreatedAt: dp.CreatedAt,
CreatedBy: dp.CreatedBy,
}, nil
}
func GetKMSGetPolicyResponse(session *models.Principal, params kmsAPI.KMSGetPolicyParams) (*models.KmsGetPolicyResponse, *models.Error) {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
return nil, ErrorWithContext(ctx, ErrDefault)
mAdmin, err := NewMinioAdminClient(session)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
return getPolicy(ctx, params.Name, AdminClient{Client: mAdmin})
}
func getPolicy(ctx context.Context, policy string, minioClient MinioAdmin) (*models.KmsGetPolicyResponse, *models.Error) {
p, err := minioClient.getKMSPolicy(ctx, policy)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
return &models.KmsGetPolicyResponse{
Allow: p.Allow,
Deny: p.Deny,
}, nil
}
func GetKMSListPoliciesResponse(session *models.Principal, params kmsAPI.KMSListPoliciesParams) (*models.KmsListPoliciesResponse, *models.Error) {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
return nil, ErrorWithContext(ctx, ErrDefault)
mAdmin, err := NewMinioAdminClient(session)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
pattern := ""
if params.Pattern != nil {
pattern = *params.Pattern
}
return listKMSPolicies(ctx, pattern, AdminClient{Client: mAdmin})
}
func listKMSPolicies(ctx context.Context, pattern string, minioClient MinioAdmin) (*models.KmsListPoliciesResponse, *models.Error) {
results, err := minioClient.listKMSPolicies(ctx, pattern)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
return &models.KmsListPoliciesResponse{Results: parsePolicies(results)}, nil
}
func parsePolicies(results []madmin.KMSPolicyInfo) (data []*models.KmsPolicyInfo) {
for _, policy := range results {
data = append(data, &models.KmsPolicyInfo{
CreatedAt: policy.CreatedAt,
CreatedBy: policy.CreatedBy,
Name: policy.Name,
})
}
return data
}
func GetKMSDeletePolicyResponse(session *models.Principal, params kmsAPI.KMSDeletePolicyParams) *models.Error {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
return ErrorWithContext(ctx, ErrDefault)
mAdmin, err := NewMinioAdminClient(session)
if err != nil {
return ErrorWithContext(ctx, err)
}
return deletePolicy(ctx, params.Name, AdminClient{Client: mAdmin})
}
func deletePolicy(ctx context.Context, policy string, minioClient MinioAdmin) *models.Error {
if err := minioClient.deletePolicy(ctx, policy); err != nil {
return ErrorWithContext(ctx, err)
}
return nil
}
func registerKMSIdentityHandlers(api *operations.ConsoleAPI) {
@@ -238,23 +443,102 @@ func registerKMSIdentityHandlers(api *operations.ConsoleAPI) {
func GetKMSDescribeIdentityResponse(session *models.Principal, params kmsAPI.KMSDescribeIdentityParams) (*models.KmsDescribeIdentityResponse, *models.Error) {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
return nil, ErrorWithContext(ctx, ErrDefault)
mAdmin, err := NewMinioAdminClient(session)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
return describeIdentity(ctx, params.Name, AdminClient{Client: mAdmin})
}
func describeIdentity(ctx context.Context, identity string, minioClient MinioAdmin) (*models.KmsDescribeIdentityResponse, *models.Error) {
i, err := minioClient.describeIdentity(ctx, identity)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
return &models.KmsDescribeIdentityResponse{
Policy: i.Policy,
Admin: i.IsAdmin,
Identity: i.Identity,
CreatedAt: i.CreatedAt,
CreatedBy: i.CreatedBy,
}, nil
}
func GetKMSDescribeSelfIdentityResponse(session *models.Principal, params kmsAPI.KMSDescribeSelfIdentityParams) (*models.KmsDescribeSelfIdentityResponse, *models.Error) {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
return nil, ErrorWithContext(ctx, ErrDefault)
mAdmin, err := NewMinioAdminClient(session)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
return describeSelfIdentity(ctx, AdminClient{Client: mAdmin})
}
func describeSelfIdentity(ctx context.Context, minioClient MinioAdmin) (*models.KmsDescribeSelfIdentityResponse, *models.Error) {
i, err := minioClient.describeSelfIdentity(ctx)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
return &models.KmsDescribeSelfIdentityResponse{
Policy: &models.KmsGetPolicyResponse{
Allow: i.Policy.Allow,
Deny: i.Policy.Deny,
},
Identity: i.Identity,
Admin: i.IsAdmin,
CreatedAt: i.CreatedAt,
CreatedBy: i.CreatedBy,
}, nil
}
func GetKMSListIdentitiesResponse(session *models.Principal, params kmsAPI.KMSListIdentitiesParams) (*models.KmsListIdentitiesResponse, *models.Error) {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
return nil, ErrorWithContext(ctx, ErrDefault)
mAdmin, err := NewMinioAdminClient(session)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
pattern := ""
if params.Pattern != nil {
pattern = *params.Pattern
}
return listIdentities(ctx, pattern, AdminClient{Client: mAdmin})
}
func listIdentities(ctx context.Context, pattern string, minioClient MinioAdmin) (*models.KmsListIdentitiesResponse, *models.Error) {
results, err := minioClient.listIdentities(ctx, pattern)
if err != nil {
return nil, ErrorWithContext(ctx, err)
}
return &models.KmsListIdentitiesResponse{Results: parseIdentities(results)}, nil
}
func parseIdentities(results []madmin.KMSIdentityInfo) (data []*models.KmsIdentityInfo) {
for _, policy := range results {
data = append(data, &models.KmsIdentityInfo{
CreatedAt: policy.CreatedAt,
CreatedBy: policy.CreatedBy,
Identity: policy.Identity,
Error: policy.Error,
Policy: policy.Policy,
})
}
return data
}
func GetKMSDeleteIdentityResponse(session *models.Principal, params kmsAPI.KMSDeleteIdentityParams) *models.Error {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
return ErrorWithContext(ctx, ErrDefault)
mAdmin, err := NewMinioAdminClient(session)
if err != nil {
return ErrorWithContext(ctx, err)
}
return deleteIdentity(ctx, params.Name, AdminClient{Client: mAdmin})
}
func deleteIdentity(ctx context.Context, identity string, minioClient MinioAdmin) *models.Error {
if err := minioClient.deleteIdentity(ctx, identity); err != nil {
return ErrorWithContext(ctx, err)
}
return nil
}

View File

@@ -17,28 +17,127 @@
package restapi
import (
"context"
"net/http"
"net/http/httptest"
"os"
"testing"
"github.com/minio/console/models"
"github.com/minio/console/restapi/operations"
kmsAPI "github.com/minio/console/restapi/operations/k_m_s"
"github.com/minio/madmin-go"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
)
func (ac adminClientMock) kmsStatus(ctx context.Context) (madmin.KMSStatus, error) {
return madmin.KMSStatus{Name: "name", DefaultKeyID: "key", Endpoints: map[string]madmin.ItemState{"localhost": madmin.ItemState("online")}}, nil
}
func (ac adminClientMock) createKey(ctx context.Context, key string) error {
return nil
}
func (ac adminClientMock) importKey(ctx context.Context, key string, content []byte) error {
return nil
}
func (ac adminClientMock) listKeys(ctx context.Context, pattern string) ([]madmin.KMSKeyInfo, error) {
return []madmin.KMSKeyInfo{{
Name: "name",
CreatedBy: "by",
}}, nil
}
func (ac adminClientMock) keyStatus(ctx context.Context, key string) (*madmin.KMSKeyStatus, error) {
return &madmin.KMSKeyStatus{KeyID: "key"}, nil
}
func (ac adminClientMock) deleteKey(ctx context.Context, key string) error {
return nil
}
func (ac adminClientMock) setKMSPolicy(ctx context.Context, policy string, content []byte) error {
return nil
}
func (ac adminClientMock) assignPolicy(ctx context.Context, policy string, content []byte) error {
return nil
}
func (ac adminClientMock) describePolicy(ctx context.Context, policy string) (*madmin.KMSDescribePolicy, error) {
return &madmin.KMSDescribePolicy{Name: "name"}, nil
}
func (ac adminClientMock) getKMSPolicy(ctx context.Context, policy string) (*madmin.KMSPolicy, error) {
return &madmin.KMSPolicy{Allow: []string{""}, Deny: []string{""}}, nil
}
func (ac adminClientMock) listKMSPolicies(ctx context.Context, pattern string) ([]madmin.KMSPolicyInfo, error) {
return []madmin.KMSPolicyInfo{{
Name: "name",
CreatedBy: "by",
}}, nil
}
func (ac adminClientMock) deletePolicy(ctx context.Context, policy string) error {
return nil
}
func (ac adminClientMock) describeIdentity(ctx context.Context, identity string) (*madmin.KMSDescribeIdentity, error) {
return &madmin.KMSDescribeIdentity{}, nil
}
func (ac adminClientMock) describeSelfIdentity(ctx context.Context) (*madmin.KMSDescribeSelfIdentity, error) {
return &madmin.KMSDescribeSelfIdentity{
Policy: &madmin.KMSPolicy{Allow: []string{}, Deny: []string{}},
}, nil
}
func (ac adminClientMock) deleteIdentity(ctx context.Context, identity string) error {
return nil
}
func (ac adminClientMock) listIdentities(ctx context.Context, pattern string) ([]madmin.KMSIdentityInfo, error) {
return []madmin.KMSIdentityInfo{{Identity: "identity"}}, nil
}
type KMSTestSuite struct {
suite.Suite
assert *assert.Assertions
assert *assert.Assertions
currentServer string
isServerSet bool
server *httptest.Server
adminClient adminClientMock
}
func (suite *KMSTestSuite) SetupSuite() {
suite.assert = assert.New(suite.T())
suite.adminClient = adminClientMock{}
}
func (suite *KMSTestSuite) SetupTest() {
suite.server = httptest.NewServer(http.HandlerFunc(suite.serverHandler))
suite.currentServer, suite.isServerSet = os.LookupEnv(ConsoleMinIOServer)
os.Setenv(ConsoleMinIOServer, suite.server.URL)
}
func (suite *KMSTestSuite) serverHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(400)
}
func (suite *KMSTestSuite) TearDownSuite() {
}
func (suite *KMSTestSuite) TearDownTest() {
if suite.isServerSet {
os.Setenv(ConsoleMinIOServer, suite.currentServer)
} else {
os.Unsetenv(ConsoleMinIOServer)
}
}
func (suite *KMSTestSuite) TestRegisterKMSHandlers() {
api := &operations.ConsoleAPI{}
suite.assertHandlersAreNil(api)
@@ -97,6 +196,13 @@ func (suite *KMSTestSuite) initKMSStatusRequest() (params kmsAPI.KMSStatusParams
return params, api
}
func (suite *KMSTestSuite) TestKMSStatusWithoutError() {
ctx := context.Background()
res, err := kmsStatus(ctx, suite.adminClient)
suite.assert.NotNil(res)
suite.assert.Nil(err)
}
func (suite *KMSTestSuite) TestKMSCreateKeyHandlerWithError() {
params, api := suite.initKMSCreateKeyRequest()
response := api.KmsKMSCreateKeyHandler.Handle(params, &models.Principal{})
@@ -107,9 +213,17 @@ func (suite *KMSTestSuite) TestKMSCreateKeyHandlerWithError() {
func (suite *KMSTestSuite) initKMSCreateKeyRequest() (params kmsAPI.KMSCreateKeyParams, api operations.ConsoleAPI) {
registerKMSHandlers(&api)
params.HTTPRequest = &http.Request{}
key := "key"
params.Body = &models.KmsCreateKeyRequest{Key: &key}
return params, api
}
func (suite *KMSTestSuite) TestKMSCreateKeyWithoutError() {
ctx := context.Background()
err := createKey(ctx, "key", suite.adminClient)
suite.assert.Nil(err)
}
func (suite *KMSTestSuite) TestKMSImportKeyHandlerWithError() {
params, api := suite.initKMSImportKeyRequest()
response := api.KmsKMSImportKeyHandler.Handle(params, &models.Principal{})
@@ -123,6 +237,12 @@ func (suite *KMSTestSuite) initKMSImportKeyRequest() (params kmsAPI.KMSImportKey
return params, api
}
func (suite *KMSTestSuite) TestKMSImportKeyWithoutError() {
ctx := context.Background()
err := importKey(ctx, "key", []byte(""), suite.adminClient)
suite.assert.Nil(err)
}
func (suite *KMSTestSuite) TestKMSListKeysHandlerWithError() {
params, api := suite.initKMSListKeysRequest()
response := api.KmsKMSListKeysHandler.Handle(params, &models.Principal{})
@@ -136,6 +256,13 @@ func (suite *KMSTestSuite) initKMSListKeysRequest() (params kmsAPI.KMSListKeysPa
return params, api
}
func (suite *KMSTestSuite) TestKMSListKeysWithoutError() {
ctx := context.Background()
res, err := listKeys(ctx, "", suite.adminClient)
suite.assert.NotNil(res)
suite.assert.Nil(err)
}
func (suite *KMSTestSuite) TestKMSKeyStatusHandlerWithError() {
params, api := suite.initKMSKeyStatusRequest()
response := api.KmsKMSKeyStatusHandler.Handle(params, &models.Principal{})
@@ -149,6 +276,13 @@ func (suite *KMSTestSuite) initKMSKeyStatusRequest() (params kmsAPI.KMSKeyStatus
return params, api
}
func (suite *KMSTestSuite) TestKMSKeyStatusWithoutError() {
ctx := context.Background()
res, err := keyStatus(ctx, "key", suite.adminClient)
suite.assert.NotNil(res)
suite.assert.Nil(err)
}
func (suite *KMSTestSuite) TestKMSDeleteKeyHandlerWithError() {
params, api := suite.initKMSDeleteKeyRequest()
response := api.KmsKMSDeleteKeyHandler.Handle(params, &models.Principal{})
@@ -162,6 +296,12 @@ func (suite *KMSTestSuite) initKMSDeleteKeyRequest() (params kmsAPI.KMSDeleteKey
return params, api
}
func (suite *KMSTestSuite) TestKMSDeleteKeyWithoutError() {
ctx := context.Background()
err := deleteKey(ctx, "key", suite.adminClient)
suite.assert.Nil(err)
}
func (suite *KMSTestSuite) TestKMSSetPolicyHandlerWithError() {
params, api := suite.initKMSSetPolicyRequest()
response := api.KmsKMSSetPolicyHandler.Handle(params, &models.Principal{})
@@ -172,9 +312,17 @@ func (suite *KMSTestSuite) TestKMSSetPolicyHandlerWithError() {
func (suite *KMSTestSuite) initKMSSetPolicyRequest() (params kmsAPI.KMSSetPolicyParams, api operations.ConsoleAPI) {
registerKMSHandlers(&api)
params.HTTPRequest = &http.Request{}
policy := "policy"
params.Body = &models.KmsSetPolicyRequest{Policy: &policy}
return params, api
}
func (suite *KMSTestSuite) TestKMSSetPolicyWithoutError() {
ctx := context.Background()
err := setPolicy(ctx, "policy", []byte(""), suite.adminClient)
suite.assert.Nil(err)
}
func (suite *KMSTestSuite) TestKMSAssignPolicyHandlerWithError() {
params, api := suite.initKMSAssignPolicyRequest()
response := api.KmsKMSAssignPolicyHandler.Handle(params, &models.Principal{})
@@ -188,6 +336,12 @@ func (suite *KMSTestSuite) initKMSAssignPolicyRequest() (params kmsAPI.KMSAssign
return params, api
}
func (suite *KMSTestSuite) TestKMSAssignPolicyWithoutError() {
ctx := context.Background()
err := assignPolicy(ctx, "policy", []byte(""), suite.adminClient)
suite.assert.Nil(err)
}
func (suite *KMSTestSuite) TestKMSDescribePolicyHandlerWithError() {
params, api := suite.initKMSDescribePolicyRequest()
response := api.KmsKMSDescribePolicyHandler.Handle(params, &models.Principal{})
@@ -201,6 +355,13 @@ func (suite *KMSTestSuite) initKMSDescribePolicyRequest() (params kmsAPI.KMSDesc
return params, api
}
func (suite *KMSTestSuite) TestKMSDescribePolicyWithoutError() {
ctx := context.Background()
res, err := describePolicy(ctx, "policy", suite.adminClient)
suite.assert.NotNil(res)
suite.assert.Nil(err)
}
func (suite *KMSTestSuite) TestKMSGetPolicyHandlerWithError() {
params, api := suite.initKMSGetPolicyRequest()
response := api.KmsKMSGetPolicyHandler.Handle(params, &models.Principal{})
@@ -214,6 +375,13 @@ func (suite *KMSTestSuite) initKMSGetPolicyRequest() (params kmsAPI.KMSGetPolicy
return params, api
}
func (suite *KMSTestSuite) TestKMSGetPolicyWithoutError() {
ctx := context.Background()
res, err := getPolicy(ctx, "policy", suite.adminClient)
suite.assert.NotNil(res)
suite.assert.Nil(err)
}
func (suite *KMSTestSuite) TestKMSListPoliciesHandlerWithError() {
params, api := suite.initKMSListPoliciesRequest()
response := api.KmsKMSListPoliciesHandler.Handle(params, &models.Principal{})
@@ -227,6 +395,13 @@ func (suite *KMSTestSuite) initKMSListPoliciesRequest() (params kmsAPI.KMSListPo
return params, api
}
func (suite *KMSTestSuite) TestKMSListPoliciesWithoutError() {
ctx := context.Background()
res, err := listKMSPolicies(ctx, "", suite.adminClient)
suite.assert.NotNil(res)
suite.assert.Nil(err)
}
func (suite *KMSTestSuite) TestKMSDeletePolicyHandlerWithError() {
params, api := suite.initKMSDeletePolicyRequest()
response := api.KmsKMSDeletePolicyHandler.Handle(params, &models.Principal{})
@@ -240,6 +415,12 @@ func (suite *KMSTestSuite) initKMSDeletePolicyRequest() (params kmsAPI.KMSDelete
return params, api
}
func (suite *KMSTestSuite) TestKMSDeletePolicyWithoutError() {
ctx := context.Background()
err := deletePolicy(ctx, "policy", suite.adminClient)
suite.assert.Nil(err)
}
func (suite *KMSTestSuite) TestKMSDescribeIdentityHandlerWithError() {
params, api := suite.initKMSDescribeIdentityRequest()
response := api.KmsKMSDescribeIdentityHandler.Handle(params, &models.Principal{})
@@ -253,6 +434,13 @@ func (suite *KMSTestSuite) initKMSDescribeIdentityRequest() (params kmsAPI.KMSDe
return params, api
}
func (suite *KMSTestSuite) TestKMSDescribeIdentityWithoutError() {
ctx := context.Background()
res, err := describeIdentity(ctx, "identity", suite.adminClient)
suite.assert.NotNil(res)
suite.assert.Nil(err)
}
func (suite *KMSTestSuite) TestKMSDescribeSelfIdentityHandlerWithError() {
params, api := suite.initKMSDescribeSelfIdentityRequest()
response := api.KmsKMSDescribeSelfIdentityHandler.Handle(params, &models.Principal{})
@@ -266,6 +454,13 @@ func (suite *KMSTestSuite) initKMSDescribeSelfIdentityRequest() (params kmsAPI.K
return params, api
}
func (suite *KMSTestSuite) TestKMSDescribeSelfIdentityWithoutError() {
ctx := context.Background()
res, err := describeSelfIdentity(ctx, suite.adminClient)
suite.assert.NotNil(res)
suite.assert.Nil(err)
}
func (suite *KMSTestSuite) TestKMSListIdentitiesHandlerWithError() {
params, api := suite.initKMSListIdentitiesRequest()
response := api.KmsKMSListIdentitiesHandler.Handle(params, &models.Principal{})
@@ -279,6 +474,13 @@ func (suite *KMSTestSuite) initKMSListIdentitiesRequest() (params kmsAPI.KMSList
return params, api
}
func (suite *KMSTestSuite) TestKMSListIdentitiesWithoutError() {
ctx := context.Background()
res, err := listIdentities(ctx, "", suite.adminClient)
suite.assert.NotNil(res)
suite.assert.Nil(err)
}
func (suite *KMSTestSuite) TestKMSDeleteIdentityHandlerWithError() {
params, api := suite.initKMSDeleteIdentityRequest()
response := api.KmsKMSDeleteIdentityHandler.Handle(params, &models.Principal{})
@@ -292,6 +494,12 @@ func (suite *KMSTestSuite) initKMSDeleteIdentityRequest() (params kmsAPI.KMSDele
return params, api
}
func (suite *KMSTestSuite) TestKMSDeleteIdentityWithoutError() {
ctx := context.Background()
err := deleteIdentity(ctx, "identity", suite.adminClient)
suite.assert.Nil(err)
}
func TestKMS(t *testing.T) {
suite.Run(t, new(KMSTestSuite))
}

View File

@@ -123,6 +123,24 @@ type MinioAdmin interface {
// Replication status
getSiteReplicationStatus(ctx context.Context, params madmin.SRStatusOptions) (*madmin.SRStatusInfo, error)
// KMS
kmsStatus(ctx context.Context) (madmin.KMSStatus, error)
createKey(ctx context.Context, key string) error
importKey(ctx context.Context, key string, content []byte) error
listKeys(ctx context.Context, pattern string) ([]madmin.KMSKeyInfo, error)
keyStatus(ctx context.Context, key string) (*madmin.KMSKeyStatus, error)
deleteKey(ctx context.Context, key string) error
setKMSPolicy(ctx context.Context, policy string, content []byte) error
assignPolicy(ctx context.Context, policy string, content []byte) error
describePolicy(ctx context.Context, policy string) (*madmin.KMSDescribePolicy, error)
getKMSPolicy(ctx context.Context, policy string) (*madmin.KMSPolicy, error)
listKMSPolicies(ctx context.Context, pattern string) ([]madmin.KMSPolicyInfo, error)
deletePolicy(ctx context.Context, policy string) error
describeIdentity(ctx context.Context, identity string) (*madmin.KMSDescribeIdentity, error)
describeSelfIdentity(ctx context.Context) (*madmin.KMSDescribeSelfIdentity, error)
deleteIdentity(ctx context.Context, identity string) error
listIdentities(ctx context.Context, pattern string) ([]madmin.KMSIdentityInfo, error)
}
// Interface implementation
@@ -552,3 +570,67 @@ func (ac AdminClient) getSiteReplicationStatus(ctx context.Context, params madmi
}
return &res, nil
}
func (ac AdminClient) kmsStatus(ctx context.Context) (madmin.KMSStatus, error) {
return ac.Client.KMSStatus(ctx)
}
func (ac AdminClient) createKey(ctx context.Context, key string) error {
return ac.Client.CreateKey(ctx, key)
}
func (ac AdminClient) importKey(ctx context.Context, key string, content []byte) error {
return ac.Client.ImportKey(ctx, key, content)
}
func (ac AdminClient) listKeys(ctx context.Context, pattern string) ([]madmin.KMSKeyInfo, error) {
return ac.Client.ListKeys(ctx, pattern)
}
func (ac AdminClient) keyStatus(ctx context.Context, key string) (*madmin.KMSKeyStatus, error) {
return ac.Client.GetKeyStatus(ctx, key)
}
func (ac AdminClient) deleteKey(ctx context.Context, key string) error {
return ac.Client.DeleteKey(ctx, key)
}
func (ac AdminClient) setKMSPolicy(ctx context.Context, policy string, content []byte) error {
return ac.Client.SetKMSPolicy(ctx, policy, content)
}
func (ac AdminClient) assignPolicy(ctx context.Context, policy string, content []byte) error {
return ac.Client.AssignPolicy(ctx, policy, content)
}
func (ac AdminClient) describePolicy(ctx context.Context, policy string) (*madmin.KMSDescribePolicy, error) {
return ac.Client.DescribePolicy(ctx, policy)
}
func (ac AdminClient) getKMSPolicy(ctx context.Context, policy string) (*madmin.KMSPolicy, error) {
return ac.Client.GetPolicy(ctx, policy)
}
func (ac AdminClient) listKMSPolicies(ctx context.Context, pattern string) ([]madmin.KMSPolicyInfo, error) {
return ac.Client.ListPolicies(ctx, pattern)
}
func (ac AdminClient) deletePolicy(ctx context.Context, policy string) error {
return ac.Client.DeletePolicy(ctx, policy)
}
func (ac AdminClient) describeIdentity(ctx context.Context, identity string) (*madmin.KMSDescribeIdentity, error) {
return ac.Client.DescribeIdentity(ctx, identity)
}
func (ac AdminClient) describeSelfIdentity(ctx context.Context) (*madmin.KMSDescribeSelfIdentity, error) {
return ac.Client.DescribeSelfIdentity(ctx)
}
func (ac AdminClient) deleteIdentity(ctx context.Context, identity string) error {
return ac.Client.DeleteIdentity(ctx, identity)
}
func (ac AdminClient) listIdentities(ctx context.Context, pattern string) ([]madmin.KMSIdentityInfo, error) {
return ac.Client.ListIdentities(ctx, pattern)
}

View File

@@ -2810,7 +2810,7 @@ func init() {
}
}
},
"/kms/identity": {
"/kms/identities": {
"get": {
"tags": [
"KMS"
@@ -2841,7 +2841,7 @@ func init() {
}
}
},
"/kms/identity/{name}": {
"/kms/identities/{name}": {
"delete": {
"tags": [
"KMS"
@@ -2870,7 +2870,7 @@ func init() {
}
}
},
"/kms/identity/{name}/describe": {
"/kms/identities/{name}/describe": {
"get": {
"tags": [
"KMS"
@@ -2902,7 +2902,7 @@ func init() {
}
}
},
"/kms/key": {
"/kms/keys": {
"get": {
"tags": [
"KMS"
@@ -2914,8 +2914,7 @@ func init() {
"type": "string",
"description": "pattern to retrieve keys",
"name": "pattern",
"in": "query",
"required": true
"in": "query"
}
],
"responses": {
@@ -2962,7 +2961,7 @@ func init() {
}
}
},
"/kms/key/{name}": {
"/kms/keys/{name}": {
"get": {
"tags": [
"KMS"
@@ -3021,7 +3020,7 @@ func init() {
}
}
},
"/kms/key/{name}/import": {
"/kms/keys/{name}/import": {
"post": {
"tags": [
"KMS"
@@ -3058,7 +3057,7 @@ func init() {
}
}
},
"/kms/policy": {
"/kms/policies": {
"get": {
"tags": [
"KMS"
@@ -3117,7 +3116,7 @@ func init() {
}
}
},
"/kms/policy/{name}": {
"/kms/policies/{name}": {
"get": {
"tags": [
"KMS"
@@ -3176,7 +3175,7 @@ func init() {
}
}
},
"/kms/policy/{name}/assign": {
"/kms/policies/{name}/assign": {
"post": {
"tags": [
"KMS"
@@ -3213,7 +3212,7 @@ func init() {
}
}
},
"/kms/policy/{name}/describe": {
"/kms/policies/{name}/describe": {
"get": {
"tags": [
"KMS"
@@ -5701,68 +5700,255 @@ func init() {
"kmDeleteKeyRequest": {
"type": "object"
},
"kmListKeysRequest": {
"type": "object"
},
"kmsAssignPolicyRequest": {
"type": "object"
"type": "object",
"properties": {
"identity": {
"type": "string"
}
}
},
"kmsCreateKeyRequest": {
"type": "object"
},
"kmsDescribeIdentityRequest": {
"type": "object"
"type": "object",
"required": [
"key"
],
"properties": {
"key": {
"type": "string"
}
}
},
"kmsDescribeIdentityResponse": {
"type": "object"
},
"kmsDescribePolicyRequest": {
"type": "object"
"type": "object",
"properties": {
"admin": {
"type": "boolean"
},
"createdAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"identity": {
"type": "string"
},
"policy": {
"type": "string"
}
}
},
"kmsDescribePolicyResponse": {
"type": "object"
},
"kmsDescribeSelfIdentityRequest": {
"type": "object"
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"kmsDescribeSelfIdentityResponse": {
"type": "object"
"type": "object",
"properties": {
"admin": {
"type": "boolean"
},
"createdAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"identity": {
"type": "string"
},
"policy": {
"$ref": "#/definitions/kmsGetPolicyResponse"
},
"policyName": {
"type": "string"
}
}
},
"kmsGetPolicyRequest": {
"type": "object"
"kmsEndpoint": {
"type": "object",
"properties": {
"status": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"kmsGetPolicyResponse": {
"type": "object"
"type": "object",
"properties": {
"allow": {
"type": "array",
"items": {
"type": "string"
}
},
"deny": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"kmsIdentityInfo": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"error": {
"type": "string"
},
"identity": {
"type": "string"
},
"policy": {
"type": "string"
}
}
},
"kmsImportKeyRequest": {
"type": "object"
"type": "object",
"required": [
"bytes"
],
"properties": {
"bytes": {
"type": "string"
}
}
},
"kmsKeyStatusRequest": {
"type": "object"
"kmsKeyInfo": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"kmsKeyStatusResponse": {
"type": "object"
"type": "object",
"properties": {
"decryptionErr": {
"type": "string"
},
"encryptionErr": {
"type": "string"
},
"keyID": {
"type": "string"
}
}
},
"kmsListIdentitiesResponse": {
"type": "object"
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"$ref": "#/definitions/kmsIdentityInfo"
}
}
}
},
"kmsListKeysResponse": {
"type": "object"
},
"kmsListPoliciesRequest": {
"type": "object"
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"$ref": "#/definitions/kmsKeyInfo"
}
}
}
},
"kmsListPoliciesResponse": {
"type": "object"
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"$ref": "#/definitions/kmsPolicyInfo"
}
}
}
},
"kmsPolicyInfo": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"kmsSetPolicyRequest": {
"type": "object"
},
"kmsStatusRequest": {
"type": "object"
"type": "object",
"required": [
"policy"
],
"properties": {
"allow": {
"type": "array",
"items": {
"type": "string"
}
},
"deny": {
"type": "array",
"items": {
"type": "string"
}
},
"policy": {
"type": "string"
}
}
},
"kmsStatusResponse": {
"type": "object"
"type": "object",
"properties": {
"defaultKeyID": {
"type": "string"
},
"endpoints": {
"type": "array",
"items": {
"$ref": "#/definitions/kmsEndpoint"
}
},
"name": {
"type": "string"
}
}
},
"license": {
"type": "object",
@@ -10571,7 +10757,7 @@ func init() {
}
}
},
"/kms/identity": {
"/kms/identities": {
"get": {
"tags": [
"KMS"
@@ -10602,7 +10788,7 @@ func init() {
}
}
},
"/kms/identity/{name}": {
"/kms/identities/{name}": {
"delete": {
"tags": [
"KMS"
@@ -10631,7 +10817,7 @@ func init() {
}
}
},
"/kms/identity/{name}/describe": {
"/kms/identities/{name}/describe": {
"get": {
"tags": [
"KMS"
@@ -10663,7 +10849,7 @@ func init() {
}
}
},
"/kms/key": {
"/kms/keys": {
"get": {
"tags": [
"KMS"
@@ -10675,8 +10861,7 @@ func init() {
"type": "string",
"description": "pattern to retrieve keys",
"name": "pattern",
"in": "query",
"required": true
"in": "query"
}
],
"responses": {
@@ -10723,7 +10908,7 @@ func init() {
}
}
},
"/kms/key/{name}": {
"/kms/keys/{name}": {
"get": {
"tags": [
"KMS"
@@ -10782,7 +10967,7 @@ func init() {
}
}
},
"/kms/key/{name}/import": {
"/kms/keys/{name}/import": {
"post": {
"tags": [
"KMS"
@@ -10819,7 +11004,7 @@ func init() {
}
}
},
"/kms/policy": {
"/kms/policies": {
"get": {
"tags": [
"KMS"
@@ -10878,7 +11063,7 @@ func init() {
}
}
},
"/kms/policy/{name}": {
"/kms/policies/{name}": {
"get": {
"tags": [
"KMS"
@@ -10937,7 +11122,7 @@ func init() {
}
}
},
"/kms/policy/{name}/assign": {
"/kms/policies/{name}/assign": {
"post": {
"tags": [
"KMS"
@@ -10974,7 +11159,7 @@ func init() {
}
}
},
"/kms/policy/{name}/describe": {
"/kms/policies/{name}/describe": {
"get": {
"tags": [
"KMS"
@@ -13588,68 +13773,255 @@ func init() {
"kmDeleteKeyRequest": {
"type": "object"
},
"kmListKeysRequest": {
"type": "object"
},
"kmsAssignPolicyRequest": {
"type": "object"
"type": "object",
"properties": {
"identity": {
"type": "string"
}
}
},
"kmsCreateKeyRequest": {
"type": "object"
},
"kmsDescribeIdentityRequest": {
"type": "object"
"type": "object",
"required": [
"key"
],
"properties": {
"key": {
"type": "string"
}
}
},
"kmsDescribeIdentityResponse": {
"type": "object"
},
"kmsDescribePolicyRequest": {
"type": "object"
"type": "object",
"properties": {
"admin": {
"type": "boolean"
},
"createdAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"identity": {
"type": "string"
},
"policy": {
"type": "string"
}
}
},
"kmsDescribePolicyResponse": {
"type": "object"
},
"kmsDescribeSelfIdentityRequest": {
"type": "object"
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"kmsDescribeSelfIdentityResponse": {
"type": "object"
"type": "object",
"properties": {
"admin": {
"type": "boolean"
},
"createdAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"identity": {
"type": "string"
},
"policy": {
"$ref": "#/definitions/kmsGetPolicyResponse"
},
"policyName": {
"type": "string"
}
}
},
"kmsGetPolicyRequest": {
"type": "object"
"kmsEndpoint": {
"type": "object",
"properties": {
"status": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"kmsGetPolicyResponse": {
"type": "object"
"type": "object",
"properties": {
"allow": {
"type": "array",
"items": {
"type": "string"
}
},
"deny": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"kmsIdentityInfo": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"error": {
"type": "string"
},
"identity": {
"type": "string"
},
"policy": {
"type": "string"
}
}
},
"kmsImportKeyRequest": {
"type": "object"
"type": "object",
"required": [
"bytes"
],
"properties": {
"bytes": {
"type": "string"
}
}
},
"kmsKeyStatusRequest": {
"type": "object"
"kmsKeyInfo": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"kmsKeyStatusResponse": {
"type": "object"
"type": "object",
"properties": {
"decryptionErr": {
"type": "string"
},
"encryptionErr": {
"type": "string"
},
"keyID": {
"type": "string"
}
}
},
"kmsListIdentitiesResponse": {
"type": "object"
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"$ref": "#/definitions/kmsIdentityInfo"
}
}
}
},
"kmsListKeysResponse": {
"type": "object"
},
"kmsListPoliciesRequest": {
"type": "object"
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"$ref": "#/definitions/kmsKeyInfo"
}
}
}
},
"kmsListPoliciesResponse": {
"type": "object"
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"$ref": "#/definitions/kmsPolicyInfo"
}
}
}
},
"kmsPolicyInfo": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"kmsSetPolicyRequest": {
"type": "object"
},
"kmsStatusRequest": {
"type": "object"
"type": "object",
"required": [
"policy"
],
"properties": {
"allow": {
"type": "array",
"items": {
"type": "string"
}
},
"deny": {
"type": "array",
"items": {
"type": "string"
}
},
"policy": {
"type": "string"
}
}
},
"kmsStatusResponse": {
"type": "object"
"type": "object",
"properties": {
"defaultKeyID": {
"type": "string"
},
"endpoints": {
"type": "array",
"items": {
"$ref": "#/definitions/kmsEndpoint"
}
},
"name": {
"type": "string"
}
}
},
"license": {
"type": "object",

View File

@@ -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)
}

View File

@@ -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
*/

View File

@@ -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", ""))

View File

@@ -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 != "" {

View File

@@ -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
*/

View File

@@ -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", ""))

View File

@@ -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 == "" {

View File

@@ -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
*/

View File

@@ -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 != "" {

View File

@@ -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
*/

View File

@@ -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 != "" {

View File

@@ -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
*/

View File

@@ -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 != "" {

View File

@@ -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
*/

View File

@@ -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
}
}
}

View File

@@ -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 != "" {

View File

@@ -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
*/

View File

@@ -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
}
}
}

View File

@@ -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 != "" {

View File

@@ -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
}
}
}

View File

@@ -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
*/

View File

@@ -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
}
}
}

View File

@@ -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 != "" {

View File

@@ -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
*/

View File

@@ -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", ""))

View File

@@ -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 != "" {

View File

@@ -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
*/

View File

@@ -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
}
}
}

View File

@@ -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 != "" {

View File

@@ -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
*/

View File

@@ -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
}
}
}

View File

@@ -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 == "" {

View File

@@ -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
*/

View File

@@ -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
}

View File

@@ -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
}
}
}

View File

@@ -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)
}

View File

@@ -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
*/

View File

@@ -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
}
}
}

View File

@@ -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 == "" {

View File

@@ -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
*/

View File

@@ -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", ""))

View File

@@ -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 == "" {

View File

@@ -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
}
}
}

View File

@@ -2884,7 +2884,7 @@ paths:
$ref: "#/definitions/error"
tags:
- KMS
/kms/key:
/kms/keys:
post:
summary: KMS create key
operationId: KMSCreateKey
@@ -2910,7 +2910,6 @@ paths:
- name: pattern
description: pattern to retrieve keys
in: query
required: true
type: string
responses:
200:
@@ -2923,7 +2922,7 @@ paths:
$ref: "#/definitions/error"
tags:
- KMS
/kms/key/{name}:
/kms/keys/{name}:
get:
summary: KMS key status
operationId: KMSKeyStatus
@@ -2962,7 +2961,7 @@ paths:
$ref: "#/definitions/error"
tags:
- KMS
/kms/key/{name}/import:
/kms/keys/{name}/import:
post:
summary: KMS import key
operationId: KMSImportKey
@@ -2986,7 +2985,7 @@ paths:
$ref: "#/definitions/error"
tags:
- KMS
/kms/policy:
/kms/policies:
post:
summary: KMS set policy
operationId: KMSSetPolicy
@@ -3024,7 +3023,7 @@ paths:
$ref: "#/definitions/error"
tags:
- KMS
/kms/policy/{name}:
/kms/policies/{name}:
get:
summary: KMS get policy
operationId: KMSGetPolicy
@@ -3063,7 +3062,7 @@ paths:
$ref: "#/definitions/error"
tags:
- KMS
/kms/policy/{name}/assign:
/kms/policies/{name}/assign:
post:
summary: KMS assign policy
operationId: KMSAssignPolicy
@@ -3087,7 +3086,7 @@ paths:
$ref: "#/definitions/error"
tags:
- KMS
/kms/policy/{name}/describe:
/kms/policies/{name}/describe:
get:
summary: KMS describe policy
operationId: KMSDescribePolicy
@@ -3108,7 +3107,7 @@ paths:
$ref: "#/definitions/error"
tags:
- KMS
/kms/identity/{name}:
/kms/identities/{name}:
delete:
summary: KMS delete identity
operationId: KMSDeleteIdentity
@@ -3127,7 +3126,7 @@ paths:
$ref: "#/definitions/error"
tags:
- KMS
/kms/identity/{name}/describe:
/kms/identities/{name}/describe:
get:
summary: KMS describe identity
operationId: KMSDescribeIdentity
@@ -3163,7 +3162,7 @@ paths:
$ref: "#/definitions/error"
tags:
- KMS
/kms/identity:
/kms/identities:
get:
summary: KMS list identities
operationId: KMSListIdentities
@@ -5270,53 +5269,172 @@ definitions:
policy:
type: string
kmsStatusRequest:
type: object
kmsStatusResponse:
type: object
kmsKeyStatusRequest:
properties:
name:
type: string
defaultKeyID:
type: string
endpoints:
type: array
items:
$ref: "#/definitions/kmsEndpoint"
kmsEndpoint:
type: object
properties:
url:
type: string
status:
type: string
kmsKeyStatusResponse:
type: object
properties:
keyID:
type: string
encryptionErr:
type: string
decryptionErr:
type: string
kmsCreateKeyRequest:
type: object
required:
- key
properties:
key:
type: string
kmsImportKeyRequest:
type: object
required:
- bytes
properties:
bytes:
type: string
kmDeleteKeyRequest:
type: object
kmListKeysRequest:
type: object
kmsListKeysResponse:
type: object
kmsGetPolicyRequest:
properties:
results:
type: array
items:
$ref: "#/definitions/kmsKeyInfo"
kmsKeyInfo:
type: object
properties:
name:
type: string
createdAt:
type: string
createdBy:
type: string
kmsGetPolicyResponse:
type: object
properties:
allow:
type: array
items:
type: string
deny:
type: array
items:
type: string
kmsSetPolicyRequest:
type: object
kmsDescribePolicyRequest:
type: object
required:
- policy
properties:
policy:
type: string
allow:
type: array
items:
type: string
deny:
type: array
items:
type: string
kmsDescribePolicyResponse:
type: object
properties:
createdAt:
type: string
createdBy:
type: string
name:
type: string
kmsAssignPolicyRequest:
type: object
kmsListPoliciesRequest:
type: object
properties:
identity:
type: string
kmsListPoliciesResponse:
type: object
properties:
results:
type: array
items:
$ref: "#/definitions/kmsPolicyInfo"
kmsPolicyInfo:
type: object
properties:
name:
type: string
createdAt:
type: string
createdBy:
type: string
kmsDescribeIdentityRequest:
type: object
kmsDescribeIdentityResponse:
type: object
kmsDescribeSelfIdentityRequest:
type: object
properties:
policy:
type: string
identity:
type: string
admin:
type: boolean
createdAt:
type: string
createdBy:
type: string
kmsDescribeSelfIdentityResponse:
type: object
properties:
identity:
type: string
policyName:
type: string
admin:
type: boolean
createdAt:
type: string
createdBy:
type: string
policy:
$ref: "#/definitions/kmsGetPolicyResponse"
kmsListIdentitiesResponse:
type: object
properties:
results:
type: array
items:
$ref: "#/definitions/kmsIdentityInfo"
kmsIdentityInfo:
type: object
properties:
identity:
type: string
policy:
type: string
error:
type: string
createdAt:
type: string
createdBy:
type: string
environmentConstants:
type: object