diff --git a/models/km_delete_key_request.go b/models/km_delete_key_request.go new file mode 100644 index 000000000..ef12a6bd4 --- /dev/null +++ b/models/km_delete_key_request.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmDeleteKeyRequest km delete key request +// +// swagger:model kmDeleteKeyRequest +type KmDeleteKeyRequest interface{} diff --git a/models/km_list_keys_request.go b/models/km_list_keys_request.go new file mode 100644 index 000000000..4ca2a7f21 --- /dev/null +++ b/models/km_list_keys_request.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmListKeysRequest km list keys request +// +// swagger:model kmListKeysRequest +type KmListKeysRequest interface{} diff --git a/models/kms_assign_policy_request.go b/models/kms_assign_policy_request.go new file mode 100644 index 000000000..5e456f3f3 --- /dev/null +++ b/models/kms_assign_policy_request.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsAssignPolicyRequest kms assign policy request +// +// swagger:model kmsAssignPolicyRequest +type KmsAssignPolicyRequest interface{} diff --git a/models/kms_assign_policy_response.go b/models/kms_assign_policy_response.go new file mode 100644 index 000000000..8f625e6cc --- /dev/null +++ b/models/kms_assign_policy_response.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsAssignPolicyResponse kms assign policy response +// +// swagger:model kmsAssignPolicyResponse +type KmsAssignPolicyResponse interface{} diff --git a/models/kms_create_key_request.go b/models/kms_create_key_request.go new file mode 100644 index 000000000..4dca5401d --- /dev/null +++ b/models/kms_create_key_request.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsCreateKeyRequest kms create key request +// +// swagger:model kmsCreateKeyRequest +type KmsCreateKeyRequest interface{} diff --git a/models/kms_create_key_response.go b/models/kms_create_key_response.go new file mode 100644 index 000000000..ca3945062 --- /dev/null +++ b/models/kms_create_key_response.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsCreateKeyResponse kms create key response +// +// swagger:model kmsCreateKeyResponse +type KmsCreateKeyResponse interface{} diff --git a/models/kms_delete_identity_request.go b/models/kms_delete_identity_request.go new file mode 100644 index 000000000..239b8cd91 --- /dev/null +++ b/models/kms_delete_identity_request.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsDeleteIdentityRequest kms delete identity request +// +// swagger:model kmsDeleteIdentityRequest +type KmsDeleteIdentityRequest interface{} diff --git a/models/kms_delete_identity_response.go b/models/kms_delete_identity_response.go new file mode 100644 index 000000000..8537537ff --- /dev/null +++ b/models/kms_delete_identity_response.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsDeleteIdentityResponse kms delete identity response +// +// swagger:model kmsDeleteIdentityResponse +type KmsDeleteIdentityResponse interface{} diff --git a/models/kms_delete_key_response.go b/models/kms_delete_key_response.go new file mode 100644 index 000000000..657f4698d --- /dev/null +++ b/models/kms_delete_key_response.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsDeleteKeyResponse kms delete key response +// +// swagger:model kmsDeleteKeyResponse +type KmsDeleteKeyResponse interface{} diff --git a/models/kms_delete_policy_request.go b/models/kms_delete_policy_request.go new file mode 100644 index 000000000..12c4ec20b --- /dev/null +++ b/models/kms_delete_policy_request.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsDeletePolicyRequest kms delete policy request +// +// swagger:model kmsDeletePolicyRequest +type KmsDeletePolicyRequest interface{} diff --git a/models/kms_delete_policy_response.go b/models/kms_delete_policy_response.go new file mode 100644 index 000000000..45ae91627 --- /dev/null +++ b/models/kms_delete_policy_response.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsDeletePolicyResponse kms delete policy response +// +// swagger:model kmsDeletePolicyResponse +type KmsDeletePolicyResponse interface{} diff --git a/models/kms_describe_identity_request.go b/models/kms_describe_identity_request.go new file mode 100644 index 000000000..256a14913 --- /dev/null +++ b/models/kms_describe_identity_request.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsDescribeIdentityRequest kms describe identity request +// +// swagger:model kmsDescribeIdentityRequest +type KmsDescribeIdentityRequest interface{} diff --git a/models/kms_describe_identity_response.go b/models/kms_describe_identity_response.go new file mode 100644 index 000000000..d51c94f13 --- /dev/null +++ b/models/kms_describe_identity_response.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsDescribeIdentityResponse kms describe identity response +// +// swagger:model kmsDescribeIdentityResponse +type KmsDescribeIdentityResponse interface{} diff --git a/models/kms_describe_policy_request.go b/models/kms_describe_policy_request.go new file mode 100644 index 000000000..84ace6128 --- /dev/null +++ b/models/kms_describe_policy_request.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsDescribePolicyRequest kms describe policy request +// +// swagger:model kmsDescribePolicyRequest +type KmsDescribePolicyRequest interface{} diff --git a/models/kms_describe_policy_response.go b/models/kms_describe_policy_response.go new file mode 100644 index 000000000..a1e39160e --- /dev/null +++ b/models/kms_describe_policy_response.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsDescribePolicyResponse kms describe policy response +// +// swagger:model kmsDescribePolicyResponse +type KmsDescribePolicyResponse interface{} diff --git a/models/kms_describe_self_identity_request.go b/models/kms_describe_self_identity_request.go new file mode 100644 index 000000000..a558920ed --- /dev/null +++ b/models/kms_describe_self_identity_request.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsDescribeSelfIdentityRequest kms describe self identity request +// +// swagger:model kmsDescribeSelfIdentityRequest +type KmsDescribeSelfIdentityRequest interface{} diff --git a/models/kms_describe_self_identity_response.go b/models/kms_describe_self_identity_response.go new file mode 100644 index 000000000..ac8cb731d --- /dev/null +++ b/models/kms_describe_self_identity_response.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsDescribeSelfIdentityResponse kms describe self identity response +// +// swagger:model kmsDescribeSelfIdentityResponse +type KmsDescribeSelfIdentityResponse interface{} diff --git a/models/kms_get_policy_request.go b/models/kms_get_policy_request.go new file mode 100644 index 000000000..b31c2e5cc --- /dev/null +++ b/models/kms_get_policy_request.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsGetPolicyRequest kms get policy request +// +// swagger:model kmsGetPolicyRequest +type KmsGetPolicyRequest interface{} diff --git a/models/kms_get_policy_response.go b/models/kms_get_policy_response.go new file mode 100644 index 000000000..61b436e08 --- /dev/null +++ b/models/kms_get_policy_response.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsGetPolicyResponse kms get policy response +// +// swagger:model kmsGetPolicyResponse +type KmsGetPolicyResponse interface{} diff --git a/models/kms_import_key_request.go b/models/kms_import_key_request.go new file mode 100644 index 000000000..66fe275b6 --- /dev/null +++ b/models/kms_import_key_request.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsImportKeyRequest kms import key request +// +// swagger:model kmsImportKeyRequest +type KmsImportKeyRequest interface{} diff --git a/models/kms_import_key_response.go b/models/kms_import_key_response.go new file mode 100644 index 000000000..e46e69a6d --- /dev/null +++ b/models/kms_import_key_response.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsImportKeyResponse kms import key response +// +// swagger:model kmsImportKeyResponse +type KmsImportKeyResponse interface{} diff --git a/models/kms_key_status_request.go b/models/kms_key_status_request.go new file mode 100644 index 000000000..53dd7c189 --- /dev/null +++ b/models/kms_key_status_request.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsKeyStatusRequest kms key status request +// +// swagger:model kmsKeyStatusRequest +type KmsKeyStatusRequest interface{} diff --git a/models/kms_key_status_response.go b/models/kms_key_status_response.go new file mode 100644 index 000000000..b4f64c94e --- /dev/null +++ b/models/kms_key_status_response.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsKeyStatusResponse kms key status response +// +// swagger:model kmsKeyStatusResponse +type KmsKeyStatusResponse interface{} diff --git a/models/kms_list_identities_request.go b/models/kms_list_identities_request.go new file mode 100644 index 000000000..4b722102b --- /dev/null +++ b/models/kms_list_identities_request.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsListIdentitiesRequest kms list identities request +// +// swagger:model kmsListIdentitiesRequest +type KmsListIdentitiesRequest interface{} diff --git a/models/kms_list_identities_response.go b/models/kms_list_identities_response.go new file mode 100644 index 000000000..749ed2666 --- /dev/null +++ b/models/kms_list_identities_response.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsListIdentitiesResponse kms list identities response +// +// swagger:model kmsListIdentitiesResponse +type KmsListIdentitiesResponse interface{} diff --git a/models/kms_list_keys_response.go b/models/kms_list_keys_response.go new file mode 100644 index 000000000..a738af61b --- /dev/null +++ b/models/kms_list_keys_response.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsListKeysResponse kms list keys response +// +// swagger:model kmsListKeysResponse +type KmsListKeysResponse interface{} diff --git a/models/kms_list_policies_request.go b/models/kms_list_policies_request.go new file mode 100644 index 000000000..027692bf8 --- /dev/null +++ b/models/kms_list_policies_request.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsListPoliciesRequest kms list policies request +// +// swagger:model kmsListPoliciesRequest +type KmsListPoliciesRequest interface{} diff --git a/models/kms_list_policies_response.go b/models/kms_list_policies_response.go new file mode 100644 index 000000000..f8c96c28d --- /dev/null +++ b/models/kms_list_policies_response.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsListPoliciesResponse kms list policies response +// +// swagger:model kmsListPoliciesResponse +type KmsListPoliciesResponse interface{} diff --git a/models/kms_set_policy_request.go b/models/kms_set_policy_request.go new file mode 100644 index 000000000..0bf0620ee --- /dev/null +++ b/models/kms_set_policy_request.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsSetPolicyRequest kms set policy request +// +// swagger:model kmsSetPolicyRequest +type KmsSetPolicyRequest interface{} diff --git a/models/kms_set_policy_response.go b/models/kms_set_policy_response.go new file mode 100644 index 000000000..10c52b7e8 --- /dev/null +++ b/models/kms_set_policy_response.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsSetPolicyResponse kms set policy response +// +// swagger:model kmsSetPolicyResponse +type KmsSetPolicyResponse interface{} diff --git a/models/kms_status_request.go b/models/kms_status_request.go new file mode 100644 index 000000000..659566191 --- /dev/null +++ b/models/kms_status_request.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsStatusRequest kms status request +// +// swagger:model kmsStatusRequest +type KmsStatusRequest interface{} diff --git a/models/kms_status_response.go b/models/kms_status_response.go new file mode 100644 index 000000000..2c0c25887 --- /dev/null +++ b/models/kms_status_response.go @@ -0,0 +1,28 @@ +// 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 . +// + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// KmsStatusResponse kms status response +// +// swagger:model kmsStatusResponse +type KmsStatusResponse interface{} diff --git a/restapi/admin_kms.go b/restapi/admin_kms.go new file mode 100644 index 000000000..f792b01ee --- /dev/null +++ b/restapi/admin_kms.go @@ -0,0 +1,260 @@ +// 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 . +// + +package restapi + +import ( + "context" + + "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" +) + +func registerKMSHandlers(api *operations.ConsoleAPI) { + api.KmsKMSStatusHandler = kmsAPI.KMSStatusHandlerFunc(func(params kmsAPI.KMSStatusParams, session *models.Principal) middleware.Responder { + resp, err := GetKMSStatusResponse(session, params) + if err != nil { + return kmsAPI.NewKMSStatusDefault(int(err.Code)).WithPayload(err) + } + return kmsAPI.NewKMSStatusOK().WithPayload(resp) + }) + registerKMSKeyHandlers(api) + registerKMSPolicyHandlers(api) + registerKMSIdentityHandlers(api) +} + +func registerKMSKeyHandlers(api *operations.ConsoleAPI) { + api.KmsKMSCreateKeyHandler = kmsAPI.KMSCreateKeyHandlerFunc(func(params kmsAPI.KMSCreateKeyParams, session *models.Principal) middleware.Responder { + err := GetKMSCreateKeyResponse(session, params) + if err != nil { + return kmsAPI.NewKMSCreateKeyDefault(int(err.Code)).WithPayload(err) + } + return kmsAPI.NewKMSCreateKeyCreated() + }) + + api.KmsKMSImportKeyHandler = kmsAPI.KMSImportKeyHandlerFunc(func(params kmsAPI.KMSImportKeyParams, session *models.Principal) middleware.Responder { + err := GetKMSImportKeyResponse(session, params) + if err != nil { + return kmsAPI.NewKMSImportKeyDefault(int(err.Code)).WithPayload(err) + } + return kmsAPI.NewKMSImportKeyCreated() + }) + + api.KmsKMSListKeysHandler = kmsAPI.KMSListKeysHandlerFunc(func(params kmsAPI.KMSListKeysParams, session *models.Principal) middleware.Responder { + resp, err := GetKMSListKeysResponse(session, params) + if err != nil { + return kmsAPI.NewKMSListKeysDefault(int(err.Code)).WithPayload(err) + } + return kmsAPI.NewKMSListKeysOK().WithPayload(resp) + }) + + api.KmsKMSKeyStatusHandler = kmsAPI.KMSKeyStatusHandlerFunc(func(params kmsAPI.KMSKeyStatusParams, session *models.Principal) middleware.Responder { + resp, err := GetKMSKeyStatusResponse(session, params) + if err != nil { + return kmsAPI.NewKMSKeyStatusDefault(int(err.Code)).WithPayload(err) + } + return kmsAPI.NewKMSKeyStatusOK().WithPayload(resp) + }) + + api.KmsKMSDeleteKeyHandler = kmsAPI.KMSDeleteKeyHandlerFunc(func(params kmsAPI.KMSDeleteKeyParams, session *models.Principal) middleware.Responder { + err := GetKMSDeleteKeyResponse(session, params) + if err != nil { + return kmsAPI.NewKMSDeleteKeyDefault(int(err.Code)).WithPayload(err) + } + return kmsAPI.NewKMSDeleteKeyOK() + }) +} + +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) +} + +func GetKMSCreateKeyResponse(session *models.Principal, params kmsAPI.KMSCreateKeyParams) *models.Error { + ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) + defer cancel() + return ErrorWithContext(ctx, ErrDefault) +} + +func GetKMSImportKeyResponse(session *models.Principal, params kmsAPI.KMSImportKeyParams) *models.Error { + ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) + defer cancel() + return ErrorWithContext(ctx, ErrDefault) +} + +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) +} + +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) +} + +func GetKMSDeleteKeyResponse(session *models.Principal, params kmsAPI.KMSDeleteKeyParams) *models.Error { + ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) + defer cancel() + return ErrorWithContext(ctx, ErrDefault) +} + +func registerKMSPolicyHandlers(api *operations.ConsoleAPI) { + api.KmsKMSSetPolicyHandler = kmsAPI.KMSSetPolicyHandlerFunc(func(params kmsAPI.KMSSetPolicyParams, session *models.Principal) middleware.Responder { + err := GetKMSSetPolicyResponse(session, params) + if err != nil { + return kmsAPI.NewKMSSetPolicyDefault(int(err.Code)).WithPayload(err) + } + return kmsAPI.NewKMSSetPolicyOK() + }) + + api.KmsKMSAssignPolicyHandler = kmsAPI.KMSAssignPolicyHandlerFunc(func(params kmsAPI.KMSAssignPolicyParams, session *models.Principal) middleware.Responder { + err := GetKMSAssignPolicyResponse(session, params) + if err != nil { + return kmsAPI.NewKMSAssignPolicyDefault(int(err.Code)).WithPayload(err) + } + return kmsAPI.NewKMSAssignPolicyOK() + }) + + api.KmsKMSDescribePolicyHandler = kmsAPI.KMSDescribePolicyHandlerFunc(func(params kmsAPI.KMSDescribePolicyParams, session *models.Principal) middleware.Responder { + resp, err := GetKMSDescribePolicyResponse(session, params) + if err != nil { + return kmsAPI.NewKMSDescribePolicyDefault(int(err.Code)).WithPayload(err) + } + return kmsAPI.NewKMSDescribePolicyOK().WithPayload(resp) + }) + + api.KmsKMSGetPolicyHandler = kmsAPI.KMSGetPolicyHandlerFunc(func(params kmsAPI.KMSGetPolicyParams, session *models.Principal) middleware.Responder { + resp, err := GetKMSGetPolicyResponse(session, params) + if err != nil { + return kmsAPI.NewKMSGetPolicyDefault(int(err.Code)).WithPayload(err) + } + return kmsAPI.NewKMSGetPolicyOK().WithPayload(resp) + }) + + api.KmsKMSListPoliciesHandler = kmsAPI.KMSListPoliciesHandlerFunc(func(params kmsAPI.KMSListPoliciesParams, session *models.Principal) middleware.Responder { + resp, err := GetKMSListPoliciesResponse(session, params) + if err != nil { + return kmsAPI.NewKMSListPoliciesDefault(int(err.Code)).WithPayload(err) + } + 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 { + return kmsAPI.NewKMSDeletePolicyDefault(int(err.Code)).WithPayload(err) + } + return kmsAPI.NewKMSDeletePolicyOK() + }) +} + +func GetKMSSetPolicyResponse(session *models.Principal, params kmsAPI.KMSSetPolicyParams) *models.Error { + ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) + defer cancel() + return ErrorWithContext(ctx, ErrDefault) +} + +func GetKMSAssignPolicyResponse(session *models.Principal, params kmsAPI.KMSAssignPolicyParams) *models.Error { + ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) + defer cancel() + return ErrorWithContext(ctx, ErrDefault) +} + +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) +} + +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) +} + +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) +} + +func GetKMSDeletePolicyResponse(session *models.Principal, params kmsAPI.KMSDeletePolicyParams) *models.Error { + ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) + defer cancel() + return ErrorWithContext(ctx, ErrDefault) +} + +func registerKMSIdentityHandlers(api *operations.ConsoleAPI) { + api.KmsKMSDescribeIdentityHandler = kmsAPI.KMSDescribeIdentityHandlerFunc(func(params kmsAPI.KMSDescribeIdentityParams, session *models.Principal) middleware.Responder { + resp, err := GetKMSDescribeIdentityResponse(session, params) + if err != nil { + return kmsAPI.NewKMSDescribeIdentityDefault(int(err.Code)).WithPayload(err) + } + return kmsAPI.NewKMSDescribeIdentityOK().WithPayload(resp) + }) + + api.KmsKMSDescribeSelfIdentityHandler = kmsAPI.KMSDescribeSelfIdentityHandlerFunc(func(params kmsAPI.KMSDescribeSelfIdentityParams, session *models.Principal) middleware.Responder { + resp, err := GetKMSDescribeSelfIdentityResponse(session, params) + if err != nil { + return kmsAPI.NewKMSDescribeSelfIdentityDefault(int(err.Code)).WithPayload(err) + } + return kmsAPI.NewKMSDescribeSelfIdentityOK().WithPayload(resp) + }) + + api.KmsKMSListIdentitiesHandler = kmsAPI.KMSListIdentitiesHandlerFunc(func(params kmsAPI.KMSListIdentitiesParams, session *models.Principal) middleware.Responder { + resp, err := GetKMSListIdentitiesResponse(session, params) + if err != nil { + return kmsAPI.NewKMSListIdentitiesDefault(int(err.Code)).WithPayload(err) + } + return kmsAPI.NewKMSListIdentitiesOK().WithPayload(resp) + }) + api.KmsKMSDeleteIdentityHandler = kmsAPI.KMSDeleteIdentityHandlerFunc(func(params kmsAPI.KMSDeleteIdentityParams, session *models.Principal) middleware.Responder { + err := GetKMSDeleteIdentityResponse(session, params) + if err != nil { + return kmsAPI.NewKMSDeleteIdentityDefault(int(err.Code)).WithPayload(err) + } + return kmsAPI.NewKMSDeleteIdentityOK() + }) +} + +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) +} + +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) +} + +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) +} + +func GetKMSDeleteIdentityResponse(session *models.Principal, params kmsAPI.KMSDeleteIdentityParams) *models.Error { + ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) + defer cancel() + return ErrorWithContext(ctx, ErrDefault) +} diff --git a/restapi/admin_kms_test.go b/restapi/admin_kms_test.go new file mode 100644 index 000000000..75d15fb93 --- /dev/null +++ b/restapi/admin_kms_test.go @@ -0,0 +1,297 @@ +// 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 . + +package restapi + +import ( + "net/http" + "testing" + + "github.com/minio/console/models" + "github.com/minio/console/restapi/operations" + kmsAPI "github.com/minio/console/restapi/operations/k_m_s" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/suite" +) + +type KMSTestSuite struct { + suite.Suite + assert *assert.Assertions +} + +func (suite *KMSTestSuite) SetupSuite() { + suite.assert = assert.New(suite.T()) +} + +func (suite *KMSTestSuite) TearDownSuite() { +} + +func (suite *KMSTestSuite) TestRegisterKMSHandlers() { + api := &operations.ConsoleAPI{} + suite.assertHandlersAreNil(api) + registerKMSHandlers(api) + suite.assertHandlersAreNotNil(api) +} + +func (suite *KMSTestSuite) assertHandlersAreNil(api *operations.ConsoleAPI) { + suite.assert.Nil(api.KmsKMSStatusHandler) + suite.assert.Nil(api.KmsKMSCreateKeyHandler) + suite.assert.Nil(api.KmsKMSImportKeyHandler) + suite.assert.Nil(api.KmsKMSListKeysHandler) + suite.assert.Nil(api.KmsKMSKeyStatusHandler) + suite.assert.Nil(api.KmsKMSDeleteKeyHandler) + suite.assert.Nil(api.KmsKMSSetPolicyHandler) + suite.assert.Nil(api.KmsKMSAssignPolicyHandler) + suite.assert.Nil(api.KmsKMSDescribePolicyHandler) + suite.assert.Nil(api.KmsKMSGetPolicyHandler) + suite.assert.Nil(api.KmsKMSListPoliciesHandler) + suite.assert.Nil(api.KmsKMSDeletePolicyHandler) + suite.assert.Nil(api.KmsKMSDescribeIdentityHandler) + suite.assert.Nil(api.KmsKMSDescribeSelfIdentityHandler) + suite.assert.Nil(api.KmsKMSListIdentitiesHandler) + suite.assert.Nil(api.KmsKMSDeleteIdentityHandler) +} + +func (suite *KMSTestSuite) assertHandlersAreNotNil(api *operations.ConsoleAPI) { + suite.assert.NotNil(api.KmsKMSStatusHandler) + suite.assert.NotNil(api.KmsKMSCreateKeyHandler) + suite.assert.NotNil(api.KmsKMSImportKeyHandler) + suite.assert.NotNil(api.KmsKMSListKeysHandler) + suite.assert.NotNil(api.KmsKMSKeyStatusHandler) + suite.assert.NotNil(api.KmsKMSDeleteKeyHandler) + suite.assert.NotNil(api.KmsKMSSetPolicyHandler) + suite.assert.NotNil(api.KmsKMSAssignPolicyHandler) + suite.assert.NotNil(api.KmsKMSDescribePolicyHandler) + suite.assert.NotNil(api.KmsKMSGetPolicyHandler) + suite.assert.NotNil(api.KmsKMSListPoliciesHandler) + suite.assert.NotNil(api.KmsKMSDeletePolicyHandler) + suite.assert.NotNil(api.KmsKMSDescribeIdentityHandler) + suite.assert.NotNil(api.KmsKMSDescribeSelfIdentityHandler) + suite.assert.NotNil(api.KmsKMSListIdentitiesHandler) + suite.assert.NotNil(api.KmsKMSDeleteIdentityHandler) +} + +func (suite *KMSTestSuite) TestKMSStatusHandlerWithError() { + params, api := suite.initKMSStatusRequest() + response := api.KmsKMSStatusHandler.Handle(params, &models.Principal{}) + _, ok := response.(*kmsAPI.KMSStatusDefault) + suite.assert.True(ok) +} + +func (suite *KMSTestSuite) initKMSStatusRequest() (params kmsAPI.KMSStatusParams, api operations.ConsoleAPI) { + registerKMSHandlers(&api) + params.HTTPRequest = &http.Request{} + return params, api +} + +func (suite *KMSTestSuite) TestKMSCreateKeyHandlerWithError() { + params, api := suite.initKMSCreateKeyRequest() + response := api.KmsKMSCreateKeyHandler.Handle(params, &models.Principal{}) + _, ok := response.(*kmsAPI.KMSCreateKeyDefault) + suite.assert.True(ok) +} + +func (suite *KMSTestSuite) initKMSCreateKeyRequest() (params kmsAPI.KMSCreateKeyParams, api operations.ConsoleAPI) { + registerKMSHandlers(&api) + params.HTTPRequest = &http.Request{} + return params, api +} + +func (suite *KMSTestSuite) TestKMSImportKeyHandlerWithError() { + params, api := suite.initKMSImportKeyRequest() + response := api.KmsKMSImportKeyHandler.Handle(params, &models.Principal{}) + _, ok := response.(*kmsAPI.KMSImportKeyDefault) + suite.assert.True(ok) +} + +func (suite *KMSTestSuite) initKMSImportKeyRequest() (params kmsAPI.KMSImportKeyParams, api operations.ConsoleAPI) { + registerKMSHandlers(&api) + params.HTTPRequest = &http.Request{} + return params, api +} + +func (suite *KMSTestSuite) TestKMSListKeysHandlerWithError() { + params, api := suite.initKMSListKeysRequest() + response := api.KmsKMSListKeysHandler.Handle(params, &models.Principal{}) + _, ok := response.(*kmsAPI.KMSListKeysDefault) + suite.assert.True(ok) +} + +func (suite *KMSTestSuite) initKMSListKeysRequest() (params kmsAPI.KMSListKeysParams, api operations.ConsoleAPI) { + registerKMSHandlers(&api) + params.HTTPRequest = &http.Request{} + return params, api +} + +func (suite *KMSTestSuite) TestKMSKeyStatusHandlerWithError() { + params, api := suite.initKMSKeyStatusRequest() + response := api.KmsKMSKeyStatusHandler.Handle(params, &models.Principal{}) + _, ok := response.(*kmsAPI.KMSKeyStatusDefault) + suite.assert.True(ok) +} + +func (suite *KMSTestSuite) initKMSKeyStatusRequest() (params kmsAPI.KMSKeyStatusParams, api operations.ConsoleAPI) { + registerKMSHandlers(&api) + params.HTTPRequest = &http.Request{} + return params, api +} + +func (suite *KMSTestSuite) TestKMSDeleteKeyHandlerWithError() { + params, api := suite.initKMSDeleteKeyRequest() + response := api.KmsKMSDeleteKeyHandler.Handle(params, &models.Principal{}) + _, ok := response.(*kmsAPI.KMSDeleteKeyDefault) + suite.assert.True(ok) +} + +func (suite *KMSTestSuite) initKMSDeleteKeyRequest() (params kmsAPI.KMSDeleteKeyParams, api operations.ConsoleAPI) { + registerKMSHandlers(&api) + params.HTTPRequest = &http.Request{} + return params, api +} + +func (suite *KMSTestSuite) TestKMSSetPolicyHandlerWithError() { + params, api := suite.initKMSSetPolicyRequest() + response := api.KmsKMSSetPolicyHandler.Handle(params, &models.Principal{}) + _, ok := response.(*kmsAPI.KMSSetPolicyDefault) + suite.assert.True(ok) +} + +func (suite *KMSTestSuite) initKMSSetPolicyRequest() (params kmsAPI.KMSSetPolicyParams, api operations.ConsoleAPI) { + registerKMSHandlers(&api) + params.HTTPRequest = &http.Request{} + return params, api +} + +func (suite *KMSTestSuite) TestKMSAssignPolicyHandlerWithError() { + params, api := suite.initKMSAssignPolicyRequest() + response := api.KmsKMSAssignPolicyHandler.Handle(params, &models.Principal{}) + _, ok := response.(*kmsAPI.KMSAssignPolicyDefault) + suite.assert.True(ok) +} + +func (suite *KMSTestSuite) initKMSAssignPolicyRequest() (params kmsAPI.KMSAssignPolicyParams, api operations.ConsoleAPI) { + registerKMSHandlers(&api) + params.HTTPRequest = &http.Request{} + return params, api +} + +func (suite *KMSTestSuite) TestKMSDescribePolicyHandlerWithError() { + params, api := suite.initKMSDescribePolicyRequest() + response := api.KmsKMSDescribePolicyHandler.Handle(params, &models.Principal{}) + _, ok := response.(*kmsAPI.KMSDescribePolicyDefault) + suite.assert.True(ok) +} + +func (suite *KMSTestSuite) initKMSDescribePolicyRequest() (params kmsAPI.KMSDescribePolicyParams, api operations.ConsoleAPI) { + registerKMSHandlers(&api) + params.HTTPRequest = &http.Request{} + return params, api +} + +func (suite *KMSTestSuite) TestKMSGetPolicyHandlerWithError() { + params, api := suite.initKMSGetPolicyRequest() + response := api.KmsKMSGetPolicyHandler.Handle(params, &models.Principal{}) + _, ok := response.(*kmsAPI.KMSGetPolicyDefault) + suite.assert.True(ok) +} + +func (suite *KMSTestSuite) initKMSGetPolicyRequest() (params kmsAPI.KMSGetPolicyParams, api operations.ConsoleAPI) { + registerKMSHandlers(&api) + params.HTTPRequest = &http.Request{} + return params, api +} + +func (suite *KMSTestSuite) TestKMSListPoliciesHandlerWithError() { + params, api := suite.initKMSListPoliciesRequest() + response := api.KmsKMSListPoliciesHandler.Handle(params, &models.Principal{}) + _, ok := response.(*kmsAPI.KMSListPoliciesDefault) + suite.assert.True(ok) +} + +func (suite *KMSTestSuite) initKMSListPoliciesRequest() (params kmsAPI.KMSListPoliciesParams, api operations.ConsoleAPI) { + registerKMSHandlers(&api) + params.HTTPRequest = &http.Request{} + return params, api +} + +func (suite *KMSTestSuite) TestKMSDeletePolicyHandlerWithError() { + params, api := suite.initKMSDeletePolicyRequest() + response := api.KmsKMSDeletePolicyHandler.Handle(params, &models.Principal{}) + _, ok := response.(*kmsAPI.KMSDeletePolicyDefault) + suite.assert.True(ok) +} + +func (suite *KMSTestSuite) initKMSDeletePolicyRequest() (params kmsAPI.KMSDeletePolicyParams, api operations.ConsoleAPI) { + registerKMSHandlers(&api) + params.HTTPRequest = &http.Request{} + return params, api +} + +func (suite *KMSTestSuite) TestKMSDescribeIdentityHandlerWithError() { + params, api := suite.initKMSDescribeIdentityRequest() + response := api.KmsKMSDescribeIdentityHandler.Handle(params, &models.Principal{}) + _, ok := response.(*kmsAPI.KMSDescribeIdentityDefault) + suite.assert.True(ok) +} + +func (suite *KMSTestSuite) initKMSDescribeIdentityRequest() (params kmsAPI.KMSDescribeIdentityParams, api operations.ConsoleAPI) { + registerKMSHandlers(&api) + params.HTTPRequest = &http.Request{} + return params, api +} + +func (suite *KMSTestSuite) TestKMSDescribeSelfIdentityHandlerWithError() { + params, api := suite.initKMSDescribeSelfIdentityRequest() + response := api.KmsKMSDescribeSelfIdentityHandler.Handle(params, &models.Principal{}) + _, ok := response.(*kmsAPI.KMSDescribeSelfIdentityDefault) + suite.assert.True(ok) +} + +func (suite *KMSTestSuite) initKMSDescribeSelfIdentityRequest() (params kmsAPI.KMSDescribeSelfIdentityParams, api operations.ConsoleAPI) { + registerKMSHandlers(&api) + params.HTTPRequest = &http.Request{} + return params, api +} + +func (suite *KMSTestSuite) TestKMSListIdentitiesHandlerWithError() { + params, api := suite.initKMSListIdentitiesRequest() + response := api.KmsKMSListIdentitiesHandler.Handle(params, &models.Principal{}) + _, ok := response.(*kmsAPI.KMSListIdentitiesDefault) + suite.assert.True(ok) +} + +func (suite *KMSTestSuite) initKMSListIdentitiesRequest() (params kmsAPI.KMSListIdentitiesParams, api operations.ConsoleAPI) { + registerKMSHandlers(&api) + params.HTTPRequest = &http.Request{} + return params, api +} + +func (suite *KMSTestSuite) TestKMSDeleteIdentityHandlerWithError() { + params, api := suite.initKMSDeleteIdentityRequest() + response := api.KmsKMSDeleteIdentityHandler.Handle(params, &models.Principal{}) + _, ok := response.(*kmsAPI.KMSDeleteIdentityDefault) + suite.assert.True(ok) +} + +func (suite *KMSTestSuite) initKMSDeleteIdentityRequest() (params kmsAPI.KMSDeleteIdentityParams, api operations.ConsoleAPI) { + registerKMSHandlers(&api) + params.HTTPRequest = &http.Request{} + return params, api +} + +func TestKMS(t *testing.T) { + suite.Run(t, new(KMSTestSuite)) +} diff --git a/restapi/configure_console.go b/restapi/configure_console.go index f4b747212..39fab692a 100644 --- a/restapi/configure_console.go +++ b/restapi/configure_console.go @@ -137,6 +137,8 @@ func configureAPI(api *operations.ConsoleAPI) http.Handler { registerLogSearchHandlers(api) // Register admin subnet handlers registerSubnetHandlers(api) + // Register admin KMS handlers + registerKMSHandlers(api) // Register Account handlers registerAdminTiersHandlers(api) // Register Inspect Handler diff --git a/restapi/embedded_spec.go b/restapi/embedded_spec.go index 0a4120c47..fc63673e9 100644 --- a/restapi/embedded_spec.go +++ b/restapi/embedded_spec.go @@ -2787,6 +2787,487 @@ func init() { } } }, + "/kms/describe-self/identity": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS describe self identity", + "operationId": "KMSDescribeSelfIdentity", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsDescribeSelfIdentityResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/identity": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS list identities", + "operationId": "KMSListIdentities", + "parameters": [ + { + "type": "string", + "description": "pattern to retrieve identities", + "name": "pattern", + "in": "query" + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsListIdentitiesResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/identity/{name}": { + "delete": { + "tags": [ + "KMS" + ], + "summary": "KMS delete identity", + "operationId": "KMSDeleteIdentity", + "parameters": [ + { + "type": "string", + "description": "KMS identity name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response." + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/identity/{name}/describe": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS describe identity", + "operationId": "KMSDescribeIdentity", + "parameters": [ + { + "type": "string", + "description": "KMS identity name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsDescribeIdentityResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/key": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS list keys", + "operationId": "KMSListKeys", + "parameters": [ + { + "type": "string", + "description": "pattern to retrieve keys", + "name": "pattern", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsListKeysResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + }, + "post": { + "tags": [ + "KMS" + ], + "summary": "KMS create key", + "operationId": "KMSCreateKey", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/kmsCreateKeyRequest" + } + } + ], + "responses": { + "201": { + "description": "A successful response." + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/key/{name}": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS key status", + "operationId": "KMSKeyStatus", + "parameters": [ + { + "type": "string", + "description": "KMS key name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsKeyStatusResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + }, + "delete": { + "tags": [ + "KMS" + ], + "summary": "KMS delete key", + "operationId": "KMSDeleteKey", + "parameters": [ + { + "type": "string", + "description": "KMS key name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response." + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/key/{name}/import": { + "post": { + "tags": [ + "KMS" + ], + "summary": "KMS import key", + "operationId": "KMSImportKey", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/kmsImportKeyRequest" + } + }, + { + "type": "string", + "description": "KMS key name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "description": "A successful response." + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/policy": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS list policies", + "operationId": "KMSListPolicies", + "parameters": [ + { + "type": "string", + "description": "pattern to retrieve policies", + "name": "pattern", + "in": "query" + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsListPoliciesResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + }, + "post": { + "tags": [ + "KMS" + ], + "summary": "KMS set policy", + "operationId": "KMSSetPolicy", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/kmsSetPolicyRequest" + } + } + ], + "responses": { + "200": { + "description": "A successful response." + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/policy/{name}": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS get policy", + "operationId": "KMSGetPolicy", + "parameters": [ + { + "type": "string", + "description": "KMS policy name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsGetPolicyResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + }, + "delete": { + "tags": [ + "KMS" + ], + "summary": "KMS delete policy", + "operationId": "KMSDeletePolicy", + "parameters": [ + { + "type": "string", + "description": "KMS policy name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response." + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/policy/{name}/assign": { + "post": { + "tags": [ + "KMS" + ], + "summary": "KMS assign policy", + "operationId": "KMSAssignPolicy", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/kmsAssignPolicyRequest" + } + }, + { + "type": "string", + "description": "KMS policy name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response." + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/policy/{name}/describe": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS describe policy", + "operationId": "KMSDescribePolicy", + "parameters": [ + { + "type": "string", + "description": "KMS policy name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsDescribePolicyResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/status": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS status", + "operationId": "KMSStatus", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsStatusResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, "/list-external-buckets": { "post": { "tags": [ @@ -5206,6 +5687,72 @@ func init() { } } }, + "kmDeleteKeyRequest": { + "type": "object" + }, + "kmListKeysRequest": { + "type": "object" + }, + "kmsAssignPolicyRequest": { + "type": "object" + }, + "kmsCreateKeyRequest": { + "type": "object" + }, + "kmsDescribeIdentityRequest": { + "type": "object" + }, + "kmsDescribeIdentityResponse": { + "type": "object" + }, + "kmsDescribePolicyRequest": { + "type": "object" + }, + "kmsDescribePolicyResponse": { + "type": "object" + }, + "kmsDescribeSelfIdentityRequest": { + "type": "object" + }, + "kmsDescribeSelfIdentityResponse": { + "type": "object" + }, + "kmsGetPolicyRequest": { + "type": "object" + }, + "kmsGetPolicyResponse": { + "type": "object" + }, + "kmsImportKeyRequest": { + "type": "object" + }, + "kmsKeyStatusRequest": { + "type": "object" + }, + "kmsKeyStatusResponse": { + "type": "object" + }, + "kmsListIdentitiesResponse": { + "type": "object" + }, + "kmsListKeysResponse": { + "type": "object" + }, + "kmsListPoliciesRequest": { + "type": "object" + }, + "kmsListPoliciesResponse": { + "type": "object" + }, + "kmsSetPolicyRequest": { + "type": "object" + }, + "kmsStatusRequest": { + "type": "object" + }, + "kmsStatusResponse": { + "type": "object" + }, "license": { "type": "object", "properties": { @@ -9984,6 +10531,487 @@ func init() { } } }, + "/kms/describe-self/identity": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS describe self identity", + "operationId": "KMSDescribeSelfIdentity", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsDescribeSelfIdentityResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/identity": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS list identities", + "operationId": "KMSListIdentities", + "parameters": [ + { + "type": "string", + "description": "pattern to retrieve identities", + "name": "pattern", + "in": "query" + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsListIdentitiesResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/identity/{name}": { + "delete": { + "tags": [ + "KMS" + ], + "summary": "KMS delete identity", + "operationId": "KMSDeleteIdentity", + "parameters": [ + { + "type": "string", + "description": "KMS identity name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response." + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/identity/{name}/describe": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS describe identity", + "operationId": "KMSDescribeIdentity", + "parameters": [ + { + "type": "string", + "description": "KMS identity name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsDescribeIdentityResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/key": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS list keys", + "operationId": "KMSListKeys", + "parameters": [ + { + "type": "string", + "description": "pattern to retrieve keys", + "name": "pattern", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsListKeysResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + }, + "post": { + "tags": [ + "KMS" + ], + "summary": "KMS create key", + "operationId": "KMSCreateKey", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/kmsCreateKeyRequest" + } + } + ], + "responses": { + "201": { + "description": "A successful response." + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/key/{name}": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS key status", + "operationId": "KMSKeyStatus", + "parameters": [ + { + "type": "string", + "description": "KMS key name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsKeyStatusResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + }, + "delete": { + "tags": [ + "KMS" + ], + "summary": "KMS delete key", + "operationId": "KMSDeleteKey", + "parameters": [ + { + "type": "string", + "description": "KMS key name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response." + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/key/{name}/import": { + "post": { + "tags": [ + "KMS" + ], + "summary": "KMS import key", + "operationId": "KMSImportKey", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/kmsImportKeyRequest" + } + }, + { + "type": "string", + "description": "KMS key name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "201": { + "description": "A successful response." + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/policy": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS list policies", + "operationId": "KMSListPolicies", + "parameters": [ + { + "type": "string", + "description": "pattern to retrieve policies", + "name": "pattern", + "in": "query" + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsListPoliciesResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + }, + "post": { + "tags": [ + "KMS" + ], + "summary": "KMS set policy", + "operationId": "KMSSetPolicy", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/kmsSetPolicyRequest" + } + } + ], + "responses": { + "200": { + "description": "A successful response." + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/policy/{name}": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS get policy", + "operationId": "KMSGetPolicy", + "parameters": [ + { + "type": "string", + "description": "KMS policy name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsGetPolicyResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + }, + "delete": { + "tags": [ + "KMS" + ], + "summary": "KMS delete policy", + "operationId": "KMSDeletePolicy", + "parameters": [ + { + "type": "string", + "description": "KMS policy name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response." + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/policy/{name}/assign": { + "post": { + "tags": [ + "KMS" + ], + "summary": "KMS assign policy", + "operationId": "KMSAssignPolicy", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/kmsAssignPolicyRequest" + } + }, + { + "type": "string", + "description": "KMS policy name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response." + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/policy/{name}/describe": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS describe policy", + "operationId": "KMSDescribePolicy", + "parameters": [ + { + "type": "string", + "description": "KMS policy name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsDescribePolicyResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, + "/kms/status": { + "get": { + "tags": [ + "KMS" + ], + "summary": "KMS status", + "operationId": "KMSStatus", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/kmsStatusResponse" + } + }, + "default": { + "description": "Generic error response.", + "schema": { + "$ref": "#/definitions/error" + } + } + } + } + }, "/list-external-buckets": { "post": { "tags": [ @@ -12529,6 +13557,72 @@ func init() { } } }, + "kmDeleteKeyRequest": { + "type": "object" + }, + "kmListKeysRequest": { + "type": "object" + }, + "kmsAssignPolicyRequest": { + "type": "object" + }, + "kmsCreateKeyRequest": { + "type": "object" + }, + "kmsDescribeIdentityRequest": { + "type": "object" + }, + "kmsDescribeIdentityResponse": { + "type": "object" + }, + "kmsDescribePolicyRequest": { + "type": "object" + }, + "kmsDescribePolicyResponse": { + "type": "object" + }, + "kmsDescribeSelfIdentityRequest": { + "type": "object" + }, + "kmsDescribeSelfIdentityResponse": { + "type": "object" + }, + "kmsGetPolicyRequest": { + "type": "object" + }, + "kmsGetPolicyResponse": { + "type": "object" + }, + "kmsImportKeyRequest": { + "type": "object" + }, + "kmsKeyStatusRequest": { + "type": "object" + }, + "kmsKeyStatusResponse": { + "type": "object" + }, + "kmsListIdentitiesResponse": { + "type": "object" + }, + "kmsListKeysResponse": { + "type": "object" + }, + "kmsListPoliciesRequest": { + "type": "object" + }, + "kmsListPoliciesResponse": { + "type": "object" + }, + "kmsSetPolicyRequest": { + "type": "object" + }, + "kmsStatusRequest": { + "type": "object" + }, + "kmsStatusResponse": { + "type": "object" + }, "license": { "type": "object", "properties": { diff --git a/restapi/operations/console_api.go b/restapi/operations/console_api.go index 4ed745876..009271948 100644 --- a/restapi/operations/console_api.go +++ b/restapi/operations/console_api.go @@ -44,6 +44,7 @@ import ( "github.com/minio/console/restapi/operations/configuration" "github.com/minio/console/restapi/operations/group" "github.com/minio/console/restapi/operations/inspect" + "github.com/minio/console/restapi/operations/k_m_s" "github.com/minio/console/restapi/operations/logging" "github.com/minio/console/restapi/operations/object" "github.com/minio/console/restapi/operations/policy" @@ -264,6 +265,54 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI { InspectInspectHandler: inspect.InspectHandlerFunc(func(params inspect.InspectParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation inspect.Inspect has not yet been implemented") }), + KmsKMSAssignPolicyHandler: k_m_s.KMSAssignPolicyHandlerFunc(func(params k_m_s.KMSAssignPolicyParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation k_m_s.KMSAssignPolicy has not yet been implemented") + }), + KmsKMSCreateKeyHandler: k_m_s.KMSCreateKeyHandlerFunc(func(params k_m_s.KMSCreateKeyParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation k_m_s.KMSCreateKey has not yet been implemented") + }), + KmsKMSDeleteIdentityHandler: k_m_s.KMSDeleteIdentityHandlerFunc(func(params k_m_s.KMSDeleteIdentityParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation k_m_s.KMSDeleteIdentity has not yet been implemented") + }), + KmsKMSDeleteKeyHandler: k_m_s.KMSDeleteKeyHandlerFunc(func(params k_m_s.KMSDeleteKeyParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation k_m_s.KMSDeleteKey has not yet been implemented") + }), + KmsKMSDeletePolicyHandler: k_m_s.KMSDeletePolicyHandlerFunc(func(params k_m_s.KMSDeletePolicyParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation k_m_s.KMSDeletePolicy has not yet been implemented") + }), + KmsKMSDescribeIdentityHandler: k_m_s.KMSDescribeIdentityHandlerFunc(func(params k_m_s.KMSDescribeIdentityParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation k_m_s.KMSDescribeIdentity has not yet been implemented") + }), + KmsKMSDescribePolicyHandler: k_m_s.KMSDescribePolicyHandlerFunc(func(params k_m_s.KMSDescribePolicyParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation k_m_s.KMSDescribePolicy has not yet been implemented") + }), + KmsKMSDescribeSelfIdentityHandler: k_m_s.KMSDescribeSelfIdentityHandlerFunc(func(params k_m_s.KMSDescribeSelfIdentityParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation k_m_s.KMSDescribeSelfIdentity has not yet been implemented") + }), + KmsKMSGetPolicyHandler: k_m_s.KMSGetPolicyHandlerFunc(func(params k_m_s.KMSGetPolicyParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation k_m_s.KMSGetPolicy has not yet been implemented") + }), + KmsKMSImportKeyHandler: k_m_s.KMSImportKeyHandlerFunc(func(params k_m_s.KMSImportKeyParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation k_m_s.KMSImportKey has not yet been implemented") + }), + KmsKMSKeyStatusHandler: k_m_s.KMSKeyStatusHandlerFunc(func(params k_m_s.KMSKeyStatusParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation k_m_s.KMSKeyStatus has not yet been implemented") + }), + KmsKMSListIdentitiesHandler: k_m_s.KMSListIdentitiesHandlerFunc(func(params k_m_s.KMSListIdentitiesParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation k_m_s.KMSListIdentities has not yet been implemented") + }), + KmsKMSListKeysHandler: k_m_s.KMSListKeysHandlerFunc(func(params k_m_s.KMSListKeysParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation k_m_s.KMSListKeys has not yet been implemented") + }), + KmsKMSListPoliciesHandler: k_m_s.KMSListPoliciesHandlerFunc(func(params k_m_s.KMSListPoliciesParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation k_m_s.KMSListPolicies has not yet been implemented") + }), + KmsKMSSetPolicyHandler: k_m_s.KMSSetPolicyHandlerFunc(func(params k_m_s.KMSSetPolicyParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation k_m_s.KMSSetPolicy has not yet been implemented") + }), + KmsKMSStatusHandler: k_m_s.KMSStatusHandlerFunc(func(params k_m_s.KMSStatusParams, principal *models.Principal) middleware.Responder { + return middleware.NotImplemented("operation k_m_s.KMSStatus has not yet been implemented") + }), UserListAUserServiceAccountsHandler: user.ListAUserServiceAccountsHandlerFunc(func(params user.ListAUserServiceAccountsParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation user.ListAUserServiceAccounts has not yet been implemented") }), @@ -637,6 +686,38 @@ type ConsoleAPI struct { GroupGroupInfoHandler group.GroupInfoHandler // InspectInspectHandler sets the operation handler for the inspect operation InspectInspectHandler inspect.InspectHandler + // KmsKMSAssignPolicyHandler sets the operation handler for the k m s assign policy operation + KmsKMSAssignPolicyHandler k_m_s.KMSAssignPolicyHandler + // KmsKMSCreateKeyHandler sets the operation handler for the k m s create key operation + KmsKMSCreateKeyHandler k_m_s.KMSCreateKeyHandler + // KmsKMSDeleteIdentityHandler sets the operation handler for the k m s delete identity operation + KmsKMSDeleteIdentityHandler k_m_s.KMSDeleteIdentityHandler + // KmsKMSDeleteKeyHandler sets the operation handler for the k m s delete key operation + KmsKMSDeleteKeyHandler k_m_s.KMSDeleteKeyHandler + // KmsKMSDeletePolicyHandler sets the operation handler for the k m s delete policy operation + KmsKMSDeletePolicyHandler k_m_s.KMSDeletePolicyHandler + // KmsKMSDescribeIdentityHandler sets the operation handler for the k m s describe identity operation + KmsKMSDescribeIdentityHandler k_m_s.KMSDescribeIdentityHandler + // KmsKMSDescribePolicyHandler sets the operation handler for the k m s describe policy operation + KmsKMSDescribePolicyHandler k_m_s.KMSDescribePolicyHandler + // KmsKMSDescribeSelfIdentityHandler sets the operation handler for the k m s describe self identity operation + KmsKMSDescribeSelfIdentityHandler k_m_s.KMSDescribeSelfIdentityHandler + // KmsKMSGetPolicyHandler sets the operation handler for the k m s get policy operation + KmsKMSGetPolicyHandler k_m_s.KMSGetPolicyHandler + // KmsKMSImportKeyHandler sets the operation handler for the k m s import key operation + KmsKMSImportKeyHandler k_m_s.KMSImportKeyHandler + // KmsKMSKeyStatusHandler sets the operation handler for the k m s key status operation + KmsKMSKeyStatusHandler k_m_s.KMSKeyStatusHandler + // KmsKMSListIdentitiesHandler sets the operation handler for the k m s list identities operation + KmsKMSListIdentitiesHandler k_m_s.KMSListIdentitiesHandler + // KmsKMSListKeysHandler sets the operation handler for the k m s list keys operation + KmsKMSListKeysHandler k_m_s.KMSListKeysHandler + // KmsKMSListPoliciesHandler sets the operation handler for the k m s list policies operation + KmsKMSListPoliciesHandler k_m_s.KMSListPoliciesHandler + // KmsKMSSetPolicyHandler sets the operation handler for the k m s set policy operation + KmsKMSSetPolicyHandler k_m_s.KMSSetPolicyHandler + // KmsKMSStatusHandler sets the operation handler for the k m s status operation + KmsKMSStatusHandler k_m_s.KMSStatusHandler // UserListAUserServiceAccountsHandler sets the operation handler for the list a user service accounts operation UserListAUserServiceAccountsHandler user.ListAUserServiceAccountsHandler // BucketListAccessRulesWithBucketHandler sets the operation handler for the list access rules with bucket operation @@ -1037,6 +1118,54 @@ func (o *ConsoleAPI) Validate() error { if o.InspectInspectHandler == nil { unregistered = append(unregistered, "inspect.InspectHandler") } + if o.KmsKMSAssignPolicyHandler == nil { + unregistered = append(unregistered, "k_m_s.KMSAssignPolicyHandler") + } + if o.KmsKMSCreateKeyHandler == nil { + unregistered = append(unregistered, "k_m_s.KMSCreateKeyHandler") + } + if o.KmsKMSDeleteIdentityHandler == nil { + unregistered = append(unregistered, "k_m_s.KMSDeleteIdentityHandler") + } + if o.KmsKMSDeleteKeyHandler == nil { + unregistered = append(unregistered, "k_m_s.KMSDeleteKeyHandler") + } + if o.KmsKMSDeletePolicyHandler == nil { + unregistered = append(unregistered, "k_m_s.KMSDeletePolicyHandler") + } + if o.KmsKMSDescribeIdentityHandler == nil { + unregistered = append(unregistered, "k_m_s.KMSDescribeIdentityHandler") + } + if o.KmsKMSDescribePolicyHandler == nil { + unregistered = append(unregistered, "k_m_s.KMSDescribePolicyHandler") + } + if o.KmsKMSDescribeSelfIdentityHandler == nil { + unregistered = append(unregistered, "k_m_s.KMSDescribeSelfIdentityHandler") + } + if o.KmsKMSGetPolicyHandler == nil { + unregistered = append(unregistered, "k_m_s.KMSGetPolicyHandler") + } + if o.KmsKMSImportKeyHandler == nil { + unregistered = append(unregistered, "k_m_s.KMSImportKeyHandler") + } + if o.KmsKMSKeyStatusHandler == nil { + unregistered = append(unregistered, "k_m_s.KMSKeyStatusHandler") + } + if o.KmsKMSListIdentitiesHandler == nil { + unregistered = append(unregistered, "k_m_s.KMSListIdentitiesHandler") + } + if o.KmsKMSListKeysHandler == nil { + unregistered = append(unregistered, "k_m_s.KMSListKeysHandler") + } + if o.KmsKMSListPoliciesHandler == nil { + unregistered = append(unregistered, "k_m_s.KMSListPoliciesHandler") + } + if o.KmsKMSSetPolicyHandler == nil { + unregistered = append(unregistered, "k_m_s.KMSSetPolicyHandler") + } + if o.KmsKMSStatusHandler == nil { + unregistered = append(unregistered, "k_m_s.KMSStatusHandler") + } if o.UserListAUserServiceAccountsHandler == nil { unregistered = append(unregistered, "user.ListAUserServiceAccountsHandler") } @@ -1576,6 +1705,70 @@ func (o *ConsoleAPI) initHandlerCache() { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/admin/inspect"] = inspect.NewInspect(o.context, o.InspectInspectHandler) + 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) + 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) + 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) + 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) + 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) + 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) + 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) + if o.handlers["GET"] == nil { + o.handlers["GET"] = make(map[string]http.Handler) + } + o.handlers["GET"]["/kms/describe-self/identity"] = k_m_s.NewKMSDescribeSelfIdentity(o.context, o.KmsKMSDescribeSelfIdentityHandler) + 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) + 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) + 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) + 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) + 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) + 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) + 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) + if o.handlers["GET"] == nil { + o.handlers["GET"] = make(map[string]http.Handler) + } + o.handlers["GET"]["/kms/status"] = k_m_s.NewKMSStatus(o.context, o.KmsKMSStatusHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } diff --git a/restapi/operations/k_m_s/k_m_s_assign_policy.go b/restapi/operations/k_m_s/k_m_s_assign_policy.go new file mode 100644 index 000000000..4f769ae2c --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_assign_policy.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// KMSAssignPolicyHandlerFunc turns a function with the right signature into a k m s assign policy handler +type KMSAssignPolicyHandlerFunc func(KMSAssignPolicyParams, *models.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn KMSAssignPolicyHandlerFunc) Handle(params KMSAssignPolicyParams, principal *models.Principal) middleware.Responder { + return fn(params, principal) +} + +// KMSAssignPolicyHandler interface for that can handle valid k m s assign policy params +type KMSAssignPolicyHandler interface { + Handle(KMSAssignPolicyParams, *models.Principal) middleware.Responder +} + +// NewKMSAssignPolicy creates a new http.Handler for the k m s assign policy operation +func NewKMSAssignPolicy(ctx *middleware.Context, handler KMSAssignPolicyHandler) *KMSAssignPolicy { + return &KMSAssignPolicy{Context: ctx, Handler: handler} +} + +/* + KMSAssignPolicy swagger:route POST /kms/policy/{name}/assign KMS kMSAssignPolicy + +KMS assign policy +*/ +type KMSAssignPolicy struct { + Context *middleware.Context + Handler KMSAssignPolicyHandler +} + +func (o *KMSAssignPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewKMSAssignPolicyParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *models.Principal + if uprinc != nil { + principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/restapi/operations/k_m_s/k_m_s_assign_policy_parameters.go b/restapi/operations/k_m_s/k_m_s_assign_policy_parameters.go new file mode 100644 index 000000000..738869b89 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_assign_policy_parameters.go @@ -0,0 +1,114 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "io" + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" + + "github.com/minio/console/models" +) + +// NewKMSAssignPolicyParams creates a new KMSAssignPolicyParams object +// +// There are no default values defined in the spec. +func NewKMSAssignPolicyParams() KMSAssignPolicyParams { + + return KMSAssignPolicyParams{} +} + +// KMSAssignPolicyParams contains all the bound params for the k m s assign policy operation +// typically these are obtained from a http.Request +// +// swagger:parameters KMSAssignPolicy +type KMSAssignPolicyParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /* + Required: true + In: body + */ + Body models.KmsAssignPolicyRequest + /*KMS policy name + Required: true + In: path + */ + Name string +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewKMSAssignPolicyParams() beforehand. +func (o *KMSAssignPolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + if runtime.HasBody(r) { + defer r.Body.Close() + var body models.KmsAssignPolicyRequest + if err := route.Consumer.Consume(r.Body, &body); err != nil { + if err == io.EOF { + res = append(res, errors.Required("body", "body", "")) + } else { + res = append(res, errors.NewParseError("body", "body", "", err)) + } + } else { + // no validation on generic interface + o.Body = body + } + } else { + res = append(res, errors.Required("body", "body", "")) + } + + rName, rhkName, _ := route.Params.GetOK("name") + if err := o.bindName(rName, rhkName, route.Formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindName binds and validates parameter Name from path. +func (o *KMSAssignPolicyParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: true + // Parameter is provided by construction from the route + o.Name = raw + + return nil +} diff --git a/restapi/operations/k_m_s/k_m_s_assign_policy_responses.go b/restapi/operations/k_m_s/k_m_s_assign_policy_responses.go new file mode 100644 index 000000000..5fa23b17d --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_assign_policy_responses.go @@ -0,0 +1,115 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/minio/console/models" +) + +// KMSAssignPolicyOKCode is the HTTP code returned for type KMSAssignPolicyOK +const KMSAssignPolicyOKCode int = 200 + +/* +KMSAssignPolicyOK A successful response. + +swagger:response kMSAssignPolicyOK +*/ +type KMSAssignPolicyOK struct { +} + +// NewKMSAssignPolicyOK creates KMSAssignPolicyOK with default headers values +func NewKMSAssignPolicyOK() *KMSAssignPolicyOK { + + return &KMSAssignPolicyOK{} +} + +// WriteResponse to the client +func (o *KMSAssignPolicyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(200) +} + +/* +KMSAssignPolicyDefault Generic error response. + +swagger:response kMSAssignPolicyDefault +*/ +type KMSAssignPolicyDefault struct { + _statusCode int + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewKMSAssignPolicyDefault creates KMSAssignPolicyDefault with default headers values +func NewKMSAssignPolicyDefault(code int) *KMSAssignPolicyDefault { + if code <= 0 { + code = 500 + } + + return &KMSAssignPolicyDefault{ + _statusCode: code, + } +} + +// WithStatusCode adds the status to the k m s assign policy default response +func (o *KMSAssignPolicyDefault) WithStatusCode(code int) *KMSAssignPolicyDefault { + o._statusCode = code + return o +} + +// SetStatusCode sets the status to the k m s assign policy default response +func (o *KMSAssignPolicyDefault) SetStatusCode(code int) { + o._statusCode = code +} + +// WithPayload adds the payload to the k m s assign policy default response +func (o *KMSAssignPolicyDefault) WithPayload(payload *models.Error) *KMSAssignPolicyDefault { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the k m s assign policy default response +func (o *KMSAssignPolicyDefault) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *KMSAssignPolicyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(o._statusCode) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/restapi/operations/k_m_s/k_m_s_assign_policy_urlbuilder.go b/restapi/operations/k_m_s/k_m_s_assign_policy_urlbuilder.go new file mode 100644 index 000000000..d1b93703b --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_assign_policy_urlbuilder.go @@ -0,0 +1,116 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" + "strings" +) + +// KMSAssignPolicyURL generates an URL for the k m s assign policy operation +type KMSAssignPolicyURL struct { + Name string + + _basePath string + // avoid unkeyed usage + _ struct{} +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSAssignPolicyURL) WithBasePath(bp string) *KMSAssignPolicyURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSAssignPolicyURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *KMSAssignPolicyURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/kms/policy/{name}/assign" + + name := o.Name + if name != "" { + _path = strings.Replace(_path, "{name}", name, -1) + } else { + return nil, errors.New("name is required on KMSAssignPolicyURL") + } + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *KMSAssignPolicyURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *KMSAssignPolicyURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *KMSAssignPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on KMSAssignPolicyURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on KMSAssignPolicyURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *KMSAssignPolicyURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/restapi/operations/k_m_s/k_m_s_create_key.go b/restapi/operations/k_m_s/k_m_s_create_key.go new file mode 100644 index 000000000..03ec19856 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_create_key.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// KMSCreateKeyHandlerFunc turns a function with the right signature into a k m s create key handler +type KMSCreateKeyHandlerFunc func(KMSCreateKeyParams, *models.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn KMSCreateKeyHandlerFunc) Handle(params KMSCreateKeyParams, principal *models.Principal) middleware.Responder { + return fn(params, principal) +} + +// KMSCreateKeyHandler interface for that can handle valid k m s create key params +type KMSCreateKeyHandler interface { + Handle(KMSCreateKeyParams, *models.Principal) middleware.Responder +} + +// NewKMSCreateKey creates a new http.Handler for the k m s create key operation +func NewKMSCreateKey(ctx *middleware.Context, handler KMSCreateKeyHandler) *KMSCreateKey { + return &KMSCreateKey{Context: ctx, Handler: handler} +} + +/* + KMSCreateKey swagger:route POST /kms/key KMS kMSCreateKey + +KMS create key +*/ +type KMSCreateKey struct { + Context *middleware.Context + Handler KMSCreateKeyHandler +} + +func (o *KMSCreateKey) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewKMSCreateKeyParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *models.Principal + if uprinc != nil { + principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/restapi/operations/k_m_s/k_m_s_create_key_parameters.go b/restapi/operations/k_m_s/k_m_s_create_key_parameters.go new file mode 100644 index 000000000..682f51f34 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_create_key_parameters.go @@ -0,0 +1,89 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "io" + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// NewKMSCreateKeyParams creates a new KMSCreateKeyParams object +// +// There are no default values defined in the spec. +func NewKMSCreateKeyParams() KMSCreateKeyParams { + + return KMSCreateKeyParams{} +} + +// KMSCreateKeyParams contains all the bound params for the k m s create key operation +// typically these are obtained from a http.Request +// +// swagger:parameters KMSCreateKey +type KMSCreateKeyParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /* + Required: true + In: body + */ + Body models.KmsCreateKeyRequest +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewKMSCreateKeyParams() beforehand. +func (o *KMSCreateKeyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + if runtime.HasBody(r) { + defer r.Body.Close() + var body models.KmsCreateKeyRequest + if err := route.Consumer.Consume(r.Body, &body); err != nil { + if err == io.EOF { + res = append(res, errors.Required("body", "body", "")) + } else { + res = append(res, errors.NewParseError("body", "body", "", err)) + } + } else { + // no validation on generic interface + o.Body = body + } + } else { + res = append(res, errors.Required("body", "body", "")) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/restapi/operations/k_m_s/k_m_s_create_key_responses.go b/restapi/operations/k_m_s/k_m_s_create_key_responses.go new file mode 100644 index 000000000..ba72e9d90 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_create_key_responses.go @@ -0,0 +1,115 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/minio/console/models" +) + +// KMSCreateKeyCreatedCode is the HTTP code returned for type KMSCreateKeyCreated +const KMSCreateKeyCreatedCode int = 201 + +/* +KMSCreateKeyCreated A successful response. + +swagger:response kMSCreateKeyCreated +*/ +type KMSCreateKeyCreated struct { +} + +// NewKMSCreateKeyCreated creates KMSCreateKeyCreated with default headers values +func NewKMSCreateKeyCreated() *KMSCreateKeyCreated { + + return &KMSCreateKeyCreated{} +} + +// WriteResponse to the client +func (o *KMSCreateKeyCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(201) +} + +/* +KMSCreateKeyDefault Generic error response. + +swagger:response kMSCreateKeyDefault +*/ +type KMSCreateKeyDefault struct { + _statusCode int + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewKMSCreateKeyDefault creates KMSCreateKeyDefault with default headers values +func NewKMSCreateKeyDefault(code int) *KMSCreateKeyDefault { + if code <= 0 { + code = 500 + } + + return &KMSCreateKeyDefault{ + _statusCode: code, + } +} + +// WithStatusCode adds the status to the k m s create key default response +func (o *KMSCreateKeyDefault) WithStatusCode(code int) *KMSCreateKeyDefault { + o._statusCode = code + return o +} + +// SetStatusCode sets the status to the k m s create key default response +func (o *KMSCreateKeyDefault) SetStatusCode(code int) { + o._statusCode = code +} + +// WithPayload adds the payload to the k m s create key default response +func (o *KMSCreateKeyDefault) WithPayload(payload *models.Error) *KMSCreateKeyDefault { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the k m s create key default response +func (o *KMSCreateKeyDefault) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *KMSCreateKeyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(o._statusCode) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/restapi/operations/k_m_s/k_m_s_create_key_urlbuilder.go b/restapi/operations/k_m_s/k_m_s_create_key_urlbuilder.go new file mode 100644 index 000000000..5630dc51f --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_create_key_urlbuilder.go @@ -0,0 +1,104 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" +) + +// KMSCreateKeyURL generates an URL for the k m s create key operation +type KMSCreateKeyURL struct { + _basePath string +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSCreateKeyURL) WithBasePath(bp string) *KMSCreateKeyURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSCreateKeyURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *KMSCreateKeyURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/kms/key" + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *KMSCreateKeyURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *KMSCreateKeyURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *KMSCreateKeyURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on KMSCreateKeyURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on KMSCreateKeyURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *KMSCreateKeyURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/restapi/operations/k_m_s/k_m_s_delete_identity.go b/restapi/operations/k_m_s/k_m_s_delete_identity.go new file mode 100644 index 000000000..8e93cb47f --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_delete_identity.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// KMSDeleteIdentityHandlerFunc turns a function with the right signature into a k m s delete identity handler +type KMSDeleteIdentityHandlerFunc func(KMSDeleteIdentityParams, *models.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn KMSDeleteIdentityHandlerFunc) Handle(params KMSDeleteIdentityParams, principal *models.Principal) middleware.Responder { + return fn(params, principal) +} + +// KMSDeleteIdentityHandler interface for that can handle valid k m s delete identity params +type KMSDeleteIdentityHandler interface { + Handle(KMSDeleteIdentityParams, *models.Principal) middleware.Responder +} + +// NewKMSDeleteIdentity creates a new http.Handler for the k m s delete identity operation +func NewKMSDeleteIdentity(ctx *middleware.Context, handler KMSDeleteIdentityHandler) *KMSDeleteIdentity { + return &KMSDeleteIdentity{Context: ctx, Handler: handler} +} + +/* + KMSDeleteIdentity swagger:route DELETE /kms/identity/{name} KMS kMSDeleteIdentity + +KMS delete identity +*/ +type KMSDeleteIdentity struct { + Context *middleware.Context + Handler KMSDeleteIdentityHandler +} + +func (o *KMSDeleteIdentity) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewKMSDeleteIdentityParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *models.Principal + if uprinc != nil { + principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/restapi/operations/k_m_s/k_m_s_delete_identity_parameters.go b/restapi/operations/k_m_s/k_m_s_delete_identity_parameters.go new file mode 100644 index 000000000..ca2561092 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_delete_identity_parameters.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" +) + +// NewKMSDeleteIdentityParams creates a new KMSDeleteIdentityParams object +// +// There are no default values defined in the spec. +func NewKMSDeleteIdentityParams() KMSDeleteIdentityParams { + + return KMSDeleteIdentityParams{} +} + +// KMSDeleteIdentityParams contains all the bound params for the k m s delete identity operation +// typically these are obtained from a http.Request +// +// swagger:parameters KMSDeleteIdentity +type KMSDeleteIdentityParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /*KMS identity name + Required: true + In: path + */ + Name string +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewKMSDeleteIdentityParams() beforehand. +func (o *KMSDeleteIdentityParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + rName, rhkName, _ := route.Params.GetOK("name") + if err := o.bindName(rName, rhkName, route.Formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindName binds and validates parameter Name from path. +func (o *KMSDeleteIdentityParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: true + // Parameter is provided by construction from the route + o.Name = raw + + return nil +} diff --git a/restapi/operations/k_m_s/k_m_s_delete_identity_responses.go b/restapi/operations/k_m_s/k_m_s_delete_identity_responses.go new file mode 100644 index 000000000..44c26d677 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_delete_identity_responses.go @@ -0,0 +1,115 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/minio/console/models" +) + +// KMSDeleteIdentityOKCode is the HTTP code returned for type KMSDeleteIdentityOK +const KMSDeleteIdentityOKCode int = 200 + +/* +KMSDeleteIdentityOK A successful response. + +swagger:response kMSDeleteIdentityOK +*/ +type KMSDeleteIdentityOK struct { +} + +// NewKMSDeleteIdentityOK creates KMSDeleteIdentityOK with default headers values +func NewKMSDeleteIdentityOK() *KMSDeleteIdentityOK { + + return &KMSDeleteIdentityOK{} +} + +// WriteResponse to the client +func (o *KMSDeleteIdentityOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(200) +} + +/* +KMSDeleteIdentityDefault Generic error response. + +swagger:response kMSDeleteIdentityDefault +*/ +type KMSDeleteIdentityDefault struct { + _statusCode int + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewKMSDeleteIdentityDefault creates KMSDeleteIdentityDefault with default headers values +func NewKMSDeleteIdentityDefault(code int) *KMSDeleteIdentityDefault { + if code <= 0 { + code = 500 + } + + return &KMSDeleteIdentityDefault{ + _statusCode: code, + } +} + +// WithStatusCode adds the status to the k m s delete identity default response +func (o *KMSDeleteIdentityDefault) WithStatusCode(code int) *KMSDeleteIdentityDefault { + o._statusCode = code + return o +} + +// SetStatusCode sets the status to the k m s delete identity default response +func (o *KMSDeleteIdentityDefault) SetStatusCode(code int) { + o._statusCode = code +} + +// WithPayload adds the payload to the k m s delete identity default response +func (o *KMSDeleteIdentityDefault) WithPayload(payload *models.Error) *KMSDeleteIdentityDefault { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the k m s delete identity default response +func (o *KMSDeleteIdentityDefault) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *KMSDeleteIdentityDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(o._statusCode) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/restapi/operations/k_m_s/k_m_s_delete_identity_urlbuilder.go b/restapi/operations/k_m_s/k_m_s_delete_identity_urlbuilder.go new file mode 100644 index 000000000..e0b1b4b55 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_delete_identity_urlbuilder.go @@ -0,0 +1,116 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" + "strings" +) + +// KMSDeleteIdentityURL generates an URL for the k m s delete identity operation +type KMSDeleteIdentityURL struct { + Name string + + _basePath string + // avoid unkeyed usage + _ struct{} +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSDeleteIdentityURL) WithBasePath(bp string) *KMSDeleteIdentityURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSDeleteIdentityURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *KMSDeleteIdentityURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/kms/identity/{name}" + + name := o.Name + if name != "" { + _path = strings.Replace(_path, "{name}", name, -1) + } else { + return nil, errors.New("name is required on KMSDeleteIdentityURL") + } + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *KMSDeleteIdentityURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *KMSDeleteIdentityURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *KMSDeleteIdentityURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on KMSDeleteIdentityURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on KMSDeleteIdentityURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *KMSDeleteIdentityURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/restapi/operations/k_m_s/k_m_s_delete_key.go b/restapi/operations/k_m_s/k_m_s_delete_key.go new file mode 100644 index 000000000..d27be18d0 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_delete_key.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// KMSDeleteKeyHandlerFunc turns a function with the right signature into a k m s delete key handler +type KMSDeleteKeyHandlerFunc func(KMSDeleteKeyParams, *models.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn KMSDeleteKeyHandlerFunc) Handle(params KMSDeleteKeyParams, principal *models.Principal) middleware.Responder { + return fn(params, principal) +} + +// KMSDeleteKeyHandler interface for that can handle valid k m s delete key params +type KMSDeleteKeyHandler interface { + Handle(KMSDeleteKeyParams, *models.Principal) middleware.Responder +} + +// NewKMSDeleteKey creates a new http.Handler for the k m s delete key operation +func NewKMSDeleteKey(ctx *middleware.Context, handler KMSDeleteKeyHandler) *KMSDeleteKey { + return &KMSDeleteKey{Context: ctx, Handler: handler} +} + +/* + KMSDeleteKey swagger:route DELETE /kms/key/{name} KMS kMSDeleteKey + +KMS delete key +*/ +type KMSDeleteKey struct { + Context *middleware.Context + Handler KMSDeleteKeyHandler +} + +func (o *KMSDeleteKey) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewKMSDeleteKeyParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *models.Principal + if uprinc != nil { + principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/restapi/operations/k_m_s/k_m_s_delete_key_parameters.go b/restapi/operations/k_m_s/k_m_s_delete_key_parameters.go new file mode 100644 index 000000000..f1e57a177 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_delete_key_parameters.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" +) + +// NewKMSDeleteKeyParams creates a new KMSDeleteKeyParams object +// +// There are no default values defined in the spec. +func NewKMSDeleteKeyParams() KMSDeleteKeyParams { + + return KMSDeleteKeyParams{} +} + +// KMSDeleteKeyParams contains all the bound params for the k m s delete key operation +// typically these are obtained from a http.Request +// +// swagger:parameters KMSDeleteKey +type KMSDeleteKeyParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /*KMS key name + Required: true + In: path + */ + Name string +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewKMSDeleteKeyParams() beforehand. +func (o *KMSDeleteKeyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + rName, rhkName, _ := route.Params.GetOK("name") + if err := o.bindName(rName, rhkName, route.Formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindName binds and validates parameter Name from path. +func (o *KMSDeleteKeyParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: true + // Parameter is provided by construction from the route + o.Name = raw + + return nil +} diff --git a/restapi/operations/k_m_s/k_m_s_delete_key_responses.go b/restapi/operations/k_m_s/k_m_s_delete_key_responses.go new file mode 100644 index 000000000..03242eff7 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_delete_key_responses.go @@ -0,0 +1,115 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/minio/console/models" +) + +// KMSDeleteKeyOKCode is the HTTP code returned for type KMSDeleteKeyOK +const KMSDeleteKeyOKCode int = 200 + +/* +KMSDeleteKeyOK A successful response. + +swagger:response kMSDeleteKeyOK +*/ +type KMSDeleteKeyOK struct { +} + +// NewKMSDeleteKeyOK creates KMSDeleteKeyOK with default headers values +func NewKMSDeleteKeyOK() *KMSDeleteKeyOK { + + return &KMSDeleteKeyOK{} +} + +// WriteResponse to the client +func (o *KMSDeleteKeyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(200) +} + +/* +KMSDeleteKeyDefault Generic error response. + +swagger:response kMSDeleteKeyDefault +*/ +type KMSDeleteKeyDefault struct { + _statusCode int + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewKMSDeleteKeyDefault creates KMSDeleteKeyDefault with default headers values +func NewKMSDeleteKeyDefault(code int) *KMSDeleteKeyDefault { + if code <= 0 { + code = 500 + } + + return &KMSDeleteKeyDefault{ + _statusCode: code, + } +} + +// WithStatusCode adds the status to the k m s delete key default response +func (o *KMSDeleteKeyDefault) WithStatusCode(code int) *KMSDeleteKeyDefault { + o._statusCode = code + return o +} + +// SetStatusCode sets the status to the k m s delete key default response +func (o *KMSDeleteKeyDefault) SetStatusCode(code int) { + o._statusCode = code +} + +// WithPayload adds the payload to the k m s delete key default response +func (o *KMSDeleteKeyDefault) WithPayload(payload *models.Error) *KMSDeleteKeyDefault { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the k m s delete key default response +func (o *KMSDeleteKeyDefault) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *KMSDeleteKeyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(o._statusCode) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/restapi/operations/k_m_s/k_m_s_delete_key_urlbuilder.go b/restapi/operations/k_m_s/k_m_s_delete_key_urlbuilder.go new file mode 100644 index 000000000..d408c29f2 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_delete_key_urlbuilder.go @@ -0,0 +1,116 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" + "strings" +) + +// KMSDeleteKeyURL generates an URL for the k m s delete key operation +type KMSDeleteKeyURL struct { + Name string + + _basePath string + // avoid unkeyed usage + _ struct{} +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSDeleteKeyURL) WithBasePath(bp string) *KMSDeleteKeyURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSDeleteKeyURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *KMSDeleteKeyURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/kms/key/{name}" + + name := o.Name + if name != "" { + _path = strings.Replace(_path, "{name}", name, -1) + } else { + return nil, errors.New("name is required on KMSDeleteKeyURL") + } + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *KMSDeleteKeyURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *KMSDeleteKeyURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *KMSDeleteKeyURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on KMSDeleteKeyURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on KMSDeleteKeyURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *KMSDeleteKeyURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/restapi/operations/k_m_s/k_m_s_delete_policy.go b/restapi/operations/k_m_s/k_m_s_delete_policy.go new file mode 100644 index 000000000..9a1be3b7f --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_delete_policy.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// KMSDeletePolicyHandlerFunc turns a function with the right signature into a k m s delete policy handler +type KMSDeletePolicyHandlerFunc func(KMSDeletePolicyParams, *models.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn KMSDeletePolicyHandlerFunc) Handle(params KMSDeletePolicyParams, principal *models.Principal) middleware.Responder { + return fn(params, principal) +} + +// KMSDeletePolicyHandler interface for that can handle valid k m s delete policy params +type KMSDeletePolicyHandler interface { + Handle(KMSDeletePolicyParams, *models.Principal) middleware.Responder +} + +// NewKMSDeletePolicy creates a new http.Handler for the k m s delete policy operation +func NewKMSDeletePolicy(ctx *middleware.Context, handler KMSDeletePolicyHandler) *KMSDeletePolicy { + return &KMSDeletePolicy{Context: ctx, Handler: handler} +} + +/* + KMSDeletePolicy swagger:route DELETE /kms/policy/{name} KMS kMSDeletePolicy + +KMS delete policy +*/ +type KMSDeletePolicy struct { + Context *middleware.Context + Handler KMSDeletePolicyHandler +} + +func (o *KMSDeletePolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewKMSDeletePolicyParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *models.Principal + if uprinc != nil { + principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/restapi/operations/k_m_s/k_m_s_delete_policy_parameters.go b/restapi/operations/k_m_s/k_m_s_delete_policy_parameters.go new file mode 100644 index 000000000..5e3160dd6 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_delete_policy_parameters.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" +) + +// NewKMSDeletePolicyParams creates a new KMSDeletePolicyParams object +// +// There are no default values defined in the spec. +func NewKMSDeletePolicyParams() KMSDeletePolicyParams { + + return KMSDeletePolicyParams{} +} + +// KMSDeletePolicyParams contains all the bound params for the k m s delete policy operation +// typically these are obtained from a http.Request +// +// swagger:parameters KMSDeletePolicy +type KMSDeletePolicyParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /*KMS policy name + Required: true + In: path + */ + Name string +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewKMSDeletePolicyParams() beforehand. +func (o *KMSDeletePolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + rName, rhkName, _ := route.Params.GetOK("name") + if err := o.bindName(rName, rhkName, route.Formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindName binds and validates parameter Name from path. +func (o *KMSDeletePolicyParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: true + // Parameter is provided by construction from the route + o.Name = raw + + return nil +} diff --git a/restapi/operations/k_m_s/k_m_s_delete_policy_responses.go b/restapi/operations/k_m_s/k_m_s_delete_policy_responses.go new file mode 100644 index 000000000..f02abc679 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_delete_policy_responses.go @@ -0,0 +1,115 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/minio/console/models" +) + +// KMSDeletePolicyOKCode is the HTTP code returned for type KMSDeletePolicyOK +const KMSDeletePolicyOKCode int = 200 + +/* +KMSDeletePolicyOK A successful response. + +swagger:response kMSDeletePolicyOK +*/ +type KMSDeletePolicyOK struct { +} + +// NewKMSDeletePolicyOK creates KMSDeletePolicyOK with default headers values +func NewKMSDeletePolicyOK() *KMSDeletePolicyOK { + + return &KMSDeletePolicyOK{} +} + +// WriteResponse to the client +func (o *KMSDeletePolicyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(200) +} + +/* +KMSDeletePolicyDefault Generic error response. + +swagger:response kMSDeletePolicyDefault +*/ +type KMSDeletePolicyDefault struct { + _statusCode int + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewKMSDeletePolicyDefault creates KMSDeletePolicyDefault with default headers values +func NewKMSDeletePolicyDefault(code int) *KMSDeletePolicyDefault { + if code <= 0 { + code = 500 + } + + return &KMSDeletePolicyDefault{ + _statusCode: code, + } +} + +// WithStatusCode adds the status to the k m s delete policy default response +func (o *KMSDeletePolicyDefault) WithStatusCode(code int) *KMSDeletePolicyDefault { + o._statusCode = code + return o +} + +// SetStatusCode sets the status to the k m s delete policy default response +func (o *KMSDeletePolicyDefault) SetStatusCode(code int) { + o._statusCode = code +} + +// WithPayload adds the payload to the k m s delete policy default response +func (o *KMSDeletePolicyDefault) WithPayload(payload *models.Error) *KMSDeletePolicyDefault { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the k m s delete policy default response +func (o *KMSDeletePolicyDefault) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *KMSDeletePolicyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(o._statusCode) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/restapi/operations/k_m_s/k_m_s_delete_policy_urlbuilder.go b/restapi/operations/k_m_s/k_m_s_delete_policy_urlbuilder.go new file mode 100644 index 000000000..a780f23e1 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_delete_policy_urlbuilder.go @@ -0,0 +1,116 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" + "strings" +) + +// KMSDeletePolicyURL generates an URL for the k m s delete policy operation +type KMSDeletePolicyURL struct { + Name string + + _basePath string + // avoid unkeyed usage + _ struct{} +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSDeletePolicyURL) WithBasePath(bp string) *KMSDeletePolicyURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSDeletePolicyURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *KMSDeletePolicyURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/kms/policy/{name}" + + name := o.Name + if name != "" { + _path = strings.Replace(_path, "{name}", name, -1) + } else { + return nil, errors.New("name is required on KMSDeletePolicyURL") + } + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *KMSDeletePolicyURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *KMSDeletePolicyURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *KMSDeletePolicyURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on KMSDeletePolicyURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on KMSDeletePolicyURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *KMSDeletePolicyURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/restapi/operations/k_m_s/k_m_s_describe_identity.go b/restapi/operations/k_m_s/k_m_s_describe_identity.go new file mode 100644 index 000000000..d69c126a8 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_describe_identity.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// KMSDescribeIdentityHandlerFunc turns a function with the right signature into a k m s describe identity handler +type KMSDescribeIdentityHandlerFunc func(KMSDescribeIdentityParams, *models.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn KMSDescribeIdentityHandlerFunc) Handle(params KMSDescribeIdentityParams, principal *models.Principal) middleware.Responder { + return fn(params, principal) +} + +// KMSDescribeIdentityHandler interface for that can handle valid k m s describe identity params +type KMSDescribeIdentityHandler interface { + Handle(KMSDescribeIdentityParams, *models.Principal) middleware.Responder +} + +// NewKMSDescribeIdentity creates a new http.Handler for the k m s describe identity operation +func NewKMSDescribeIdentity(ctx *middleware.Context, handler KMSDescribeIdentityHandler) *KMSDescribeIdentity { + return &KMSDescribeIdentity{Context: ctx, Handler: handler} +} + +/* + KMSDescribeIdentity swagger:route GET /kms/identity/{name}/describe KMS kMSDescribeIdentity + +KMS describe identity +*/ +type KMSDescribeIdentity struct { + Context *middleware.Context + Handler KMSDescribeIdentityHandler +} + +func (o *KMSDescribeIdentity) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewKMSDescribeIdentityParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *models.Principal + if uprinc != nil { + principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/restapi/operations/k_m_s/k_m_s_describe_identity_parameters.go b/restapi/operations/k_m_s/k_m_s_describe_identity_parameters.go new file mode 100644 index 000000000..0528f0821 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_describe_identity_parameters.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" +) + +// NewKMSDescribeIdentityParams creates a new KMSDescribeIdentityParams object +// +// There are no default values defined in the spec. +func NewKMSDescribeIdentityParams() KMSDescribeIdentityParams { + + return KMSDescribeIdentityParams{} +} + +// KMSDescribeIdentityParams contains all the bound params for the k m s describe identity operation +// typically these are obtained from a http.Request +// +// swagger:parameters KMSDescribeIdentity +type KMSDescribeIdentityParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /*KMS identity name + Required: true + In: path + */ + Name string +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewKMSDescribeIdentityParams() beforehand. +func (o *KMSDescribeIdentityParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + rName, rhkName, _ := route.Params.GetOK("name") + if err := o.bindName(rName, rhkName, route.Formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindName binds and validates parameter Name from path. +func (o *KMSDescribeIdentityParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: true + // Parameter is provided by construction from the route + o.Name = raw + + return nil +} diff --git a/restapi/operations/k_m_s/k_m_s_describe_identity_responses.go b/restapi/operations/k_m_s/k_m_s_describe_identity_responses.go new file mode 100644 index 000000000..1b4b53af5 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_describe_identity_responses.go @@ -0,0 +1,133 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/minio/console/models" +) + +// KMSDescribeIdentityOKCode is the HTTP code returned for type KMSDescribeIdentityOK +const KMSDescribeIdentityOKCode int = 200 + +/* +KMSDescribeIdentityOK A successful response. + +swagger:response kMSDescribeIdentityOK +*/ +type KMSDescribeIdentityOK struct { + + /* + In: Body + */ + Payload models.KmsDescribeIdentityResponse `json:"body,omitempty"` +} + +// NewKMSDescribeIdentityOK creates KMSDescribeIdentityOK with default headers values +func NewKMSDescribeIdentityOK() *KMSDescribeIdentityOK { + + return &KMSDescribeIdentityOK{} +} + +// WithPayload adds the payload to the k m s describe identity o k response +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) { + o.Payload = payload +} + +// WriteResponse to the client +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 + } +} + +/* +KMSDescribeIdentityDefault Generic error response. + +swagger:response kMSDescribeIdentityDefault +*/ +type KMSDescribeIdentityDefault struct { + _statusCode int + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewKMSDescribeIdentityDefault creates KMSDescribeIdentityDefault with default headers values +func NewKMSDescribeIdentityDefault(code int) *KMSDescribeIdentityDefault { + if code <= 0 { + code = 500 + } + + return &KMSDescribeIdentityDefault{ + _statusCode: code, + } +} + +// WithStatusCode adds the status to the k m s describe identity default response +func (o *KMSDescribeIdentityDefault) WithStatusCode(code int) *KMSDescribeIdentityDefault { + o._statusCode = code + return o +} + +// SetStatusCode sets the status to the k m s describe identity default response +func (o *KMSDescribeIdentityDefault) SetStatusCode(code int) { + o._statusCode = code +} + +// WithPayload adds the payload to the k m s describe identity default response +func (o *KMSDescribeIdentityDefault) WithPayload(payload *models.Error) *KMSDescribeIdentityDefault { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the k m s describe identity default response +func (o *KMSDescribeIdentityDefault) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *KMSDescribeIdentityDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(o._statusCode) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/restapi/operations/k_m_s/k_m_s_describe_identity_urlbuilder.go b/restapi/operations/k_m_s/k_m_s_describe_identity_urlbuilder.go new file mode 100644 index 000000000..47aef1755 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_describe_identity_urlbuilder.go @@ -0,0 +1,116 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" + "strings" +) + +// KMSDescribeIdentityURL generates an URL for the k m s describe identity operation +type KMSDescribeIdentityURL struct { + Name string + + _basePath string + // avoid unkeyed usage + _ struct{} +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSDescribeIdentityURL) WithBasePath(bp string) *KMSDescribeIdentityURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSDescribeIdentityURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *KMSDescribeIdentityURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/kms/identity/{name}/describe" + + name := o.Name + if name != "" { + _path = strings.Replace(_path, "{name}", name, -1) + } else { + return nil, errors.New("name is required on KMSDescribeIdentityURL") + } + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *KMSDescribeIdentityURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *KMSDescribeIdentityURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *KMSDescribeIdentityURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on KMSDescribeIdentityURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on KMSDescribeIdentityURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *KMSDescribeIdentityURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/restapi/operations/k_m_s/k_m_s_describe_policy.go b/restapi/operations/k_m_s/k_m_s_describe_policy.go new file mode 100644 index 000000000..c88d433e9 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_describe_policy.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// KMSDescribePolicyHandlerFunc turns a function with the right signature into a k m s describe policy handler +type KMSDescribePolicyHandlerFunc func(KMSDescribePolicyParams, *models.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn KMSDescribePolicyHandlerFunc) Handle(params KMSDescribePolicyParams, principal *models.Principal) middleware.Responder { + return fn(params, principal) +} + +// KMSDescribePolicyHandler interface for that can handle valid k m s describe policy params +type KMSDescribePolicyHandler interface { + Handle(KMSDescribePolicyParams, *models.Principal) middleware.Responder +} + +// NewKMSDescribePolicy creates a new http.Handler for the k m s describe policy operation +func NewKMSDescribePolicy(ctx *middleware.Context, handler KMSDescribePolicyHandler) *KMSDescribePolicy { + return &KMSDescribePolicy{Context: ctx, Handler: handler} +} + +/* + KMSDescribePolicy swagger:route GET /kms/policy/{name}/describe KMS kMSDescribePolicy + +KMS describe policy +*/ +type KMSDescribePolicy struct { + Context *middleware.Context + Handler KMSDescribePolicyHandler +} + +func (o *KMSDescribePolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewKMSDescribePolicyParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *models.Principal + if uprinc != nil { + principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/restapi/operations/k_m_s/k_m_s_describe_policy_parameters.go b/restapi/operations/k_m_s/k_m_s_describe_policy_parameters.go new file mode 100644 index 000000000..e65372125 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_describe_policy_parameters.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" +) + +// NewKMSDescribePolicyParams creates a new KMSDescribePolicyParams object +// +// There are no default values defined in the spec. +func NewKMSDescribePolicyParams() KMSDescribePolicyParams { + + return KMSDescribePolicyParams{} +} + +// KMSDescribePolicyParams contains all the bound params for the k m s describe policy operation +// typically these are obtained from a http.Request +// +// swagger:parameters KMSDescribePolicy +type KMSDescribePolicyParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /*KMS policy name + Required: true + In: path + */ + Name string +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewKMSDescribePolicyParams() beforehand. +func (o *KMSDescribePolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + rName, rhkName, _ := route.Params.GetOK("name") + if err := o.bindName(rName, rhkName, route.Formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindName binds and validates parameter Name from path. +func (o *KMSDescribePolicyParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: true + // Parameter is provided by construction from the route + o.Name = raw + + return nil +} diff --git a/restapi/operations/k_m_s/k_m_s_describe_policy_responses.go b/restapi/operations/k_m_s/k_m_s_describe_policy_responses.go new file mode 100644 index 000000000..428151039 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_describe_policy_responses.go @@ -0,0 +1,133 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/minio/console/models" +) + +// KMSDescribePolicyOKCode is the HTTP code returned for type KMSDescribePolicyOK +const KMSDescribePolicyOKCode int = 200 + +/* +KMSDescribePolicyOK A successful response. + +swagger:response kMSDescribePolicyOK +*/ +type KMSDescribePolicyOK struct { + + /* + In: Body + */ + Payload models.KmsDescribePolicyResponse `json:"body,omitempty"` +} + +// NewKMSDescribePolicyOK creates KMSDescribePolicyOK with default headers values +func NewKMSDescribePolicyOK() *KMSDescribePolicyOK { + + return &KMSDescribePolicyOK{} +} + +// WithPayload adds the payload to the k m s describe policy o k response +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) { + o.Payload = payload +} + +// WriteResponse to the client +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 + } +} + +/* +KMSDescribePolicyDefault Generic error response. + +swagger:response kMSDescribePolicyDefault +*/ +type KMSDescribePolicyDefault struct { + _statusCode int + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewKMSDescribePolicyDefault creates KMSDescribePolicyDefault with default headers values +func NewKMSDescribePolicyDefault(code int) *KMSDescribePolicyDefault { + if code <= 0 { + code = 500 + } + + return &KMSDescribePolicyDefault{ + _statusCode: code, + } +} + +// WithStatusCode adds the status to the k m s describe policy default response +func (o *KMSDescribePolicyDefault) WithStatusCode(code int) *KMSDescribePolicyDefault { + o._statusCode = code + return o +} + +// SetStatusCode sets the status to the k m s describe policy default response +func (o *KMSDescribePolicyDefault) SetStatusCode(code int) { + o._statusCode = code +} + +// WithPayload adds the payload to the k m s describe policy default response +func (o *KMSDescribePolicyDefault) WithPayload(payload *models.Error) *KMSDescribePolicyDefault { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the k m s describe policy default response +func (o *KMSDescribePolicyDefault) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *KMSDescribePolicyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(o._statusCode) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/restapi/operations/k_m_s/k_m_s_describe_policy_urlbuilder.go b/restapi/operations/k_m_s/k_m_s_describe_policy_urlbuilder.go new file mode 100644 index 000000000..a9c438329 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_describe_policy_urlbuilder.go @@ -0,0 +1,116 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" + "strings" +) + +// KMSDescribePolicyURL generates an URL for the k m s describe policy operation +type KMSDescribePolicyURL struct { + Name string + + _basePath string + // avoid unkeyed usage + _ struct{} +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSDescribePolicyURL) WithBasePath(bp string) *KMSDescribePolicyURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSDescribePolicyURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *KMSDescribePolicyURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/kms/policy/{name}/describe" + + name := o.Name + if name != "" { + _path = strings.Replace(_path, "{name}", name, -1) + } else { + return nil, errors.New("name is required on KMSDescribePolicyURL") + } + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *KMSDescribePolicyURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *KMSDescribePolicyURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *KMSDescribePolicyURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on KMSDescribePolicyURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on KMSDescribePolicyURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *KMSDescribePolicyURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/restapi/operations/k_m_s/k_m_s_describe_self_identity.go b/restapi/operations/k_m_s/k_m_s_describe_self_identity.go new file mode 100644 index 000000000..f29fc7032 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_describe_self_identity.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// KMSDescribeSelfIdentityHandlerFunc turns a function with the right signature into a k m s describe self identity handler +type KMSDescribeSelfIdentityHandlerFunc func(KMSDescribeSelfIdentityParams, *models.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn KMSDescribeSelfIdentityHandlerFunc) Handle(params KMSDescribeSelfIdentityParams, principal *models.Principal) middleware.Responder { + return fn(params, principal) +} + +// KMSDescribeSelfIdentityHandler interface for that can handle valid k m s describe self identity params +type KMSDescribeSelfIdentityHandler interface { + Handle(KMSDescribeSelfIdentityParams, *models.Principal) middleware.Responder +} + +// NewKMSDescribeSelfIdentity creates a new http.Handler for the k m s describe self identity operation +func NewKMSDescribeSelfIdentity(ctx *middleware.Context, handler KMSDescribeSelfIdentityHandler) *KMSDescribeSelfIdentity { + return &KMSDescribeSelfIdentity{Context: ctx, Handler: handler} +} + +/* + KMSDescribeSelfIdentity swagger:route GET /kms/describe-self/identity KMS kMSDescribeSelfIdentity + +KMS describe self identity +*/ +type KMSDescribeSelfIdentity struct { + Context *middleware.Context + Handler KMSDescribeSelfIdentityHandler +} + +func (o *KMSDescribeSelfIdentity) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewKMSDescribeSelfIdentityParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *models.Principal + if uprinc != nil { + principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/restapi/operations/k_m_s/k_m_s_describe_self_identity_parameters.go b/restapi/operations/k_m_s/k_m_s_describe_self_identity_parameters.go new file mode 100644 index 000000000..a170c80fe --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_describe_self_identity_parameters.go @@ -0,0 +1,63 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime/middleware" +) + +// NewKMSDescribeSelfIdentityParams creates a new KMSDescribeSelfIdentityParams object +// +// There are no default values defined in the spec. +func NewKMSDescribeSelfIdentityParams() KMSDescribeSelfIdentityParams { + + return KMSDescribeSelfIdentityParams{} +} + +// KMSDescribeSelfIdentityParams contains all the bound params for the k m s describe self identity operation +// typically these are obtained from a http.Request +// +// swagger:parameters KMSDescribeSelfIdentity +type KMSDescribeSelfIdentityParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewKMSDescribeSelfIdentityParams() beforehand. +func (o *KMSDescribeSelfIdentityParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/restapi/operations/k_m_s/k_m_s_describe_self_identity_responses.go b/restapi/operations/k_m_s/k_m_s_describe_self_identity_responses.go new file mode 100644 index 000000000..5134c6ee9 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_describe_self_identity_responses.go @@ -0,0 +1,133 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/minio/console/models" +) + +// KMSDescribeSelfIdentityOKCode is the HTTP code returned for type KMSDescribeSelfIdentityOK +const KMSDescribeSelfIdentityOKCode int = 200 + +/* +KMSDescribeSelfIdentityOK A successful response. + +swagger:response kMSDescribeSelfIdentityOK +*/ +type KMSDescribeSelfIdentityOK struct { + + /* + In: Body + */ + Payload models.KmsDescribeSelfIdentityResponse `json:"body,omitempty"` +} + +// NewKMSDescribeSelfIdentityOK creates KMSDescribeSelfIdentityOK with default headers values +func NewKMSDescribeSelfIdentityOK() *KMSDescribeSelfIdentityOK { + + return &KMSDescribeSelfIdentityOK{} +} + +// WithPayload adds the payload to the k m s describe self identity o k response +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) { + o.Payload = payload +} + +// WriteResponse to the client +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 + } +} + +/* +KMSDescribeSelfIdentityDefault Generic error response. + +swagger:response kMSDescribeSelfIdentityDefault +*/ +type KMSDescribeSelfIdentityDefault struct { + _statusCode int + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewKMSDescribeSelfIdentityDefault creates KMSDescribeSelfIdentityDefault with default headers values +func NewKMSDescribeSelfIdentityDefault(code int) *KMSDescribeSelfIdentityDefault { + if code <= 0 { + code = 500 + } + + return &KMSDescribeSelfIdentityDefault{ + _statusCode: code, + } +} + +// WithStatusCode adds the status to the k m s describe self identity default response +func (o *KMSDescribeSelfIdentityDefault) WithStatusCode(code int) *KMSDescribeSelfIdentityDefault { + o._statusCode = code + return o +} + +// SetStatusCode sets the status to the k m s describe self identity default response +func (o *KMSDescribeSelfIdentityDefault) SetStatusCode(code int) { + o._statusCode = code +} + +// WithPayload adds the payload to the k m s describe self identity default response +func (o *KMSDescribeSelfIdentityDefault) WithPayload(payload *models.Error) *KMSDescribeSelfIdentityDefault { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the k m s describe self identity default response +func (o *KMSDescribeSelfIdentityDefault) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *KMSDescribeSelfIdentityDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(o._statusCode) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/restapi/operations/k_m_s/k_m_s_describe_self_identity_urlbuilder.go b/restapi/operations/k_m_s/k_m_s_describe_self_identity_urlbuilder.go new file mode 100644 index 000000000..21ec901b5 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_describe_self_identity_urlbuilder.go @@ -0,0 +1,104 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" +) + +// KMSDescribeSelfIdentityURL generates an URL for the k m s describe self identity operation +type KMSDescribeSelfIdentityURL struct { + _basePath string +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSDescribeSelfIdentityURL) WithBasePath(bp string) *KMSDescribeSelfIdentityURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSDescribeSelfIdentityURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *KMSDescribeSelfIdentityURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/kms/describe-self/identity" + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *KMSDescribeSelfIdentityURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *KMSDescribeSelfIdentityURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *KMSDescribeSelfIdentityURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on KMSDescribeSelfIdentityURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on KMSDescribeSelfIdentityURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *KMSDescribeSelfIdentityURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/restapi/operations/k_m_s/k_m_s_get_policy.go b/restapi/operations/k_m_s/k_m_s_get_policy.go new file mode 100644 index 000000000..bbd6f53e0 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_get_policy.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// KMSGetPolicyHandlerFunc turns a function with the right signature into a k m s get policy handler +type KMSGetPolicyHandlerFunc func(KMSGetPolicyParams, *models.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn KMSGetPolicyHandlerFunc) Handle(params KMSGetPolicyParams, principal *models.Principal) middleware.Responder { + return fn(params, principal) +} + +// KMSGetPolicyHandler interface for that can handle valid k m s get policy params +type KMSGetPolicyHandler interface { + Handle(KMSGetPolicyParams, *models.Principal) middleware.Responder +} + +// NewKMSGetPolicy creates a new http.Handler for the k m s get policy operation +func NewKMSGetPolicy(ctx *middleware.Context, handler KMSGetPolicyHandler) *KMSGetPolicy { + return &KMSGetPolicy{Context: ctx, Handler: handler} +} + +/* + KMSGetPolicy swagger:route GET /kms/policy/{name} KMS kMSGetPolicy + +KMS get policy +*/ +type KMSGetPolicy struct { + Context *middleware.Context + Handler KMSGetPolicyHandler +} + +func (o *KMSGetPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewKMSGetPolicyParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *models.Principal + if uprinc != nil { + principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/restapi/operations/k_m_s/k_m_s_get_policy_parameters.go b/restapi/operations/k_m_s/k_m_s_get_policy_parameters.go new file mode 100644 index 000000000..95dd2b3d4 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_get_policy_parameters.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" +) + +// NewKMSGetPolicyParams creates a new KMSGetPolicyParams object +// +// There are no default values defined in the spec. +func NewKMSGetPolicyParams() KMSGetPolicyParams { + + return KMSGetPolicyParams{} +} + +// KMSGetPolicyParams contains all the bound params for the k m s get policy operation +// typically these are obtained from a http.Request +// +// swagger:parameters KMSGetPolicy +type KMSGetPolicyParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /*KMS policy name + Required: true + In: path + */ + Name string +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewKMSGetPolicyParams() beforehand. +func (o *KMSGetPolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + rName, rhkName, _ := route.Params.GetOK("name") + if err := o.bindName(rName, rhkName, route.Formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindName binds and validates parameter Name from path. +func (o *KMSGetPolicyParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: true + // Parameter is provided by construction from the route + o.Name = raw + + return nil +} diff --git a/restapi/operations/k_m_s/k_m_s_get_policy_responses.go b/restapi/operations/k_m_s/k_m_s_get_policy_responses.go new file mode 100644 index 000000000..5946b0fe0 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_get_policy_responses.go @@ -0,0 +1,133 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/minio/console/models" +) + +// KMSGetPolicyOKCode is the HTTP code returned for type KMSGetPolicyOK +const KMSGetPolicyOKCode int = 200 + +/* +KMSGetPolicyOK A successful response. + +swagger:response kMSGetPolicyOK +*/ +type KMSGetPolicyOK struct { + + /* + In: Body + */ + Payload models.KmsGetPolicyResponse `json:"body,omitempty"` +} + +// NewKMSGetPolicyOK creates KMSGetPolicyOK with default headers values +func NewKMSGetPolicyOK() *KMSGetPolicyOK { + + return &KMSGetPolicyOK{} +} + +// WithPayload adds the payload to the k m s get policy o k response +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) { + o.Payload = payload +} + +// WriteResponse to the client +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 + } +} + +/* +KMSGetPolicyDefault Generic error response. + +swagger:response kMSGetPolicyDefault +*/ +type KMSGetPolicyDefault struct { + _statusCode int + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewKMSGetPolicyDefault creates KMSGetPolicyDefault with default headers values +func NewKMSGetPolicyDefault(code int) *KMSGetPolicyDefault { + if code <= 0 { + code = 500 + } + + return &KMSGetPolicyDefault{ + _statusCode: code, + } +} + +// WithStatusCode adds the status to the k m s get policy default response +func (o *KMSGetPolicyDefault) WithStatusCode(code int) *KMSGetPolicyDefault { + o._statusCode = code + return o +} + +// SetStatusCode sets the status to the k m s get policy default response +func (o *KMSGetPolicyDefault) SetStatusCode(code int) { + o._statusCode = code +} + +// WithPayload adds the payload to the k m s get policy default response +func (o *KMSGetPolicyDefault) WithPayload(payload *models.Error) *KMSGetPolicyDefault { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the k m s get policy default response +func (o *KMSGetPolicyDefault) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *KMSGetPolicyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(o._statusCode) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/restapi/operations/k_m_s/k_m_s_get_policy_urlbuilder.go b/restapi/operations/k_m_s/k_m_s_get_policy_urlbuilder.go new file mode 100644 index 000000000..ce7eef015 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_get_policy_urlbuilder.go @@ -0,0 +1,116 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" + "strings" +) + +// KMSGetPolicyURL generates an URL for the k m s get policy operation +type KMSGetPolicyURL struct { + Name string + + _basePath string + // avoid unkeyed usage + _ struct{} +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSGetPolicyURL) WithBasePath(bp string) *KMSGetPolicyURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSGetPolicyURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *KMSGetPolicyURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/kms/policy/{name}" + + name := o.Name + if name != "" { + _path = strings.Replace(_path, "{name}", name, -1) + } else { + return nil, errors.New("name is required on KMSGetPolicyURL") + } + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *KMSGetPolicyURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *KMSGetPolicyURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *KMSGetPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on KMSGetPolicyURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on KMSGetPolicyURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *KMSGetPolicyURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/restapi/operations/k_m_s/k_m_s_import_key.go b/restapi/operations/k_m_s/k_m_s_import_key.go new file mode 100644 index 000000000..8f6b2b9e0 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_import_key.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// KMSImportKeyHandlerFunc turns a function with the right signature into a k m s import key handler +type KMSImportKeyHandlerFunc func(KMSImportKeyParams, *models.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn KMSImportKeyHandlerFunc) Handle(params KMSImportKeyParams, principal *models.Principal) middleware.Responder { + return fn(params, principal) +} + +// KMSImportKeyHandler interface for that can handle valid k m s import key params +type KMSImportKeyHandler interface { + Handle(KMSImportKeyParams, *models.Principal) middleware.Responder +} + +// NewKMSImportKey creates a new http.Handler for the k m s import key operation +func NewKMSImportKey(ctx *middleware.Context, handler KMSImportKeyHandler) *KMSImportKey { + return &KMSImportKey{Context: ctx, Handler: handler} +} + +/* + KMSImportKey swagger:route POST /kms/key/{name}/import KMS kMSImportKey + +KMS import key +*/ +type KMSImportKey struct { + Context *middleware.Context + Handler KMSImportKeyHandler +} + +func (o *KMSImportKey) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewKMSImportKeyParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *models.Principal + if uprinc != nil { + principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/restapi/operations/k_m_s/k_m_s_import_key_parameters.go b/restapi/operations/k_m_s/k_m_s_import_key_parameters.go new file mode 100644 index 000000000..4eaa30405 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_import_key_parameters.go @@ -0,0 +1,114 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "io" + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" + + "github.com/minio/console/models" +) + +// NewKMSImportKeyParams creates a new KMSImportKeyParams object +// +// There are no default values defined in the spec. +func NewKMSImportKeyParams() KMSImportKeyParams { + + return KMSImportKeyParams{} +} + +// KMSImportKeyParams contains all the bound params for the k m s import key operation +// typically these are obtained from a http.Request +// +// swagger:parameters KMSImportKey +type KMSImportKeyParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /* + Required: true + In: body + */ + Body models.KmsImportKeyRequest + /*KMS key name + Required: true + In: path + */ + Name string +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewKMSImportKeyParams() beforehand. +func (o *KMSImportKeyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + if runtime.HasBody(r) { + defer r.Body.Close() + var body models.KmsImportKeyRequest + if err := route.Consumer.Consume(r.Body, &body); err != nil { + if err == io.EOF { + res = append(res, errors.Required("body", "body", "")) + } else { + res = append(res, errors.NewParseError("body", "body", "", err)) + } + } else { + // no validation on generic interface + o.Body = body + } + } else { + res = append(res, errors.Required("body", "body", "")) + } + + rName, rhkName, _ := route.Params.GetOK("name") + if err := o.bindName(rName, rhkName, route.Formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindName binds and validates parameter Name from path. +func (o *KMSImportKeyParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: true + // Parameter is provided by construction from the route + o.Name = raw + + return nil +} diff --git a/restapi/operations/k_m_s/k_m_s_import_key_responses.go b/restapi/operations/k_m_s/k_m_s_import_key_responses.go new file mode 100644 index 000000000..15f3dfbea --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_import_key_responses.go @@ -0,0 +1,115 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/minio/console/models" +) + +// KMSImportKeyCreatedCode is the HTTP code returned for type KMSImportKeyCreated +const KMSImportKeyCreatedCode int = 201 + +/* +KMSImportKeyCreated A successful response. + +swagger:response kMSImportKeyCreated +*/ +type KMSImportKeyCreated struct { +} + +// NewKMSImportKeyCreated creates KMSImportKeyCreated with default headers values +func NewKMSImportKeyCreated() *KMSImportKeyCreated { + + return &KMSImportKeyCreated{} +} + +// WriteResponse to the client +func (o *KMSImportKeyCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(201) +} + +/* +KMSImportKeyDefault Generic error response. + +swagger:response kMSImportKeyDefault +*/ +type KMSImportKeyDefault struct { + _statusCode int + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewKMSImportKeyDefault creates KMSImportKeyDefault with default headers values +func NewKMSImportKeyDefault(code int) *KMSImportKeyDefault { + if code <= 0 { + code = 500 + } + + return &KMSImportKeyDefault{ + _statusCode: code, + } +} + +// WithStatusCode adds the status to the k m s import key default response +func (o *KMSImportKeyDefault) WithStatusCode(code int) *KMSImportKeyDefault { + o._statusCode = code + return o +} + +// SetStatusCode sets the status to the k m s import key default response +func (o *KMSImportKeyDefault) SetStatusCode(code int) { + o._statusCode = code +} + +// WithPayload adds the payload to the k m s import key default response +func (o *KMSImportKeyDefault) WithPayload(payload *models.Error) *KMSImportKeyDefault { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the k m s import key default response +func (o *KMSImportKeyDefault) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *KMSImportKeyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(o._statusCode) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/restapi/operations/k_m_s/k_m_s_import_key_urlbuilder.go b/restapi/operations/k_m_s/k_m_s_import_key_urlbuilder.go new file mode 100644 index 000000000..13af93581 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_import_key_urlbuilder.go @@ -0,0 +1,116 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" + "strings" +) + +// KMSImportKeyURL generates an URL for the k m s import key operation +type KMSImportKeyURL struct { + Name string + + _basePath string + // avoid unkeyed usage + _ struct{} +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSImportKeyURL) WithBasePath(bp string) *KMSImportKeyURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSImportKeyURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *KMSImportKeyURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/kms/key/{name}/import" + + name := o.Name + if name != "" { + _path = strings.Replace(_path, "{name}", name, -1) + } else { + return nil, errors.New("name is required on KMSImportKeyURL") + } + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *KMSImportKeyURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *KMSImportKeyURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *KMSImportKeyURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on KMSImportKeyURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on KMSImportKeyURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *KMSImportKeyURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/restapi/operations/k_m_s/k_m_s_key_status.go b/restapi/operations/k_m_s/k_m_s_key_status.go new file mode 100644 index 000000000..d4e4e31cb --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_key_status.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// KMSKeyStatusHandlerFunc turns a function with the right signature into a k m s key status handler +type KMSKeyStatusHandlerFunc func(KMSKeyStatusParams, *models.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn KMSKeyStatusHandlerFunc) Handle(params KMSKeyStatusParams, principal *models.Principal) middleware.Responder { + return fn(params, principal) +} + +// KMSKeyStatusHandler interface for that can handle valid k m s key status params +type KMSKeyStatusHandler interface { + Handle(KMSKeyStatusParams, *models.Principal) middleware.Responder +} + +// NewKMSKeyStatus creates a new http.Handler for the k m s key status operation +func NewKMSKeyStatus(ctx *middleware.Context, handler KMSKeyStatusHandler) *KMSKeyStatus { + return &KMSKeyStatus{Context: ctx, Handler: handler} +} + +/* + KMSKeyStatus swagger:route GET /kms/key/{name} KMS kMSKeyStatus + +KMS key status +*/ +type KMSKeyStatus struct { + Context *middleware.Context + Handler KMSKeyStatusHandler +} + +func (o *KMSKeyStatus) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewKMSKeyStatusParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *models.Principal + if uprinc != nil { + principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/restapi/operations/k_m_s/k_m_s_key_status_parameters.go b/restapi/operations/k_m_s/k_m_s_key_status_parameters.go new file mode 100644 index 000000000..45e633167 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_key_status_parameters.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" +) + +// NewKMSKeyStatusParams creates a new KMSKeyStatusParams object +// +// There are no default values defined in the spec. +func NewKMSKeyStatusParams() KMSKeyStatusParams { + + return KMSKeyStatusParams{} +} + +// KMSKeyStatusParams contains all the bound params for the k m s key status operation +// typically these are obtained from a http.Request +// +// swagger:parameters KMSKeyStatus +type KMSKeyStatusParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /*KMS key name + Required: true + In: path + */ + Name string +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewKMSKeyStatusParams() beforehand. +func (o *KMSKeyStatusParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + rName, rhkName, _ := route.Params.GetOK("name") + if err := o.bindName(rName, rhkName, route.Formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindName binds and validates parameter Name from path. +func (o *KMSKeyStatusParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: true + // Parameter is provided by construction from the route + o.Name = raw + + return nil +} diff --git a/restapi/operations/k_m_s/k_m_s_key_status_responses.go b/restapi/operations/k_m_s/k_m_s_key_status_responses.go new file mode 100644 index 000000000..5324b475d --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_key_status_responses.go @@ -0,0 +1,133 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/minio/console/models" +) + +// KMSKeyStatusOKCode is the HTTP code returned for type KMSKeyStatusOK +const KMSKeyStatusOKCode int = 200 + +/* +KMSKeyStatusOK A successful response. + +swagger:response kMSKeyStatusOK +*/ +type KMSKeyStatusOK struct { + + /* + In: Body + */ + Payload models.KmsKeyStatusResponse `json:"body,omitempty"` +} + +// NewKMSKeyStatusOK creates KMSKeyStatusOK with default headers values +func NewKMSKeyStatusOK() *KMSKeyStatusOK { + + return &KMSKeyStatusOK{} +} + +// WithPayload adds the payload to the k m s key status o k response +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) { + o.Payload = payload +} + +// WriteResponse to the client +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 + } +} + +/* +KMSKeyStatusDefault Generic error response. + +swagger:response kMSKeyStatusDefault +*/ +type KMSKeyStatusDefault struct { + _statusCode int + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewKMSKeyStatusDefault creates KMSKeyStatusDefault with default headers values +func NewKMSKeyStatusDefault(code int) *KMSKeyStatusDefault { + if code <= 0 { + code = 500 + } + + return &KMSKeyStatusDefault{ + _statusCode: code, + } +} + +// WithStatusCode adds the status to the k m s key status default response +func (o *KMSKeyStatusDefault) WithStatusCode(code int) *KMSKeyStatusDefault { + o._statusCode = code + return o +} + +// SetStatusCode sets the status to the k m s key status default response +func (o *KMSKeyStatusDefault) SetStatusCode(code int) { + o._statusCode = code +} + +// WithPayload adds the payload to the k m s key status default response +func (o *KMSKeyStatusDefault) WithPayload(payload *models.Error) *KMSKeyStatusDefault { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the k m s key status default response +func (o *KMSKeyStatusDefault) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *KMSKeyStatusDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(o._statusCode) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/restapi/operations/k_m_s/k_m_s_key_status_urlbuilder.go b/restapi/operations/k_m_s/k_m_s_key_status_urlbuilder.go new file mode 100644 index 000000000..119835bee --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_key_status_urlbuilder.go @@ -0,0 +1,116 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" + "strings" +) + +// KMSKeyStatusURL generates an URL for the k m s key status operation +type KMSKeyStatusURL struct { + Name string + + _basePath string + // avoid unkeyed usage + _ struct{} +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSKeyStatusURL) WithBasePath(bp string) *KMSKeyStatusURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSKeyStatusURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *KMSKeyStatusURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/kms/key/{name}" + + name := o.Name + if name != "" { + _path = strings.Replace(_path, "{name}", name, -1) + } else { + return nil, errors.New("name is required on KMSKeyStatusURL") + } + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *KMSKeyStatusURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *KMSKeyStatusURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *KMSKeyStatusURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on KMSKeyStatusURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on KMSKeyStatusURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *KMSKeyStatusURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/restapi/operations/k_m_s/k_m_s_list_identities.go b/restapi/operations/k_m_s/k_m_s_list_identities.go new file mode 100644 index 000000000..a09a56476 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_list_identities.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// KMSListIdentitiesHandlerFunc turns a function with the right signature into a k m s list identities handler +type KMSListIdentitiesHandlerFunc func(KMSListIdentitiesParams, *models.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn KMSListIdentitiesHandlerFunc) Handle(params KMSListIdentitiesParams, principal *models.Principal) middleware.Responder { + return fn(params, principal) +} + +// KMSListIdentitiesHandler interface for that can handle valid k m s list identities params +type KMSListIdentitiesHandler interface { + Handle(KMSListIdentitiesParams, *models.Principal) middleware.Responder +} + +// NewKMSListIdentities creates a new http.Handler for the k m s list identities operation +func NewKMSListIdentities(ctx *middleware.Context, handler KMSListIdentitiesHandler) *KMSListIdentities { + return &KMSListIdentities{Context: ctx, Handler: handler} +} + +/* + KMSListIdentities swagger:route GET /kms/identity KMS kMSListIdentities + +KMS list identities +*/ +type KMSListIdentities struct { + Context *middleware.Context + Handler KMSListIdentitiesHandler +} + +func (o *KMSListIdentities) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewKMSListIdentitiesParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *models.Principal + if uprinc != nil { + principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/restapi/operations/k_m_s/k_m_s_list_identities_parameters.go b/restapi/operations/k_m_s/k_m_s_list_identities_parameters.go new file mode 100644 index 000000000..375839469 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_list_identities_parameters.go @@ -0,0 +1,94 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" +) + +// NewKMSListIdentitiesParams creates a new KMSListIdentitiesParams object +// +// There are no default values defined in the spec. +func NewKMSListIdentitiesParams() KMSListIdentitiesParams { + + return KMSListIdentitiesParams{} +} + +// KMSListIdentitiesParams contains all the bound params for the k m s list identities operation +// typically these are obtained from a http.Request +// +// swagger:parameters KMSListIdentities +type KMSListIdentitiesParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /*pattern to retrieve identities + In: query + */ + Pattern *string +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewKMSListIdentitiesParams() beforehand. +func (o *KMSListIdentitiesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + qs := runtime.Values(r.URL.Query()) + + qPattern, qhkPattern, _ := qs.GetOK("pattern") + if err := o.bindPattern(qPattern, qhkPattern, route.Formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindPattern binds and validates parameter Pattern from query. +func (o *KMSListIdentitiesParams) bindPattern(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + o.Pattern = &raw + + return nil +} diff --git a/restapi/operations/k_m_s/k_m_s_list_identities_responses.go b/restapi/operations/k_m_s/k_m_s_list_identities_responses.go new file mode 100644 index 000000000..6b80783e2 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_list_identities_responses.go @@ -0,0 +1,133 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/minio/console/models" +) + +// KMSListIdentitiesOKCode is the HTTP code returned for type KMSListIdentitiesOK +const KMSListIdentitiesOKCode int = 200 + +/* +KMSListIdentitiesOK A successful response. + +swagger:response kMSListIdentitiesOK +*/ +type KMSListIdentitiesOK struct { + + /* + In: Body + */ + Payload models.KmsListIdentitiesResponse `json:"body,omitempty"` +} + +// NewKMSListIdentitiesOK creates KMSListIdentitiesOK with default headers values +func NewKMSListIdentitiesOK() *KMSListIdentitiesOK { + + return &KMSListIdentitiesOK{} +} + +// WithPayload adds the payload to the k m s list identities o k response +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) { + o.Payload = payload +} + +// WriteResponse to the client +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 + } +} + +/* +KMSListIdentitiesDefault Generic error response. + +swagger:response kMSListIdentitiesDefault +*/ +type KMSListIdentitiesDefault struct { + _statusCode int + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewKMSListIdentitiesDefault creates KMSListIdentitiesDefault with default headers values +func NewKMSListIdentitiesDefault(code int) *KMSListIdentitiesDefault { + if code <= 0 { + code = 500 + } + + return &KMSListIdentitiesDefault{ + _statusCode: code, + } +} + +// WithStatusCode adds the status to the k m s list identities default response +func (o *KMSListIdentitiesDefault) WithStatusCode(code int) *KMSListIdentitiesDefault { + o._statusCode = code + return o +} + +// SetStatusCode sets the status to the k m s list identities default response +func (o *KMSListIdentitiesDefault) SetStatusCode(code int) { + o._statusCode = code +} + +// WithPayload adds the payload to the k m s list identities default response +func (o *KMSListIdentitiesDefault) WithPayload(payload *models.Error) *KMSListIdentitiesDefault { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the k m s list identities default response +func (o *KMSListIdentitiesDefault) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *KMSListIdentitiesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(o._statusCode) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/restapi/operations/k_m_s/k_m_s_list_identities_urlbuilder.go b/restapi/operations/k_m_s/k_m_s_list_identities_urlbuilder.go new file mode 100644 index 000000000..d82b3def3 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_list_identities_urlbuilder.go @@ -0,0 +1,120 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" +) + +// KMSListIdentitiesURL generates an URL for the k m s list identities operation +type KMSListIdentitiesURL struct { + Pattern *string + + _basePath string + // avoid unkeyed usage + _ struct{} +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSListIdentitiesURL) WithBasePath(bp string) *KMSListIdentitiesURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSListIdentitiesURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *KMSListIdentitiesURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/kms/identity" + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + qs := make(url.Values) + + var patternQ string + if o.Pattern != nil { + patternQ = *o.Pattern + } + if patternQ != "" { + qs.Set("pattern", patternQ) + } + + _result.RawQuery = qs.Encode() + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *KMSListIdentitiesURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *KMSListIdentitiesURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *KMSListIdentitiesURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on KMSListIdentitiesURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on KMSListIdentitiesURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *KMSListIdentitiesURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/restapi/operations/k_m_s/k_m_s_list_keys.go b/restapi/operations/k_m_s/k_m_s_list_keys.go new file mode 100644 index 000000000..369610dd9 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_list_keys.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// KMSListKeysHandlerFunc turns a function with the right signature into a k m s list keys handler +type KMSListKeysHandlerFunc func(KMSListKeysParams, *models.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn KMSListKeysHandlerFunc) Handle(params KMSListKeysParams, principal *models.Principal) middleware.Responder { + return fn(params, principal) +} + +// KMSListKeysHandler interface for that can handle valid k m s list keys params +type KMSListKeysHandler interface { + Handle(KMSListKeysParams, *models.Principal) middleware.Responder +} + +// NewKMSListKeys creates a new http.Handler for the k m s list keys operation +func NewKMSListKeys(ctx *middleware.Context, handler KMSListKeysHandler) *KMSListKeys { + return &KMSListKeys{Context: ctx, Handler: handler} +} + +/* + KMSListKeys swagger:route GET /kms/key KMS kMSListKeys + +KMS list keys +*/ +type KMSListKeys struct { + Context *middleware.Context + Handler KMSListKeysHandler +} + +func (o *KMSListKeys) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewKMSListKeysParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *models.Principal + if uprinc != nil { + principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/restapi/operations/k_m_s/k_m_s_list_keys_parameters.go b/restapi/operations/k_m_s/k_m_s_list_keys_parameters.go new file mode 100644 index 000000000..2486ec7c8 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_list_keys_parameters.go @@ -0,0 +1,99 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/errors" + "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 +// +// There are no default values defined in the spec. +func NewKMSListKeysParams() KMSListKeysParams { + + return KMSListKeysParams{} +} + +// KMSListKeysParams contains all the bound params for the k m s list keys operation +// typically these are obtained from a http.Request +// +// swagger:parameters KMSListKeys +type KMSListKeysParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /*pattern to retrieve keys + Required: true + In: query + */ + Pattern string +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewKMSListKeysParams() beforehand. +func (o *KMSListKeysParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + qs := runtime.Values(r.URL.Query()) + + qPattern, qhkPattern, _ := qs.GetOK("pattern") + if err := o.bindPattern(qPattern, qhkPattern, route.Formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// 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 + // AllowEmptyValue: false + + if err := validate.RequiredString("pattern", "query", raw); err != nil { + return err + } + o.Pattern = raw + + return nil +} diff --git a/restapi/operations/k_m_s/k_m_s_list_keys_responses.go b/restapi/operations/k_m_s/k_m_s_list_keys_responses.go new file mode 100644 index 000000000..0382e0097 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_list_keys_responses.go @@ -0,0 +1,133 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/minio/console/models" +) + +// KMSListKeysOKCode is the HTTP code returned for type KMSListKeysOK +const KMSListKeysOKCode int = 200 + +/* +KMSListKeysOK A successful response. + +swagger:response kMSListKeysOK +*/ +type KMSListKeysOK struct { + + /* + In: Body + */ + Payload models.KmsListKeysResponse `json:"body,omitempty"` +} + +// NewKMSListKeysOK creates KMSListKeysOK with default headers values +func NewKMSListKeysOK() *KMSListKeysOK { + + return &KMSListKeysOK{} +} + +// WithPayload adds the payload to the k m s list keys o k response +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) { + o.Payload = payload +} + +// WriteResponse to the client +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 + } +} + +/* +KMSListKeysDefault Generic error response. + +swagger:response kMSListKeysDefault +*/ +type KMSListKeysDefault struct { + _statusCode int + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewKMSListKeysDefault creates KMSListKeysDefault with default headers values +func NewKMSListKeysDefault(code int) *KMSListKeysDefault { + if code <= 0 { + code = 500 + } + + return &KMSListKeysDefault{ + _statusCode: code, + } +} + +// WithStatusCode adds the status to the k m s list keys default response +func (o *KMSListKeysDefault) WithStatusCode(code int) *KMSListKeysDefault { + o._statusCode = code + return o +} + +// SetStatusCode sets the status to the k m s list keys default response +func (o *KMSListKeysDefault) SetStatusCode(code int) { + o._statusCode = code +} + +// WithPayload adds the payload to the k m s list keys default response +func (o *KMSListKeysDefault) WithPayload(payload *models.Error) *KMSListKeysDefault { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the k m s list keys default response +func (o *KMSListKeysDefault) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *KMSListKeysDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(o._statusCode) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/restapi/operations/k_m_s/k_m_s_list_keys_urlbuilder.go b/restapi/operations/k_m_s/k_m_s_list_keys_urlbuilder.go new file mode 100644 index 000000000..882120f43 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_list_keys_urlbuilder.go @@ -0,0 +1,117 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" +) + +// KMSListKeysURL generates an URL for the k m s list keys operation +type KMSListKeysURL struct { + Pattern string + + _basePath string + // avoid unkeyed usage + _ struct{} +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSListKeysURL) WithBasePath(bp string) *KMSListKeysURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSListKeysURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *KMSListKeysURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/kms/key" + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + qs := make(url.Values) + + patternQ := o.Pattern + if patternQ != "" { + qs.Set("pattern", patternQ) + } + + _result.RawQuery = qs.Encode() + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *KMSListKeysURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *KMSListKeysURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *KMSListKeysURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on KMSListKeysURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on KMSListKeysURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *KMSListKeysURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/restapi/operations/k_m_s/k_m_s_list_policies.go b/restapi/operations/k_m_s/k_m_s_list_policies.go new file mode 100644 index 000000000..c782de765 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_list_policies.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// KMSListPoliciesHandlerFunc turns a function with the right signature into a k m s list policies handler +type KMSListPoliciesHandlerFunc func(KMSListPoliciesParams, *models.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn KMSListPoliciesHandlerFunc) Handle(params KMSListPoliciesParams, principal *models.Principal) middleware.Responder { + return fn(params, principal) +} + +// KMSListPoliciesHandler interface for that can handle valid k m s list policies params +type KMSListPoliciesHandler interface { + Handle(KMSListPoliciesParams, *models.Principal) middleware.Responder +} + +// NewKMSListPolicies creates a new http.Handler for the k m s list policies operation +func NewKMSListPolicies(ctx *middleware.Context, handler KMSListPoliciesHandler) *KMSListPolicies { + return &KMSListPolicies{Context: ctx, Handler: handler} +} + +/* + KMSListPolicies swagger:route GET /kms/policy KMS kMSListPolicies + +KMS list policies +*/ +type KMSListPolicies struct { + Context *middleware.Context + Handler KMSListPoliciesHandler +} + +func (o *KMSListPolicies) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewKMSListPoliciesParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *models.Principal + if uprinc != nil { + principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/restapi/operations/k_m_s/k_m_s_list_policies_parameters.go b/restapi/operations/k_m_s/k_m_s_list_policies_parameters.go new file mode 100644 index 000000000..4d7cf276f --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_list_policies_parameters.go @@ -0,0 +1,94 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" +) + +// NewKMSListPoliciesParams creates a new KMSListPoliciesParams object +// +// There are no default values defined in the spec. +func NewKMSListPoliciesParams() KMSListPoliciesParams { + + return KMSListPoliciesParams{} +} + +// KMSListPoliciesParams contains all the bound params for the k m s list policies operation +// typically these are obtained from a http.Request +// +// swagger:parameters KMSListPolicies +type KMSListPoliciesParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /*pattern to retrieve policies + In: query + */ + Pattern *string +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewKMSListPoliciesParams() beforehand. +func (o *KMSListPoliciesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + qs := runtime.Values(r.URL.Query()) + + qPattern, qhkPattern, _ := qs.GetOK("pattern") + if err := o.bindPattern(qPattern, qhkPattern, route.Formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindPattern binds and validates parameter Pattern from query. +func (o *KMSListPoliciesParams) bindPattern(rawData []string, hasKey bool, formats strfmt.Registry) error { + var raw string + if len(rawData) > 0 { + raw = rawData[len(rawData)-1] + } + + // Required: false + // AllowEmptyValue: false + + if raw == "" { // empty values pass all other validations + return nil + } + o.Pattern = &raw + + return nil +} diff --git a/restapi/operations/k_m_s/k_m_s_list_policies_responses.go b/restapi/operations/k_m_s/k_m_s_list_policies_responses.go new file mode 100644 index 000000000..f568af296 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_list_policies_responses.go @@ -0,0 +1,133 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/minio/console/models" +) + +// KMSListPoliciesOKCode is the HTTP code returned for type KMSListPoliciesOK +const KMSListPoliciesOKCode int = 200 + +/* +KMSListPoliciesOK A successful response. + +swagger:response kMSListPoliciesOK +*/ +type KMSListPoliciesOK struct { + + /* + In: Body + */ + Payload models.KmsListPoliciesResponse `json:"body,omitempty"` +} + +// NewKMSListPoliciesOK creates KMSListPoliciesOK with default headers values +func NewKMSListPoliciesOK() *KMSListPoliciesOK { + + return &KMSListPoliciesOK{} +} + +// WithPayload adds the payload to the k m s list policies o k response +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) { + o.Payload = payload +} + +// WriteResponse to the client +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 + } +} + +/* +KMSListPoliciesDefault Generic error response. + +swagger:response kMSListPoliciesDefault +*/ +type KMSListPoliciesDefault struct { + _statusCode int + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewKMSListPoliciesDefault creates KMSListPoliciesDefault with default headers values +func NewKMSListPoliciesDefault(code int) *KMSListPoliciesDefault { + if code <= 0 { + code = 500 + } + + return &KMSListPoliciesDefault{ + _statusCode: code, + } +} + +// WithStatusCode adds the status to the k m s list policies default response +func (o *KMSListPoliciesDefault) WithStatusCode(code int) *KMSListPoliciesDefault { + o._statusCode = code + return o +} + +// SetStatusCode sets the status to the k m s list policies default response +func (o *KMSListPoliciesDefault) SetStatusCode(code int) { + o._statusCode = code +} + +// WithPayload adds the payload to the k m s list policies default response +func (o *KMSListPoliciesDefault) WithPayload(payload *models.Error) *KMSListPoliciesDefault { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the k m s list policies default response +func (o *KMSListPoliciesDefault) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *KMSListPoliciesDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(o._statusCode) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/restapi/operations/k_m_s/k_m_s_list_policies_urlbuilder.go b/restapi/operations/k_m_s/k_m_s_list_policies_urlbuilder.go new file mode 100644 index 000000000..370e790e8 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_list_policies_urlbuilder.go @@ -0,0 +1,120 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" +) + +// KMSListPoliciesURL generates an URL for the k m s list policies operation +type KMSListPoliciesURL struct { + Pattern *string + + _basePath string + // avoid unkeyed usage + _ struct{} +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSListPoliciesURL) WithBasePath(bp string) *KMSListPoliciesURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSListPoliciesURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *KMSListPoliciesURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/kms/policy" + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + qs := make(url.Values) + + var patternQ string + if o.Pattern != nil { + patternQ = *o.Pattern + } + if patternQ != "" { + qs.Set("pattern", patternQ) + } + + _result.RawQuery = qs.Encode() + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *KMSListPoliciesURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *KMSListPoliciesURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *KMSListPoliciesURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on KMSListPoliciesURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on KMSListPoliciesURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *KMSListPoliciesURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/restapi/operations/k_m_s/k_m_s_set_policy.go b/restapi/operations/k_m_s/k_m_s_set_policy.go new file mode 100644 index 000000000..da6837226 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_set_policy.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// KMSSetPolicyHandlerFunc turns a function with the right signature into a k m s set policy handler +type KMSSetPolicyHandlerFunc func(KMSSetPolicyParams, *models.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn KMSSetPolicyHandlerFunc) Handle(params KMSSetPolicyParams, principal *models.Principal) middleware.Responder { + return fn(params, principal) +} + +// KMSSetPolicyHandler interface for that can handle valid k m s set policy params +type KMSSetPolicyHandler interface { + Handle(KMSSetPolicyParams, *models.Principal) middleware.Responder +} + +// NewKMSSetPolicy creates a new http.Handler for the k m s set policy operation +func NewKMSSetPolicy(ctx *middleware.Context, handler KMSSetPolicyHandler) *KMSSetPolicy { + return &KMSSetPolicy{Context: ctx, Handler: handler} +} + +/* + KMSSetPolicy swagger:route POST /kms/policy KMS kMSSetPolicy + +KMS set policy +*/ +type KMSSetPolicy struct { + Context *middleware.Context + Handler KMSSetPolicyHandler +} + +func (o *KMSSetPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewKMSSetPolicyParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *models.Principal + if uprinc != nil { + principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/restapi/operations/k_m_s/k_m_s_set_policy_parameters.go b/restapi/operations/k_m_s/k_m_s_set_policy_parameters.go new file mode 100644 index 000000000..c19d14fa3 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_set_policy_parameters.go @@ -0,0 +1,89 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "io" + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// NewKMSSetPolicyParams creates a new KMSSetPolicyParams object +// +// There are no default values defined in the spec. +func NewKMSSetPolicyParams() KMSSetPolicyParams { + + return KMSSetPolicyParams{} +} + +// KMSSetPolicyParams contains all the bound params for the k m s set policy operation +// typically these are obtained from a http.Request +// +// swagger:parameters KMSSetPolicy +type KMSSetPolicyParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` + + /* + Required: true + In: body + */ + Body models.KmsSetPolicyRequest +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewKMSSetPolicyParams() beforehand. +func (o *KMSSetPolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + if runtime.HasBody(r) { + defer r.Body.Close() + var body models.KmsSetPolicyRequest + if err := route.Consumer.Consume(r.Body, &body); err != nil { + if err == io.EOF { + res = append(res, errors.Required("body", "body", "")) + } else { + res = append(res, errors.NewParseError("body", "body", "", err)) + } + } else { + // no validation on generic interface + o.Body = body + } + } else { + res = append(res, errors.Required("body", "body", "")) + } + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/restapi/operations/k_m_s/k_m_s_set_policy_responses.go b/restapi/operations/k_m_s/k_m_s_set_policy_responses.go new file mode 100644 index 000000000..5e356a0fd --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_set_policy_responses.go @@ -0,0 +1,115 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/minio/console/models" +) + +// KMSSetPolicyOKCode is the HTTP code returned for type KMSSetPolicyOK +const KMSSetPolicyOKCode int = 200 + +/* +KMSSetPolicyOK A successful response. + +swagger:response kMSSetPolicyOK +*/ +type KMSSetPolicyOK struct { +} + +// NewKMSSetPolicyOK creates KMSSetPolicyOK with default headers values +func NewKMSSetPolicyOK() *KMSSetPolicyOK { + + return &KMSSetPolicyOK{} +} + +// WriteResponse to the client +func (o *KMSSetPolicyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses + + rw.WriteHeader(200) +} + +/* +KMSSetPolicyDefault Generic error response. + +swagger:response kMSSetPolicyDefault +*/ +type KMSSetPolicyDefault struct { + _statusCode int + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewKMSSetPolicyDefault creates KMSSetPolicyDefault with default headers values +func NewKMSSetPolicyDefault(code int) *KMSSetPolicyDefault { + if code <= 0 { + code = 500 + } + + return &KMSSetPolicyDefault{ + _statusCode: code, + } +} + +// WithStatusCode adds the status to the k m s set policy default response +func (o *KMSSetPolicyDefault) WithStatusCode(code int) *KMSSetPolicyDefault { + o._statusCode = code + return o +} + +// SetStatusCode sets the status to the k m s set policy default response +func (o *KMSSetPolicyDefault) SetStatusCode(code int) { + o._statusCode = code +} + +// WithPayload adds the payload to the k m s set policy default response +func (o *KMSSetPolicyDefault) WithPayload(payload *models.Error) *KMSSetPolicyDefault { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the k m s set policy default response +func (o *KMSSetPolicyDefault) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *KMSSetPolicyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(o._statusCode) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/restapi/operations/k_m_s/k_m_s_set_policy_urlbuilder.go b/restapi/operations/k_m_s/k_m_s_set_policy_urlbuilder.go new file mode 100644 index 000000000..ced62db3c --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_set_policy_urlbuilder.go @@ -0,0 +1,104 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" +) + +// KMSSetPolicyURL generates an URL for the k m s set policy operation +type KMSSetPolicyURL struct { + _basePath string +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSSetPolicyURL) WithBasePath(bp string) *KMSSetPolicyURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSSetPolicyURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *KMSSetPolicyURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/kms/policy" + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *KMSSetPolicyURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *KMSSetPolicyURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *KMSSetPolicyURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on KMSSetPolicyURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on KMSSetPolicyURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *KMSSetPolicyURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/restapi/operations/k_m_s/k_m_s_status.go b/restapi/operations/k_m_s/k_m_s_status.go new file mode 100644 index 000000000..c9b129ebd --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_status.go @@ -0,0 +1,88 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime/middleware" + + "github.com/minio/console/models" +) + +// KMSStatusHandlerFunc turns a function with the right signature into a k m s status handler +type KMSStatusHandlerFunc func(KMSStatusParams, *models.Principal) middleware.Responder + +// Handle executing the request and returning a response +func (fn KMSStatusHandlerFunc) Handle(params KMSStatusParams, principal *models.Principal) middleware.Responder { + return fn(params, principal) +} + +// KMSStatusHandler interface for that can handle valid k m s status params +type KMSStatusHandler interface { + Handle(KMSStatusParams, *models.Principal) middleware.Responder +} + +// NewKMSStatus creates a new http.Handler for the k m s status operation +func NewKMSStatus(ctx *middleware.Context, handler KMSStatusHandler) *KMSStatus { + return &KMSStatus{Context: ctx, Handler: handler} +} + +/* + KMSStatus swagger:route GET /kms/status KMS kMSStatus + +KMS status +*/ +type KMSStatus struct { + Context *middleware.Context + Handler KMSStatusHandler +} + +func (o *KMSStatus) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := o.Context.RouteInfo(r) + if rCtx != nil { + *r = *rCtx + } + var Params = NewKMSStatusParams() + uprinc, aCtx, err := o.Context.Authorize(r, route) + if err != nil { + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + if aCtx != nil { + *r = *aCtx + } + var principal *models.Principal + if uprinc != nil { + principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise + } + + if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params + o.Context.Respond(rw, r, route.Produces, route, err) + return + } + + res := o.Handler.Handle(Params, principal) // actually handle the request + o.Context.Respond(rw, r, route.Produces, route, res) + +} diff --git a/restapi/operations/k_m_s/k_m_s_status_parameters.go b/restapi/operations/k_m_s/k_m_s_status_parameters.go new file mode 100644 index 000000000..62f65cc6a --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_status_parameters.go @@ -0,0 +1,63 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime/middleware" +) + +// NewKMSStatusParams creates a new KMSStatusParams object +// +// There are no default values defined in the spec. +func NewKMSStatusParams() KMSStatusParams { + + return KMSStatusParams{} +} + +// KMSStatusParams contains all the bound params for the k m s status operation +// typically these are obtained from a http.Request +// +// swagger:parameters KMSStatus +type KMSStatusParams struct { + + // HTTP Request Object + HTTPRequest *http.Request `json:"-"` +} + +// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface +// for simple values it will use straight method calls. +// +// To ensure default values, the struct must have been initialized with NewKMSStatusParams() beforehand. +func (o *KMSStatusParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { + var res []error + + o.HTTPRequest = r + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/restapi/operations/k_m_s/k_m_s_status_responses.go b/restapi/operations/k_m_s/k_m_s_status_responses.go new file mode 100644 index 000000000..6be3aed74 --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_status_responses.go @@ -0,0 +1,133 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "net/http" + + "github.com/go-openapi/runtime" + + "github.com/minio/console/models" +) + +// KMSStatusOKCode is the HTTP code returned for type KMSStatusOK +const KMSStatusOKCode int = 200 + +/* +KMSStatusOK A successful response. + +swagger:response kMSStatusOK +*/ +type KMSStatusOK struct { + + /* + In: Body + */ + Payload models.KmsStatusResponse `json:"body,omitempty"` +} + +// NewKMSStatusOK creates KMSStatusOK with default headers values +func NewKMSStatusOK() *KMSStatusOK { + + return &KMSStatusOK{} +} + +// WithPayload adds the payload to the k m s status o k response +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) { + o.Payload = payload +} + +// WriteResponse to the client +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 + } +} + +/* +KMSStatusDefault Generic error response. + +swagger:response kMSStatusDefault +*/ +type KMSStatusDefault struct { + _statusCode int + + /* + In: Body + */ + Payload *models.Error `json:"body,omitempty"` +} + +// NewKMSStatusDefault creates KMSStatusDefault with default headers values +func NewKMSStatusDefault(code int) *KMSStatusDefault { + if code <= 0 { + code = 500 + } + + return &KMSStatusDefault{ + _statusCode: code, + } +} + +// WithStatusCode adds the status to the k m s status default response +func (o *KMSStatusDefault) WithStatusCode(code int) *KMSStatusDefault { + o._statusCode = code + return o +} + +// SetStatusCode sets the status to the k m s status default response +func (o *KMSStatusDefault) SetStatusCode(code int) { + o._statusCode = code +} + +// WithPayload adds the payload to the k m s status default response +func (o *KMSStatusDefault) WithPayload(payload *models.Error) *KMSStatusDefault { + o.Payload = payload + return o +} + +// SetPayload sets the payload to the k m s status default response +func (o *KMSStatusDefault) SetPayload(payload *models.Error) { + o.Payload = payload +} + +// WriteResponse to the client +func (o *KMSStatusDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + + rw.WriteHeader(o._statusCode) + if o.Payload != nil { + payload := o.Payload + if err := producer.Produce(rw, payload); err != nil { + panic(err) // let the recovery middleware deal with this + } + } +} diff --git a/restapi/operations/k_m_s/k_m_s_status_urlbuilder.go b/restapi/operations/k_m_s/k_m_s_status_urlbuilder.go new file mode 100644 index 000000000..f80a523ff --- /dev/null +++ b/restapi/operations/k_m_s/k_m_s_status_urlbuilder.go @@ -0,0 +1,104 @@ +// 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 . +// + +package k_m_s + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the generate command + +import ( + "errors" + "net/url" + golangswaggerpaths "path" +) + +// KMSStatusURL generates an URL for the k m s status operation +type KMSStatusURL struct { + _basePath string +} + +// WithBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSStatusURL) WithBasePath(bp string) *KMSStatusURL { + o.SetBasePath(bp) + return o +} + +// SetBasePath sets the base path for this url builder, only required when it's different from the +// base path specified in the swagger spec. +// When the value of the base path is an empty string +func (o *KMSStatusURL) SetBasePath(bp string) { + o._basePath = bp +} + +// Build a url path and query string +func (o *KMSStatusURL) Build() (*url.URL, error) { + var _result url.URL + + var _path = "/kms/status" + + _basePath := o._basePath + if _basePath == "" { + _basePath = "/api/v1" + } + _result.Path = golangswaggerpaths.Join(_basePath, _path) + + return &_result, nil +} + +// Must is a helper function to panic when the url builder returns an error +func (o *KMSStatusURL) Must(u *url.URL, err error) *url.URL { + if err != nil { + panic(err) + } + if u == nil { + panic("url can't be nil") + } + return u +} + +// String returns the string representation of the path with query string +func (o *KMSStatusURL) String() string { + return o.Must(o.Build()).String() +} + +// BuildFull builds a full url with scheme, host, path and query string +func (o *KMSStatusURL) BuildFull(scheme, host string) (*url.URL, error) { + if scheme == "" { + return nil, errors.New("scheme is required for a full url on KMSStatusURL") + } + if host == "" { + return nil, errors.New("host is required for a full url on KMSStatusURL") + } + + base, err := o.Build() + if err != nil { + return nil, err + } + + base.Scheme = scheme + base.Host = host + return base, nil +} + +// StringFull returns the string representation of a complete url +func (o *KMSStatusURL) StringFull(scheme, host string) string { + return o.Must(o.BuildFull(scheme, host)).String() +} diff --git a/swagger-console.yml b/swagger-console.yml index 2c40f85e2..169823417 100644 --- a/swagger-console.yml +++ b/swagger-console.yml @@ -2869,6 +2869,321 @@ paths: tags: - Logging + /kms/status: + get: + summary: KMS status + operationId: KMSStatus + responses: + 200: + description: A successful response. + schema: + $ref: "#/definitions/kmsStatusResponse" + default: + description: Generic error response. + schema: + $ref: "#/definitions/error" + tags: + - KMS + /kms/key: + post: + summary: KMS create key + operationId: KMSCreateKey + parameters: + - name: body + in: body + required: true + schema: + $ref: "#/definitions/kmsCreateKeyRequest" + responses: + 201: + description: A successful response. + default: + description: Generic error response. + schema: + $ref: "#/definitions/error" + tags: + - KMS + get: + summary: KMS list keys + operationId: KMSListKeys + parameters: + - name: pattern + description: pattern to retrieve keys + in: query + required: true + type: string + responses: + 200: + description: A successful response. + schema: + $ref: "#/definitions/kmsListKeysResponse" + default: + description: Generic error response. + schema: + $ref: "#/definitions/error" + tags: + - KMS + /kms/key/{name}: + get: + summary: KMS key status + operationId: KMSKeyStatus + parameters: + - name: name + description: KMS key name + in: path + required: true + type: string + responses: + 200: + description: A successful response. + schema: + $ref: "#/definitions/kmsKeyStatusResponse" + default: + description: Generic error response. + schema: + $ref: "#/definitions/error" + tags: + - KMS + delete: + summary: KMS delete key + operationId: KMSDeleteKey + parameters: + - name: name + description: KMS key name + in: path + required: true + type: string + responses: + 200: + description: A successful response. + default: + description: Generic error response. + schema: + $ref: "#/definitions/error" + tags: + - KMS + /kms/key/{name}/import: + post: + summary: KMS import key + operationId: KMSImportKey + parameters: + - name: body + in: body + required: true + schema: + $ref: "#/definitions/kmsImportKeyRequest" + - name: name + description: KMS key name + in: path + required: true + type: string + responses: + 201: + description: A successful response. + default: + description: Generic error response. + schema: + $ref: "#/definitions/error" + tags: + - KMS + /kms/policy: + post: + summary: KMS set policy + operationId: KMSSetPolicy + parameters: + - name: body + in: body + required: true + schema: + $ref: "#/definitions/kmsSetPolicyRequest" + responses: + 200: + description: A successful response. + default: + description: Generic error response. + schema: + $ref: "#/definitions/error" + tags: + - KMS + get: + summary: KMS list policies + operationId: KMSListPolicies + parameters: + - name: pattern + description: pattern to retrieve policies + in: query + type: string + responses: + 200: + description: A successful response. + schema: + $ref: "#/definitions/kmsListPoliciesResponse" + default: + description: Generic error response. + schema: + $ref: "#/definitions/error" + tags: + - KMS + /kms/policy/{name}: + get: + summary: KMS get policy + operationId: KMSGetPolicy + parameters: + - name: name + description: KMS policy name + in: path + required: true + type: string + responses: + 200: + description: A successful response. + schema: + $ref: "#/definitions/kmsGetPolicyResponse" + default: + description: Generic error response. + schema: + $ref: "#/definitions/error" + tags: + - KMS + delete: + summary: KMS delete policy + operationId: KMSDeletePolicy + parameters: + - name: name + description: KMS policy name + in: path + required: true + type: string + responses: + 200: + description: A successful response. + default: + description: Generic error response. + schema: + $ref: "#/definitions/error" + tags: + - KMS + /kms/policy/{name}/assign: + post: + summary: KMS assign policy + operationId: KMSAssignPolicy + parameters: + - name: body + in: body + required: true + schema: + $ref: "#/definitions/kmsAssignPolicyRequest" + - name: name + description: KMS policy name + in: path + required: true + type: string + responses: + 200: + description: A successful response. + default: + description: Generic error response. + schema: + $ref: "#/definitions/error" + tags: + - KMS + /kms/policy/{name}/describe: + get: + summary: KMS describe policy + operationId: KMSDescribePolicy + parameters: + - name: name + description: KMS policy name + in: path + required: true + type: string + responses: + 200: + description: A successful response. + schema: + $ref: "#/definitions/kmsDescribePolicyResponse" + default: + description: Generic error response. + schema: + $ref: "#/definitions/error" + tags: + - KMS + /kms/identity/{name}: + delete: + summary: KMS delete identity + operationId: KMSDeleteIdentity + parameters: + - name: name + description: KMS identity name + in: path + required: true + type: string + responses: + 200: + description: A successful response. + default: + description: Generic error response. + schema: + $ref: "#/definitions/error" + tags: + - KMS + /kms/identity/{name}/describe: + get: + summary: KMS describe identity + operationId: KMSDescribeIdentity + parameters: + - name: name + description: KMS identity name + in: path + required: true + type: string + responses: + 200: + description: A successful response. + schema: + $ref: "#/definitions/kmsDescribeIdentityResponse" + default: + description: Generic error response. + schema: + $ref: "#/definitions/error" + tags: + - KMS + /kms/describe-self/identity: + get: + summary: KMS describe self identity + operationId: KMSDescribeSelfIdentity + responses: + 200: + description: A successful response. + schema: + $ref: "#/definitions/kmsDescribeSelfIdentityResponse" + default: + description: Generic error response. + schema: + $ref: "#/definitions/error" + tags: + - KMS + /kms/identity: + get: + summary: KMS list identities + operationId: KMSListIdentities + parameters: + - name: pattern + description: pattern to retrieve identities + in: query + type: string + responses: + 200: + description: A successful response. + schema: + $ref: "#/definitions/kmsListIdentitiesResponse" + default: + description: Generic error response. + schema: + $ref: "#/definitions/error" + tags: + - KMS + /admin/inspect: get: summary: Inspect Files on Drive @@ -4948,3 +5263,51 @@ definitions: properties: policy: type: string + + kmsStatusRequest: + type: object + kmsStatusResponse: + type: object + + kmsKeyStatusRequest: + type: object + kmsKeyStatusResponse: + type: object + kmsCreateKeyRequest: + type: object + kmsImportKeyRequest: + type: object + kmDeleteKeyRequest: + type: object + kmListKeysRequest: + type: object + kmsListKeysResponse: + type: object + + kmsGetPolicyRequest: + type: object + kmsGetPolicyResponse: + type: object + kmsSetPolicyRequest: + type: object + kmsDescribePolicyRequest: + type: object + kmsDescribePolicyResponse: + type: object + kmsAssignPolicyRequest: + type: object + kmsListPoliciesRequest: + type: object + kmsListPoliciesResponse: + type: object + + kmsDescribeIdentityRequest: + type: object + kmsDescribeIdentityResponse: + type: object + kmsDescribeSelfIdentityRequest: + type: object + kmsDescribeSelfIdentityResponse: + type: object + kmsListIdentitiesResponse: + type: object