diff --git a/api/admin_client_mock.go b/api/admin_client_mock.go index 0036b7a63..e800c28db 100644 --- a/api/admin_client_mock.go +++ b/api/admin_client_mock.go @@ -216,10 +216,6 @@ func (ac AdminClientMock) createKey(_ context.Context, _ string) error { return nil } -func (ac AdminClientMock) importKey(_ context.Context, _ string, _ []byte) error { - return nil -} - func (ac AdminClientMock) listKeys(_ context.Context, _ string) ([]madmin.KMSKeyInfo, error) { return []madmin.KMSKeyInfo{{ Name: "name", @@ -231,55 +227,6 @@ func (ac AdminClientMock) keyStatus(_ context.Context, _ string) (*madmin.KMSKey return &madmin.KMSKeyStatus{KeyID: "key"}, nil } -func (ac AdminClientMock) deleteKey(_ context.Context, _ string) error { - return nil -} - -func (ac AdminClientMock) setKMSPolicy(_ context.Context, _ string, _ []byte) error { - return nil -} - -func (ac AdminClientMock) assignPolicy(_ context.Context, _ string, _ []byte) error { - return nil -} - -func (ac AdminClientMock) describePolicy(_ context.Context, _ string) (*madmin.KMSDescribePolicy, error) { - return &madmin.KMSDescribePolicy{Name: "name"}, nil -} - -func (ac AdminClientMock) getKMSPolicy(_ context.Context, _ string) (*madmin.KMSPolicy, error) { - return &madmin.KMSPolicy{Allow: []string{""}, Deny: []string{""}}, nil -} - -func (ac AdminClientMock) listKMSPolicies(_ context.Context, _ string) ([]madmin.KMSPolicyInfo, error) { - return []madmin.KMSPolicyInfo{{ - Name: "name", - CreatedBy: "by", - }}, nil -} - -func (ac AdminClientMock) deletePolicy(_ context.Context, _ string) error { - return nil -} - -func (ac AdminClientMock) describeIdentity(_ context.Context, _ string) (*madmin.KMSDescribeIdentity, error) { - return &madmin.KMSDescribeIdentity{}, nil -} - -func (ac AdminClientMock) describeSelfIdentity(_ context.Context) (*madmin.KMSDescribeSelfIdentity, error) { - return &madmin.KMSDescribeSelfIdentity{ - Policy: &madmin.KMSPolicy{Allow: []string{}, Deny: []string{}}, - }, nil -} - -func (ac AdminClientMock) deleteIdentity(_ context.Context, _ string) error { - return nil -} - -func (ac AdminClientMock) listIdentities(_ context.Context, _ string) ([]madmin.KMSIdentityInfo, error) { - return []madmin.KMSIdentityInfo{{Identity: "identity"}}, nil -} - func (ac AdminClientMock) listPolicies(_ context.Context) (map[string]*iampolicy.Policy, error) { return minioListPoliciesMock() } diff --git a/api/admin_kms.go b/api/admin_kms.go index d2ba16d76..07742d4e6 100644 --- a/api/admin_kms.go +++ b/api/admin_kms.go @@ -19,7 +19,6 @@ package api import ( "context" - "encoding/json" "sort" "github.com/go-openapi/runtime/middleware" @@ -32,8 +31,6 @@ import ( func registerKMSHandlers(api *operations.ConsoleAPI) { registerKMSStatusHandlers(api) registerKMSKeyHandlers(api) - registerKMSPolicyHandlers(api) - registerKMSIdentityHandlers(api) } func registerKMSStatusHandlers(api *operations.ConsoleAPI) { @@ -204,14 +201,6 @@ func registerKMSKeyHandlers(api *operations.ConsoleAPI) { 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(err.Code).WithPayload(err.APIError) - } - return kmsAPI.NewKMSImportKeyCreated() - }) - api.KmsKMSListKeysHandler = kmsAPI.KMSListKeysHandlerFunc(func(params kmsAPI.KMSListKeysParams, session *models.Principal) middleware.Responder { resp, err := GetKMSListKeysResponse(session, params) if err != nil { @@ -227,14 +216,6 @@ func registerKMSKeyHandlers(api *operations.ConsoleAPI) { } 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(err.Code).WithPayload(err.APIError) - } - return kmsAPI.NewKMSDeleteKeyOK() - }) } func GetKMSCreateKeyResponse(session *models.Principal, params kmsAPI.KMSCreateKeyParams) *CodedAPIError { @@ -254,27 +235,6 @@ func createKey(ctx context.Context, key string, minioClient MinioAdmin) *CodedAP return nil } -func GetKMSImportKeyResponse(session *models.Principal, params kmsAPI.KMSImportKeyParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - bytes, err := json.Marshal(params.Body) - if err != nil { - return ErrorWithContext(ctx, err) - } - return importKey(ctx, params.Name, bytes, AdminClient{Client: mAdmin}) -} - -func importKey(ctx context.Context, key string, bytes []byte, minioClient MinioAdmin) *CodedAPIError { - if err := minioClient.importKey(ctx, key, bytes); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - func GetKMSListKeysResponse(session *models.Principal, params kmsAPI.KMSListKeysParams) (*models.KmsListKeysResponse, *CodedAPIError) { ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) defer cancel() @@ -329,341 +289,3 @@ func keyStatus(ctx context.Context, key string, minioClient MinioAdmin) (*models DecryptionErr: ks.DecryptionErr, }, nil } - -func GetKMSDeleteKeyResponse(session *models.Principal, params kmsAPI.KMSDeleteKeyParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - return deleteKey(ctx, params.Name, AdminClient{Client: mAdmin}) -} - -func deleteKey(ctx context.Context, key string, minioClient MinioAdmin) *CodedAPIError { - if err := minioClient.deleteKey(ctx, key); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -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(err.Code).WithPayload(err.APIError) - } - 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(err.Code).WithPayload(err.APIError) - } - 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(err.Code).WithPayload(err.APIError) - } - 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(err.Code).WithPayload(err.APIError) - } - 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(err.Code).WithPayload(err.APIError) - } - 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(err.Code).WithPayload(err.APIError) - } - return kmsAPI.NewKMSDeletePolicyOK() - }) -} - -func GetKMSSetPolicyResponse(session *models.Principal, params kmsAPI.KMSSetPolicyParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - bytes, err := json.Marshal(params.Body) - if err != nil { - return ErrorWithContext(ctx, err) - } - return setPolicy(ctx, *params.Body.Policy, bytes, AdminClient{Client: mAdmin}) -} - -func setPolicy(ctx context.Context, policy string, content []byte, minioClient MinioAdmin) *CodedAPIError { - if err := minioClient.setKMSPolicy(ctx, policy, content); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -func GetKMSAssignPolicyResponse(session *models.Principal, params kmsAPI.KMSAssignPolicyParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - bytes, err := json.Marshal(params.Body) - if err != nil { - return ErrorWithContext(ctx, err) - } - return assignPolicy(ctx, params.Name, bytes, AdminClient{Client: mAdmin}) -} - -func assignPolicy(ctx context.Context, policy string, content []byte, minioClient MinioAdmin) *CodedAPIError { - if err := minioClient.assignPolicy(ctx, policy, content); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -func GetKMSDescribePolicyResponse(session *models.Principal, params kmsAPI.KMSDescribePolicyParams) (*models.KmsDescribePolicyResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return describePolicy(ctx, params.Name, AdminClient{Client: mAdmin}) -} - -func describePolicy(ctx context.Context, policy string, minioClient MinioAdmin) (*models.KmsDescribePolicyResponse, *CodedAPIError) { - dp, err := minioClient.describePolicy(ctx, policy) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.KmsDescribePolicyResponse{ - Name: dp.Name, - CreatedAt: dp.CreatedAt, - CreatedBy: dp.CreatedBy, - }, nil -} - -func GetKMSGetPolicyResponse(session *models.Principal, params kmsAPI.KMSGetPolicyParams) (*models.KmsGetPolicyResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return getPolicy(ctx, params.Name, AdminClient{Client: mAdmin}) -} - -func getPolicy(ctx context.Context, policy string, minioClient MinioAdmin) (*models.KmsGetPolicyResponse, *CodedAPIError) { - p, err := minioClient.getKMSPolicy(ctx, policy) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.KmsGetPolicyResponse{ - Allow: p.Allow, - Deny: p.Deny, - }, nil -} - -func GetKMSListPoliciesResponse(session *models.Principal, params kmsAPI.KMSListPoliciesParams) (*models.KmsListPoliciesResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - pattern := "" - if params.Pattern != nil { - pattern = *params.Pattern - } - return listKMSPolicies(ctx, pattern, AdminClient{Client: mAdmin}) -} - -func listKMSPolicies(ctx context.Context, pattern string, minioClient MinioAdmin) (*models.KmsListPoliciesResponse, *CodedAPIError) { - results, err := minioClient.listKMSPolicies(ctx, pattern) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.KmsListPoliciesResponse{Results: parsePolicies(results)}, nil -} - -func parsePolicies(results []madmin.KMSPolicyInfo) (data []*models.KmsPolicyInfo) { - for _, policy := range results { - data = append(data, &models.KmsPolicyInfo{ - CreatedAt: policy.CreatedAt, - CreatedBy: policy.CreatedBy, - Name: policy.Name, - }) - } - return data -} - -func GetKMSDeletePolicyResponse(session *models.Principal, params kmsAPI.KMSDeletePolicyParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - return deletePolicy(ctx, params.Name, AdminClient{Client: mAdmin}) -} - -func deletePolicy(ctx context.Context, policy string, minioClient MinioAdmin) *CodedAPIError { - if err := minioClient.deletePolicy(ctx, policy); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} - -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(err.Code).WithPayload(err.APIError) - } - 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(err.Code).WithPayload(err.APIError) - } - 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(err.Code).WithPayload(err.APIError) - } - 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(err.Code).WithPayload(err.APIError) - } - return kmsAPI.NewKMSDeleteIdentityOK() - }) -} - -func GetKMSDescribeIdentityResponse(session *models.Principal, params kmsAPI.KMSDescribeIdentityParams) (*models.KmsDescribeIdentityResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return describeIdentity(ctx, params.Name, AdminClient{Client: mAdmin}) -} - -func describeIdentity(ctx context.Context, identity string, minioClient MinioAdmin) (*models.KmsDescribeIdentityResponse, *CodedAPIError) { - i, err := minioClient.describeIdentity(ctx, identity) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.KmsDescribeIdentityResponse{ - Policy: i.Policy, - Admin: i.IsAdmin, - Identity: i.Identity, - CreatedAt: i.CreatedAt, - CreatedBy: i.CreatedBy, - }, nil -} - -func GetKMSDescribeSelfIdentityResponse(session *models.Principal, params kmsAPI.KMSDescribeSelfIdentityParams) (*models.KmsDescribeSelfIdentityResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return describeSelfIdentity(ctx, AdminClient{Client: mAdmin}) -} - -func describeSelfIdentity(ctx context.Context, minioClient MinioAdmin) (*models.KmsDescribeSelfIdentityResponse, *CodedAPIError) { - i, err := minioClient.describeSelfIdentity(ctx) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.KmsDescribeSelfIdentityResponse{ - Policy: &models.KmsGetPolicyResponse{ - Allow: i.Policy.Allow, - Deny: i.Policy.Deny, - }, - Identity: i.Identity, - Admin: i.IsAdmin, - CreatedAt: i.CreatedAt, - CreatedBy: i.CreatedBy, - }, nil -} - -func GetKMSListIdentitiesResponse(session *models.Principal, params kmsAPI.KMSListIdentitiesParams) (*models.KmsListIdentitiesResponse, *CodedAPIError) { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - pattern := "" - if params.Pattern != nil { - pattern = *params.Pattern - } - return listIdentities(ctx, pattern, AdminClient{Client: mAdmin}) -} - -func listIdentities(ctx context.Context, pattern string, minioClient MinioAdmin) (*models.KmsListIdentitiesResponse, *CodedAPIError) { - results, err := minioClient.listIdentities(ctx, pattern) - if err != nil { - return nil, ErrorWithContext(ctx, err) - } - return &models.KmsListIdentitiesResponse{Results: parseIdentities(results)}, nil -} - -func parseIdentities(results []madmin.KMSIdentityInfo) (data []*models.KmsIdentityInfo) { - for _, policy := range results { - data = append(data, &models.KmsIdentityInfo{ - CreatedAt: policy.CreatedAt, - CreatedBy: policy.CreatedBy, - Identity: policy.Identity, - Error: policy.Error, - Policy: policy.Policy, - }) - } - return data -} - -func GetKMSDeleteIdentityResponse(session *models.Principal, params kmsAPI.KMSDeleteIdentityParams) *CodedAPIError { - ctx, cancel := context.WithCancel(params.HTTPRequest.Context()) - defer cancel() - mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session) - if err != nil { - return ErrorWithContext(ctx, err) - } - return deleteIdentity(ctx, params.Name, AdminClient{Client: mAdmin}) -} - -func deleteIdentity(ctx context.Context, identity string, minioClient MinioAdmin) *CodedAPIError { - if err := minioClient.deleteIdentity(ctx, identity); err != nil { - return ErrorWithContext(ctx, err) - } - return nil -} diff --git a/api/admin_kms_test.go b/api/admin_kms_test.go index dc4b9bb60..bd32078bf 100644 --- a/api/admin_kms_test.go +++ b/api/admin_kms_test.go @@ -78,20 +78,8 @@ func (suite *KMSTestSuite) assertHandlersAreNil(api *operations.ConsoleAPI) { suite.assert.Nil(api.KmsKMSAPIsHandler) suite.assert.Nil(api.KmsKMSVersionHandler) 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) { @@ -100,20 +88,8 @@ func (suite *KMSTestSuite) assertHandlersAreNotNil(api *operations.ConsoleAPI) { suite.assert.NotNil(api.KmsKMSAPIsHandler) suite.assert.NotNil(api.KmsKMSVersionHandler) 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() { @@ -217,25 +193,6 @@ func (suite *KMSTestSuite) TestKMSCreateKeyWithoutError() { suite.assert.Nil(err) } -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) TestKMSImportKeyWithoutError() { - ctx := context.Background() - err := importKey(ctx, "key", []byte(""), suite.adminClient) - suite.assert.Nil(err) -} - func (suite *KMSTestSuite) TestKMSListKeysHandlerWithError() { params, api := suite.initKMSListKeysRequest() response := api.KmsKMSListKeysHandler.Handle(params, &models.Principal{}) @@ -276,223 +233,6 @@ func (suite *KMSTestSuite) TestKMSKeyStatusWithoutError() { suite.assert.Nil(err) } -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) TestKMSDeleteKeyWithoutError() { - ctx := context.Background() - err := deleteKey(ctx, "key", suite.adminClient) - suite.assert.Nil(err) -} - -func (suite *KMSTestSuite) TestKMSSetPolicyHandlerWithError() { - params, api := suite.initKMSSetPolicyRequest() - response := api.KmsKMSSetPolicyHandler.Handle(params, &models.Principal{}) - _, ok := response.(*kmsAPI.KMSSetPolicyDefault) - suite.assert.True(ok) -} - -func (suite *KMSTestSuite) initKMSSetPolicyRequest() (params kmsAPI.KMSSetPolicyParams, api operations.ConsoleAPI) { - registerKMSHandlers(&api) - params.HTTPRequest = &http.Request{} - policy := "policy" - params.Body = &models.KmsSetPolicyRequest{Policy: &policy} - return params, api -} - -func (suite *KMSTestSuite) TestKMSSetPolicyWithoutError() { - ctx := context.Background() - err := setPolicy(ctx, "policy", []byte(""), suite.adminClient) - suite.assert.Nil(err) -} - -func (suite *KMSTestSuite) TestKMSAssignPolicyHandlerWithError() { - params, api := suite.initKMSAssignPolicyRequest() - response := api.KmsKMSAssignPolicyHandler.Handle(params, &models.Principal{}) - _, 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) TestKMSAssignPolicyWithoutError() { - ctx := context.Background() - err := assignPolicy(ctx, "policy", []byte(""), suite.adminClient) - suite.assert.Nil(err) -} - -func (suite *KMSTestSuite) TestKMSDescribePolicyHandlerWithError() { - params, api := suite.initKMSDescribePolicyRequest() - response := api.KmsKMSDescribePolicyHandler.Handle(params, &models.Principal{}) - _, 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) TestKMSDescribePolicyWithoutError() { - ctx := context.Background() - res, err := describePolicy(ctx, "policy", suite.adminClient) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func (suite *KMSTestSuite) TestKMSGetPolicyHandlerWithError() { - params, api := suite.initKMSGetPolicyRequest() - response := api.KmsKMSGetPolicyHandler.Handle(params, &models.Principal{}) - _, 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) TestKMSGetPolicyWithoutError() { - ctx := context.Background() - res, err := getPolicy(ctx, "policy", suite.adminClient) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func (suite *KMSTestSuite) TestKMSListPoliciesHandlerWithError() { - params, api := suite.initKMSListPoliciesRequest() - response := api.KmsKMSListPoliciesHandler.Handle(params, &models.Principal{}) - _, 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) TestKMSListPoliciesWithoutError() { - ctx := context.Background() - res, err := listKMSPolicies(ctx, "", suite.adminClient) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func (suite *KMSTestSuite) TestKMSDeletePolicyHandlerWithError() { - params, api := suite.initKMSDeletePolicyRequest() - response := api.KmsKMSDeletePolicyHandler.Handle(params, &models.Principal{}) - _, 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) TestKMSDeletePolicyWithoutError() { - ctx := context.Background() - err := deletePolicy(ctx, "policy", suite.adminClient) - suite.assert.Nil(err) -} - -func (suite *KMSTestSuite) TestKMSDescribeIdentityHandlerWithError() { - params, api := suite.initKMSDescribeIdentityRequest() - response := api.KmsKMSDescribeIdentityHandler.Handle(params, &models.Principal{}) - _, 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) TestKMSDescribeIdentityWithoutError() { - ctx := context.Background() - res, err := describeIdentity(ctx, "identity", suite.adminClient) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func (suite *KMSTestSuite) TestKMSDescribeSelfIdentityHandlerWithError() { - params, api := suite.initKMSDescribeSelfIdentityRequest() - response := api.KmsKMSDescribeSelfIdentityHandler.Handle(params, &models.Principal{}) - _, 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) TestKMSDescribeSelfIdentityWithoutError() { - ctx := context.Background() - res, err := describeSelfIdentity(ctx, suite.adminClient) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func (suite *KMSTestSuite) TestKMSListIdentitiesHandlerWithError() { - params, api := suite.initKMSListIdentitiesRequest() - response := api.KmsKMSListIdentitiesHandler.Handle(params, &models.Principal{}) - _, 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) TestKMSListIdentitiesWithoutError() { - ctx := context.Background() - res, err := listIdentities(ctx, "", suite.adminClient) - suite.assert.NotNil(res) - suite.assert.Nil(err) -} - -func (suite *KMSTestSuite) TestKMSDeleteIdentityHandlerWithError() { - params, api := suite.initKMSDeleteIdentityRequest() - response := api.KmsKMSDeleteIdentityHandler.Handle(params, &models.Principal{}) - _, 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 (suite *KMSTestSuite) TestKMSDeleteIdentityWithoutError() { - ctx := context.Background() - err := deleteIdentity(ctx, "identity", suite.adminClient) - suite.assert.Nil(err) -} - func TestKMS(t *testing.T) { suite.Run(t, new(KMSTestSuite)) } diff --git a/api/client-admin.go b/api/client-admin.go index 4c8016e71..eaae02422 100644 --- a/api/client-admin.go +++ b/api/client-admin.go @@ -115,20 +115,8 @@ type MinioAdmin interface { kmsAPIs(ctx context.Context) ([]madmin.KMSAPI, error) kmsVersion(ctx context.Context) (*madmin.KMSVersion, error) createKey(ctx context.Context, key string) error - importKey(ctx context.Context, key string, content []byte) error listKeys(ctx context.Context, pattern string) ([]madmin.KMSKeyInfo, error) keyStatus(ctx context.Context, key string) (*madmin.KMSKeyStatus, error) - deleteKey(ctx context.Context, key string) error - setKMSPolicy(ctx context.Context, policy string, content []byte) error - assignPolicy(ctx context.Context, policy string, content []byte) error - describePolicy(ctx context.Context, policy string) (*madmin.KMSDescribePolicy, error) - getKMSPolicy(ctx context.Context, policy string) (*madmin.KMSPolicy, error) - listKMSPolicies(ctx context.Context, pattern string) ([]madmin.KMSPolicyInfo, error) - deletePolicy(ctx context.Context, policy string) error - describeIdentity(ctx context.Context, identity string) (*madmin.KMSDescribeIdentity, error) - describeSelfIdentity(ctx context.Context) (*madmin.KMSDescribeSelfIdentity, error) - deleteIdentity(ctx context.Context, identity string) error - listIdentities(ctx context.Context, pattern string) ([]madmin.KMSIdentityInfo, error) // IDP addOrUpdateIDPConfig(ctx context.Context, idpType, cfgName, cfgData string, update bool) (restart bool, err error) @@ -675,10 +663,6 @@ func (ac AdminClient) createKey(ctx context.Context, key string) error { return ac.Client.CreateKey(ctx, key) } -func (ac AdminClient) importKey(ctx context.Context, key string, content []byte) error { - return ac.Client.ImportKey(ctx, key, content) -} - func (ac AdminClient) listKeys(ctx context.Context, pattern string) ([]madmin.KMSKeyInfo, error) { return ac.Client.ListKeys(ctx, pattern) } @@ -687,50 +671,6 @@ func (ac AdminClient) keyStatus(ctx context.Context, key string) (*madmin.KMSKey return ac.Client.GetKeyStatus(ctx, key) } -func (ac AdminClient) deleteKey(ctx context.Context, key string) error { - return ac.Client.DeleteKey(ctx, key) -} - -func (ac AdminClient) setKMSPolicy(ctx context.Context, policy string, content []byte) error { - return ac.Client.SetKMSPolicy(ctx, policy, content) -} - -func (ac AdminClient) assignPolicy(ctx context.Context, policy string, content []byte) error { - return ac.Client.AssignPolicy(ctx, policy, content) -} - -func (ac AdminClient) describePolicy(ctx context.Context, policy string) (*madmin.KMSDescribePolicy, error) { - return ac.Client.DescribePolicy(ctx, policy) -} - -func (ac AdminClient) getKMSPolicy(ctx context.Context, policy string) (*madmin.KMSPolicy, error) { - return ac.Client.GetPolicy(ctx, policy) -} - -func (ac AdminClient) listKMSPolicies(ctx context.Context, pattern string) ([]madmin.KMSPolicyInfo, error) { - return ac.Client.ListPolicies(ctx, pattern) -} - -func (ac AdminClient) deletePolicy(ctx context.Context, policy string) error { - return ac.Client.DeletePolicy(ctx, policy) -} - -func (ac AdminClient) describeIdentity(ctx context.Context, identity string) (*madmin.KMSDescribeIdentity, error) { - return ac.Client.DescribeIdentity(ctx, identity) -} - -func (ac AdminClient) describeSelfIdentity(ctx context.Context) (*madmin.KMSDescribeSelfIdentity, error) { - return ac.Client.DescribeSelfIdentity(ctx) -} - -func (ac AdminClient) deleteIdentity(ctx context.Context, identity string) error { - return ac.Client.DeleteIdentity(ctx, identity) -} - -func (ac AdminClient) listIdentities(ctx context.Context, pattern string) ([]madmin.KMSIdentityInfo, error) { - return ac.Client.ListIdentities(ctx, pattern) -} - func (ac AdminClient) addOrUpdateIDPConfig(ctx context.Context, idpType, cfgName, cfgData string, update bool) (restart bool, err error) { return ac.Client.AddOrUpdateIDPConfig(ctx, idpType, cfgName, cfgData, update) } diff --git a/api/embedded_spec.go b/api/embedded_spec.go index de48e606a..bb7c608f2 100644 --- a/api/embedded_spec.go +++ b/api/embedded_spec.go @@ -3207,121 +3207,6 @@ 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/ApiError" - } - } - } - } - }, - "/kms/identities": { - "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/ApiError" - } - } - } - } - }, - "/kms/identities/{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/ApiError" - } - } - } - } - }, - "/kms/identities/{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/ApiError" - } - } - } - } - }, "/kms/keys": { "get": { "tags": [ @@ -3411,70 +3296,6 @@ func init() { } } } - }, - "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/ApiError" - } - } - } - } - }, - "/kms/keys/{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/ApiError" - } - } - } } }, "/kms/metrics": { @@ -3500,193 +3321,6 @@ func init() { } } }, - "/kms/policies": { - "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/ApiError" - } - } - } - }, - "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/ApiError" - } - } - } - } - }, - "/kms/policies/{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/ApiError" - } - } - } - }, - "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/ApiError" - } - } - } - } - }, - "/kms/policies/{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/ApiError" - } - } - } - } - }, - "/kms/policies/{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/ApiError" - } - } - } - } - }, "/kms/status": { "get": { "tags": [ @@ -6425,9 +6059,6 @@ func init() { } } }, - "kmDeleteKeyRequest": { - "type": "object" - }, "kmsAPI": { "type": "object", "properties": { @@ -6456,14 +6087,6 @@ func init() { } } }, - "kmsAssignPolicyRequest": { - "type": "object", - "properties": { - "identity": { - "type": "string" - } - } - }, "kmsCreateKeyRequest": { "type": "object", "required": [ @@ -6475,63 +6098,6 @@ func init() { } } }, - "kmsDescribeIdentityResponse": { - "type": "object", - "properties": { - "admin": { - "type": "boolean" - }, - "createdAt": { - "type": "string" - }, - "createdBy": { - "type": "string" - }, - "identity": { - "type": "string" - }, - "policy": { - "type": "string" - } - } - }, - "kmsDescribePolicyResponse": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "createdBy": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "kmsDescribeSelfIdentityResponse": { - "type": "object", - "properties": { - "admin": { - "type": "boolean" - }, - "createdAt": { - "type": "string" - }, - "createdBy": { - "type": "string" - }, - "identity": { - "type": "string" - }, - "policy": { - "$ref": "#/definitions/kmsGetPolicyResponse" - }, - "policyName": { - "type": "string" - } - } - }, "kmsEndpoint": { "type": "object", "properties": { @@ -6543,54 +6109,6 @@ func init() { } } }, - "kmsGetPolicyResponse": { - "type": "object", - "properties": { - "allow": { - "type": "array", - "items": { - "type": "string" - } - }, - "deny": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "kmsIdentityInfo": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "createdBy": { - "type": "string" - }, - "error": { - "type": "string" - }, - "identity": { - "type": "string" - }, - "policy": { - "type": "string" - } - } - }, - "kmsImportKeyRequest": { - "type": "object", - "required": [ - "bytes" - ], - "properties": { - "bytes": { - "type": "string" - } - } - }, "kmsKeyInfo": { "type": "object", "properties": { @@ -6630,17 +6148,6 @@ func init() { } } }, - "kmsListIdentitiesResponse": { - "type": "object", - "properties": { - "results": { - "type": "array", - "items": { - "$ref": "#/definitions/kmsIdentityInfo" - } - } - } - }, "kmsListKeysResponse": { "type": "object", "properties": { @@ -6652,17 +6159,6 @@ func init() { } } }, - "kmsListPoliciesResponse": { - "type": "object", - "properties": { - "results": { - "type": "array", - "items": { - "$ref": "#/definitions/kmsPolicyInfo" - } - } - } - }, "kmsMetricsResponse": { "type": "object", "required": [ @@ -6728,43 +6224,6 @@ func init() { } } }, - "kmsPolicyInfo": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "createdBy": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "kmsSetPolicyRequest": { - "type": "object", - "required": [ - "policy" - ], - "properties": { - "allow": { - "type": "array", - "items": { - "type": "string" - } - }, - "deny": { - "type": "array", - "items": { - "type": "string" - } - }, - "policy": { - "type": "string" - } - } - }, "kmsStatusResponse": { "type": "object", "properties": { @@ -12505,121 +11964,6 @@ 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/ApiError" - } - } - } - } - }, - "/kms/identities": { - "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/ApiError" - } - } - } - } - }, - "/kms/identities/{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/ApiError" - } - } - } - } - }, - "/kms/identities/{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/ApiError" - } - } - } - } - }, "/kms/keys": { "get": { "tags": [ @@ -12709,70 +12053,6 @@ func init() { } } } - }, - "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/ApiError" - } - } - } - } - }, - "/kms/keys/{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/ApiError" - } - } - } } }, "/kms/metrics": { @@ -12798,193 +12078,6 @@ func init() { } } }, - "/kms/policies": { - "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/ApiError" - } - } - } - }, - "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/ApiError" - } - } - } - } - }, - "/kms/policies/{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/ApiError" - } - } - } - }, - "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/ApiError" - } - } - } - } - }, - "/kms/policies/{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/ApiError" - } - } - } - } - }, - "/kms/policies/{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/ApiError" - } - } - } - } - }, "/kms/status": { "get": { "tags": [ @@ -15896,9 +14989,6 @@ func init() { } } }, - "kmDeleteKeyRequest": { - "type": "object" - }, "kmsAPI": { "type": "object", "properties": { @@ -15927,14 +15017,6 @@ func init() { } } }, - "kmsAssignPolicyRequest": { - "type": "object", - "properties": { - "identity": { - "type": "string" - } - } - }, "kmsCreateKeyRequest": { "type": "object", "required": [ @@ -15946,63 +15028,6 @@ func init() { } } }, - "kmsDescribeIdentityResponse": { - "type": "object", - "properties": { - "admin": { - "type": "boolean" - }, - "createdAt": { - "type": "string" - }, - "createdBy": { - "type": "string" - }, - "identity": { - "type": "string" - }, - "policy": { - "type": "string" - } - } - }, - "kmsDescribePolicyResponse": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "createdBy": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "kmsDescribeSelfIdentityResponse": { - "type": "object", - "properties": { - "admin": { - "type": "boolean" - }, - "createdAt": { - "type": "string" - }, - "createdBy": { - "type": "string" - }, - "identity": { - "type": "string" - }, - "policy": { - "$ref": "#/definitions/kmsGetPolicyResponse" - }, - "policyName": { - "type": "string" - } - } - }, "kmsEndpoint": { "type": "object", "properties": { @@ -16014,54 +15039,6 @@ func init() { } } }, - "kmsGetPolicyResponse": { - "type": "object", - "properties": { - "allow": { - "type": "array", - "items": { - "type": "string" - } - }, - "deny": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "kmsIdentityInfo": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "createdBy": { - "type": "string" - }, - "error": { - "type": "string" - }, - "identity": { - "type": "string" - }, - "policy": { - "type": "string" - } - } - }, - "kmsImportKeyRequest": { - "type": "object", - "required": [ - "bytes" - ], - "properties": { - "bytes": { - "type": "string" - } - } - }, "kmsKeyInfo": { "type": "object", "properties": { @@ -16101,17 +15078,6 @@ func init() { } } }, - "kmsListIdentitiesResponse": { - "type": "object", - "properties": { - "results": { - "type": "array", - "items": { - "$ref": "#/definitions/kmsIdentityInfo" - } - } - } - }, "kmsListKeysResponse": { "type": "object", "properties": { @@ -16123,17 +15089,6 @@ func init() { } } }, - "kmsListPoliciesResponse": { - "type": "object", - "properties": { - "results": { - "type": "array", - "items": { - "$ref": "#/definitions/kmsPolicyInfo" - } - } - } - }, "kmsMetricsResponse": { "type": "object", "required": [ @@ -16199,43 +15154,6 @@ func init() { } } }, - "kmsPolicyInfo": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "createdBy": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "kmsSetPolicyRequest": { - "type": "object", - "required": [ - "policy" - ], - "properties": { - "allow": { - "type": "array", - "items": { - "type": "string" - } - }, - "deny": { - "type": "array", - "items": { - "type": "string" - } - }, - "policy": { - "type": "string" - } - } - }, "kmsStatusResponse": { "type": "object", "properties": { diff --git a/api/operations/console_api.go b/api/operations/console_api.go index f4bab978e..71851fedd 100644 --- a/api/operations/console_api.go +++ b/api/operations/console_api.go @@ -296,54 +296,18 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI { KmsKMSAPIsHandler: k_m_s.KMSAPIsHandlerFunc(func(params k_m_s.KMSAPIsParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation k_m_s.KMSAPIs 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") - }), KmsKMSMetricsHandler: k_m_s.KMSMetricsHandlerFunc(func(params k_m_s.KMSMetricsParams, principal *models.Principal) middleware.Responder { return middleware.NotImplemented("operation k_m_s.KMSMetrics 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") }), @@ -770,38 +734,14 @@ type ConsoleAPI struct { InspectInspectHandler inspect.InspectHandler // KmsKMSAPIsHandler sets the operation handler for the k m s a p is operation KmsKMSAPIsHandler k_m_s.KMSAPIsHandler - // 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 // KmsKMSMetricsHandler sets the operation handler for the k m s metrics operation KmsKMSMetricsHandler k_m_s.KMSMetricsHandler - // 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 // KmsKMSVersionHandler sets the operation handler for the k m s version operation @@ -1250,54 +1190,18 @@ func (o *ConsoleAPI) Validate() error { if o.KmsKMSAPIsHandler == nil { unregistered = append(unregistered, "k_m_s.KMSAPIsHandler") } - 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.KmsKMSMetricsHandler == nil { unregistered = append(unregistered, "k_m_s.KMSMetricsHandler") } - if o.KmsKMSSetPolicyHandler == nil { - unregistered = append(unregistered, "k_m_s.KMSSetPolicyHandler") - } if o.KmsKMSStatusHandler == nil { unregistered = append(unregistered, "k_m_s.KMSStatusHandler") } @@ -1909,43 +1813,7 @@ func (o *ConsoleAPI) initHandlerCache() { if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } - o.handlers["POST"]["/kms/policies/{name}/assign"] = k_m_s.NewKMSAssignPolicy(o.context, o.KmsKMSAssignPolicyHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } o.handlers["POST"]["/kms/keys"] = k_m_s.NewKMSCreateKey(o.context, o.KmsKMSCreateKeyHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/kms/identities/{name}"] = k_m_s.NewKMSDeleteIdentity(o.context, o.KmsKMSDeleteIdentityHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/kms/keys/{name}"] = k_m_s.NewKMSDeleteKey(o.context, o.KmsKMSDeleteKeyHandler) - if o.handlers["DELETE"] == nil { - o.handlers["DELETE"] = make(map[string]http.Handler) - } - o.handlers["DELETE"]["/kms/policies/{name}"] = k_m_s.NewKMSDeletePolicy(o.context, o.KmsKMSDeletePolicyHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/kms/identities/{name}/describe"] = k_m_s.NewKMSDescribeIdentity(o.context, o.KmsKMSDescribeIdentityHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } - o.handlers["GET"]["/kms/policies/{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/policies/{name}"] = k_m_s.NewKMSGetPolicy(o.context, o.KmsKMSGetPolicyHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/kms/keys/{name}/import"] = k_m_s.NewKMSImportKey(o.context, o.KmsKMSImportKeyHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } @@ -1953,23 +1821,11 @@ func (o *ConsoleAPI) initHandlerCache() { if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } - o.handlers["GET"]["/kms/identities"] = k_m_s.NewKMSListIdentities(o.context, o.KmsKMSListIdentitiesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } o.handlers["GET"]["/kms/keys"] = k_m_s.NewKMSListKeys(o.context, o.KmsKMSListKeysHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } - o.handlers["GET"]["/kms/policies"] = k_m_s.NewKMSListPolicies(o.context, o.KmsKMSListPoliciesHandler) - if o.handlers["GET"] == nil { - o.handlers["GET"] = make(map[string]http.Handler) - } o.handlers["GET"]["/kms/metrics"] = k_m_s.NewKMSMetrics(o.context, o.KmsKMSMetricsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/kms/policies"] = k_m_s.NewKMSSetPolicy(o.context, o.KmsKMSSetPolicyHandler) if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } diff --git a/api/operations/k_m_s/k_m_s_assign_policy.go b/api/operations/k_m_s/k_m_s_assign_policy.go deleted file mode 100644 index c694e1e0b..000000000 --- a/api/operations/k_m_s/k_m_s_assign_policy.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/policies/{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/api/operations/k_m_s/k_m_s_assign_policy_parameters.go b/api/operations/k_m_s/k_m_s_assign_policy_parameters.go deleted file mode 100644 index fd5055d4c..000000000 --- a/api/operations/k_m_s/k_m_s_assign_policy_parameters.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/go-openapi/validate" - - "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 { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - - 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/api/operations/k_m_s/k_m_s_assign_policy_responses.go b/api/operations/k_m_s/k_m_s_assign_policy_responses.go deleted file mode 100644 index d48e26bb4..000000000 --- a/api/operations/k_m_s/k_m_s_assign_policy_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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.APIError `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.APIError) *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.APIError) { - 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/api/operations/k_m_s/k_m_s_assign_policy_urlbuilder.go b/api/operations/k_m_s/k_m_s_assign_policy_urlbuilder.go deleted file mode 100644 index 24ca739b1..000000000 --- a/api/operations/k_m_s/k_m_s_assign_policy_urlbuilder.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/policies/{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/api/operations/k_m_s/k_m_s_delete_identity.go b/api/operations/k_m_s/k_m_s_delete_identity.go deleted file mode 100644 index 907411895..000000000 --- a/api/operations/k_m_s/k_m_s_delete_identity.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/identities/{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/api/operations/k_m_s/k_m_s_delete_identity_parameters.go b/api/operations/k_m_s/k_m_s_delete_identity_parameters.go deleted file mode 100644 index bce698151..000000000 --- a/api/operations/k_m_s/k_m_s_delete_identity_parameters.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/api/operations/k_m_s/k_m_s_delete_identity_responses.go b/api/operations/k_m_s/k_m_s_delete_identity_responses.go deleted file mode 100644 index 3dcf91343..000000000 --- a/api/operations/k_m_s/k_m_s_delete_identity_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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.APIError `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.APIError) *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.APIError) { - 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/api/operations/k_m_s/k_m_s_delete_identity_urlbuilder.go b/api/operations/k_m_s/k_m_s_delete_identity_urlbuilder.go deleted file mode 100644 index c30cd3b2d..000000000 --- a/api/operations/k_m_s/k_m_s_delete_identity_urlbuilder.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/identities/{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/api/operations/k_m_s/k_m_s_delete_key.go b/api/operations/k_m_s/k_m_s_delete_key.go deleted file mode 100644 index 85413721b..000000000 --- a/api/operations/k_m_s/k_m_s_delete_key.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/keys/{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/api/operations/k_m_s/k_m_s_delete_key_parameters.go b/api/operations/k_m_s/k_m_s_delete_key_parameters.go deleted file mode 100644 index 4638b95d2..000000000 --- a/api/operations/k_m_s/k_m_s_delete_key_parameters.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/api/operations/k_m_s/k_m_s_delete_key_responses.go b/api/operations/k_m_s/k_m_s_delete_key_responses.go deleted file mode 100644 index c67a41dff..000000000 --- a/api/operations/k_m_s/k_m_s_delete_key_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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.APIError `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.APIError) *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.APIError) { - 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/api/operations/k_m_s/k_m_s_delete_key_urlbuilder.go b/api/operations/k_m_s/k_m_s_delete_key_urlbuilder.go deleted file mode 100644 index 730ed132b..000000000 --- a/api/operations/k_m_s/k_m_s_delete_key_urlbuilder.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/keys/{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/api/operations/k_m_s/k_m_s_delete_policy.go b/api/operations/k_m_s/k_m_s_delete_policy.go deleted file mode 100644 index a045c2b6c..000000000 --- a/api/operations/k_m_s/k_m_s_delete_policy.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/policies/{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/api/operations/k_m_s/k_m_s_delete_policy_parameters.go b/api/operations/k_m_s/k_m_s_delete_policy_parameters.go deleted file mode 100644 index 9c86cc337..000000000 --- a/api/operations/k_m_s/k_m_s_delete_policy_parameters.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/api/operations/k_m_s/k_m_s_delete_policy_responses.go b/api/operations/k_m_s/k_m_s_delete_policy_responses.go deleted file mode 100644 index 73597a875..000000000 --- a/api/operations/k_m_s/k_m_s_delete_policy_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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.APIError `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.APIError) *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.APIError) { - 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/api/operations/k_m_s/k_m_s_delete_policy_urlbuilder.go b/api/operations/k_m_s/k_m_s_delete_policy_urlbuilder.go deleted file mode 100644 index 7e631e954..000000000 --- a/api/operations/k_m_s/k_m_s_delete_policy_urlbuilder.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/policies/{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/api/operations/k_m_s/k_m_s_describe_identity.go b/api/operations/k_m_s/k_m_s_describe_identity.go deleted file mode 100644 index e581e7e11..000000000 --- a/api/operations/k_m_s/k_m_s_describe_identity.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/identities/{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/api/operations/k_m_s/k_m_s_describe_identity_parameters.go b/api/operations/k_m_s/k_m_s_describe_identity_parameters.go deleted file mode 100644 index e5414976e..000000000 --- a/api/operations/k_m_s/k_m_s_describe_identity_parameters.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/api/operations/k_m_s/k_m_s_describe_identity_responses.go b/api/operations/k_m_s/k_m_s_describe_identity_responses.go deleted file mode 100644 index 9a529fc21..000000000 --- a/api/operations/k_m_s/k_m_s_describe_identity_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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) - if o.Payload != nil { - 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.APIError `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.APIError) *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.APIError) { - 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/api/operations/k_m_s/k_m_s_describe_identity_urlbuilder.go b/api/operations/k_m_s/k_m_s_describe_identity_urlbuilder.go deleted file mode 100644 index dc1d59d27..000000000 --- a/api/operations/k_m_s/k_m_s_describe_identity_urlbuilder.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/identities/{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/api/operations/k_m_s/k_m_s_describe_policy.go b/api/operations/k_m_s/k_m_s_describe_policy.go deleted file mode 100644 index 203a728df..000000000 --- a/api/operations/k_m_s/k_m_s_describe_policy.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/policies/{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/api/operations/k_m_s/k_m_s_describe_policy_parameters.go b/api/operations/k_m_s/k_m_s_describe_policy_parameters.go deleted file mode 100644 index 319451ff2..000000000 --- a/api/operations/k_m_s/k_m_s_describe_policy_parameters.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/api/operations/k_m_s/k_m_s_describe_policy_responses.go b/api/operations/k_m_s/k_m_s_describe_policy_responses.go deleted file mode 100644 index 176e798ad..000000000 --- a/api/operations/k_m_s/k_m_s_describe_policy_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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) - if o.Payload != nil { - 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.APIError `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.APIError) *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.APIError) { - 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/api/operations/k_m_s/k_m_s_describe_policy_urlbuilder.go b/api/operations/k_m_s/k_m_s_describe_policy_urlbuilder.go deleted file mode 100644 index 722a17694..000000000 --- a/api/operations/k_m_s/k_m_s_describe_policy_urlbuilder.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/policies/{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/api/operations/k_m_s/k_m_s_describe_self_identity.go b/api/operations/k_m_s/k_m_s_describe_self_identity.go deleted file mode 100644 index 3ffa4721b..000000000 --- a/api/operations/k_m_s/k_m_s_describe_self_identity.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/api/operations/k_m_s/k_m_s_describe_self_identity_parameters.go b/api/operations/k_m_s/k_m_s_describe_self_identity_parameters.go deleted file mode 100644 index 8c2445fb6..000000000 --- a/api/operations/k_m_s/k_m_s_describe_self_identity_parameters.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/api/operations/k_m_s/k_m_s_describe_self_identity_responses.go b/api/operations/k_m_s/k_m_s_describe_self_identity_responses.go deleted file mode 100644 index d639a0a24..000000000 --- a/api/operations/k_m_s/k_m_s_describe_self_identity_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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) - if o.Payload != nil { - 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.APIError `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.APIError) *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.APIError) { - 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/api/operations/k_m_s/k_m_s_describe_self_identity_urlbuilder.go b/api/operations/k_m_s/k_m_s_describe_self_identity_urlbuilder.go deleted file mode 100644 index 993570985..000000000 --- a/api/operations/k_m_s/k_m_s_describe_self_identity_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/api/operations/k_m_s/k_m_s_get_policy.go b/api/operations/k_m_s/k_m_s_get_policy.go deleted file mode 100644 index 915a0aeda..000000000 --- a/api/operations/k_m_s/k_m_s_get_policy.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/policies/{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/api/operations/k_m_s/k_m_s_get_policy_parameters.go b/api/operations/k_m_s/k_m_s_get_policy_parameters.go deleted file mode 100644 index b26a2b6e9..000000000 --- a/api/operations/k_m_s/k_m_s_get_policy_parameters.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/api/operations/k_m_s/k_m_s_get_policy_responses.go b/api/operations/k_m_s/k_m_s_get_policy_responses.go deleted file mode 100644 index 328db1c3a..000000000 --- a/api/operations/k_m_s/k_m_s_get_policy_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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) - if o.Payload != nil { - 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.APIError `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.APIError) *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.APIError) { - 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/api/operations/k_m_s/k_m_s_get_policy_urlbuilder.go b/api/operations/k_m_s/k_m_s_get_policy_urlbuilder.go deleted file mode 100644 index 81825204d..000000000 --- a/api/operations/k_m_s/k_m_s_get_policy_urlbuilder.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/policies/{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/api/operations/k_m_s/k_m_s_import_key.go b/api/operations/k_m_s/k_m_s_import_key.go deleted file mode 100644 index c5e8c1d68..000000000 --- a/api/operations/k_m_s/k_m_s_import_key.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/keys/{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/api/operations/k_m_s/k_m_s_import_key_parameters.go b/api/operations/k_m_s/k_m_s_import_key_parameters.go deleted file mode 100644 index a082b92fa..000000000 --- a/api/operations/k_m_s/k_m_s_import_key_parameters.go +++ /dev/null @@ -1,126 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/go-openapi/validate" - - "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 { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - - 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/api/operations/k_m_s/k_m_s_import_key_responses.go b/api/operations/k_m_s/k_m_s_import_key_responses.go deleted file mode 100644 index b092567a9..000000000 --- a/api/operations/k_m_s/k_m_s_import_key_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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.APIError `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.APIError) *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.APIError) { - 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/api/operations/k_m_s/k_m_s_import_key_urlbuilder.go b/api/operations/k_m_s/k_m_s_import_key_urlbuilder.go deleted file mode 100644 index 0ce617a46..000000000 --- a/api/operations/k_m_s/k_m_s_import_key_urlbuilder.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/keys/{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/api/operations/k_m_s/k_m_s_list_identities.go b/api/operations/k_m_s/k_m_s_list_identities.go deleted file mode 100644 index 2567db183..000000000 --- a/api/operations/k_m_s/k_m_s_list_identities.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/identities 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/api/operations/k_m_s/k_m_s_list_identities_parameters.go b/api/operations/k_m_s/k_m_s_list_identities_parameters.go deleted file mode 100644 index c53b29e92..000000000 --- a/api/operations/k_m_s/k_m_s_list_identities_parameters.go +++ /dev/null @@ -1,94 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/api/operations/k_m_s/k_m_s_list_identities_responses.go b/api/operations/k_m_s/k_m_s_list_identities_responses.go deleted file mode 100644 index 72c484b21..000000000 --- a/api/operations/k_m_s/k_m_s_list_identities_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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) - if o.Payload != nil { - 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.APIError `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.APIError) *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.APIError) { - 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/api/operations/k_m_s/k_m_s_list_identities_urlbuilder.go b/api/operations/k_m_s/k_m_s_list_identities_urlbuilder.go deleted file mode 100644 index 39cf14a39..000000000 --- a/api/operations/k_m_s/k_m_s_list_identities_urlbuilder.go +++ /dev/null @@ -1,120 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/identities" - - _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/api/operations/k_m_s/k_m_s_list_policies.go b/api/operations/k_m_s/k_m_s_list_policies.go deleted file mode 100644 index 803757bf9..000000000 --- a/api/operations/k_m_s/k_m_s_list_policies.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/policies 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/api/operations/k_m_s/k_m_s_list_policies_parameters.go b/api/operations/k_m_s/k_m_s_list_policies_parameters.go deleted file mode 100644 index 1c2e9eaf4..000000000 --- a/api/operations/k_m_s/k_m_s_list_policies_parameters.go +++ /dev/null @@ -1,94 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/api/operations/k_m_s/k_m_s_list_policies_responses.go b/api/operations/k_m_s/k_m_s_list_policies_responses.go deleted file mode 100644 index 62ad82e03..000000000 --- a/api/operations/k_m_s/k_m_s_list_policies_responses.go +++ /dev/null @@ -1,135 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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) - if o.Payload != nil { - 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.APIError `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.APIError) *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.APIError) { - 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/api/operations/k_m_s/k_m_s_list_policies_urlbuilder.go b/api/operations/k_m_s/k_m_s_list_policies_urlbuilder.go deleted file mode 100644 index a3005f560..000000000 --- a/api/operations/k_m_s/k_m_s_list_policies_urlbuilder.go +++ /dev/null @@ -1,120 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/policies" - - _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/api/operations/k_m_s/k_m_s_set_policy.go b/api/operations/k_m_s/k_m_s_set_policy.go deleted file mode 100644 index 0003e6502..000000000 --- a/api/operations/k_m_s/k_m_s_set_policy.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/policies 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/api/operations/k_m_s/k_m_s_set_policy_parameters.go b/api/operations/k_m_s/k_m_s_set_policy_parameters.go deleted file mode 100644 index a3aa9d625..000000000 --- a/api/operations/k_m_s/k_m_s_set_policy_parameters.go +++ /dev/null @@ -1,101 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/validate" - - "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 { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - ctx := validate.WithOperationRequest(r.Context()) - if err := body.ContextValidate(ctx, route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.Body = &body - } - } - } else { - res = append(res, errors.Required("body", "body", "")) - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/api/operations/k_m_s/k_m_s_set_policy_responses.go b/api/operations/k_m_s/k_m_s_set_policy_responses.go deleted file mode 100644 index c9c744f89..000000000 --- a/api/operations/k_m_s/k_m_s_set_policy_responses.go +++ /dev/null @@ -1,115 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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.APIError `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.APIError) *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.APIError) { - 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/api/operations/k_m_s/k_m_s_set_policy_urlbuilder.go b/api/operations/k_m_s/k_m_s_set_policy_urlbuilder.go deleted file mode 100644 index 450c30dea..000000000 --- a/api/operations/k_m_s/k_m_s_set_policy_urlbuilder.go +++ /dev/null @@ -1,104 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/policies" - - _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/models/km_delete_key_request.go b/models/km_delete_key_request.go deleted file mode 100644 index 0b3b40057..000000000 --- a/models/km_delete_key_request.go +++ /dev/null @@ -1,28 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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/kms_assign_policy_request.go b/models/kms_assign_policy_request.go deleted file mode 100644 index dfe77584b..000000000 --- a/models/kms_assign_policy_request.go +++ /dev/null @@ -1,67 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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 - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// KmsAssignPolicyRequest kms assign policy request -// -// swagger:model kmsAssignPolicyRequest -type KmsAssignPolicyRequest struct { - - // identity - Identity string `json:"identity,omitempty"` -} - -// Validate validates this kms assign policy request -func (m *KmsAssignPolicyRequest) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this kms assign policy request based on context it is used -func (m *KmsAssignPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *KmsAssignPolicyRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *KmsAssignPolicyRequest) UnmarshalBinary(b []byte) error { - var res KmsAssignPolicyRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/kms_describe_identity_response.go b/models/kms_describe_identity_response.go deleted file mode 100644 index fbb57796d..000000000 --- a/models/kms_describe_identity_response.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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 - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// KmsDescribeIdentityResponse kms describe identity response -// -// swagger:model kmsDescribeIdentityResponse -type KmsDescribeIdentityResponse struct { - - // admin - Admin bool `json:"admin,omitempty"` - - // created at - CreatedAt string `json:"createdAt,omitempty"` - - // created by - CreatedBy string `json:"createdBy,omitempty"` - - // identity - Identity string `json:"identity,omitempty"` - - // policy - Policy string `json:"policy,omitempty"` -} - -// Validate validates this kms describe identity response -func (m *KmsDescribeIdentityResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this kms describe identity response based on context it is used -func (m *KmsDescribeIdentityResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *KmsDescribeIdentityResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *KmsDescribeIdentityResponse) UnmarshalBinary(b []byte) error { - var res KmsDescribeIdentityResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/kms_describe_policy_response.go b/models/kms_describe_policy_response.go deleted file mode 100644 index c6688aa11..000000000 --- a/models/kms_describe_policy_response.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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 - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// KmsDescribePolicyResponse kms describe policy response -// -// swagger:model kmsDescribePolicyResponse -type KmsDescribePolicyResponse struct { - - // created at - CreatedAt string `json:"createdAt,omitempty"` - - // created by - CreatedBy string `json:"createdBy,omitempty"` - - // name - Name string `json:"name,omitempty"` -} - -// Validate validates this kms describe policy response -func (m *KmsDescribePolicyResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this kms describe policy response based on context it is used -func (m *KmsDescribePolicyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *KmsDescribePolicyResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *KmsDescribePolicyResponse) UnmarshalBinary(b []byte) error { - var res KmsDescribePolicyResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/kms_describe_self_identity_response.go b/models/kms_describe_self_identity_response.go deleted file mode 100644 index 9d2c38607..000000000 --- a/models/kms_describe_self_identity_response.go +++ /dev/null @@ -1,141 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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 - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// KmsDescribeSelfIdentityResponse kms describe self identity response -// -// swagger:model kmsDescribeSelfIdentityResponse -type KmsDescribeSelfIdentityResponse struct { - - // admin - Admin bool `json:"admin,omitempty"` - - // created at - CreatedAt string `json:"createdAt,omitempty"` - - // created by - CreatedBy string `json:"createdBy,omitempty"` - - // identity - Identity string `json:"identity,omitempty"` - - // policy - Policy *KmsGetPolicyResponse `json:"policy,omitempty"` - - // policy name - PolicyName string `json:"policyName,omitempty"` -} - -// Validate validates this kms describe self identity response -func (m *KmsDescribeSelfIdentityResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validatePolicy(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *KmsDescribeSelfIdentityResponse) validatePolicy(formats strfmt.Registry) error { - if swag.IsZero(m.Policy) { // not required - return nil - } - - if m.Policy != nil { - if err := m.Policy.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("policy") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("policy") - } - return err - } - } - - return nil -} - -// ContextValidate validate this kms describe self identity response based on the context it is used -func (m *KmsDescribeSelfIdentityResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidatePolicy(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *KmsDescribeSelfIdentityResponse) contextValidatePolicy(ctx context.Context, formats strfmt.Registry) error { - - if m.Policy != nil { - - if swag.IsZero(m.Policy) { // not required - return nil - } - - if err := m.Policy.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("policy") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("policy") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *KmsDescribeSelfIdentityResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *KmsDescribeSelfIdentityResponse) UnmarshalBinary(b []byte) error { - var res KmsDescribeSelfIdentityResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/kms_get_policy_response.go b/models/kms_get_policy_response.go deleted file mode 100644 index e7dc6f183..000000000 --- a/models/kms_get_policy_response.go +++ /dev/null @@ -1,70 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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 - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// KmsGetPolicyResponse kms get policy response -// -// swagger:model kmsGetPolicyResponse -type KmsGetPolicyResponse struct { - - // allow - Allow []string `json:"allow"` - - // deny - Deny []string `json:"deny"` -} - -// Validate validates this kms get policy response -func (m *KmsGetPolicyResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this kms get policy response based on context it is used -func (m *KmsGetPolicyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *KmsGetPolicyResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *KmsGetPolicyResponse) UnmarshalBinary(b []byte) error { - var res KmsGetPolicyResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/kms_identity_info.go b/models/kms_identity_info.go deleted file mode 100644 index a40be487b..000000000 --- a/models/kms_identity_info.go +++ /dev/null @@ -1,79 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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 - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// KmsIdentityInfo kms identity info -// -// swagger:model kmsIdentityInfo -type KmsIdentityInfo struct { - - // created at - CreatedAt string `json:"createdAt,omitempty"` - - // created by - CreatedBy string `json:"createdBy,omitempty"` - - // error - Error string `json:"error,omitempty"` - - // identity - Identity string `json:"identity,omitempty"` - - // policy - Policy string `json:"policy,omitempty"` -} - -// Validate validates this kms identity info -func (m *KmsIdentityInfo) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this kms identity info based on context it is used -func (m *KmsIdentityInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *KmsIdentityInfo) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *KmsIdentityInfo) UnmarshalBinary(b []byte) error { - var res KmsIdentityInfo - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/kms_import_key_request.go b/models/kms_import_key_request.go deleted file mode 100644 index 454b98a9d..000000000 --- a/models/kms_import_key_request.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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 - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// KmsImportKeyRequest kms import key request -// -// swagger:model kmsImportKeyRequest -type KmsImportKeyRequest struct { - - // bytes - // Required: true - Bytes *string `json:"bytes"` -} - -// Validate validates this kms import key request -func (m *KmsImportKeyRequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateBytes(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *KmsImportKeyRequest) validateBytes(formats strfmt.Registry) error { - - if err := validate.Required("bytes", "body", m.Bytes); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this kms import key request based on context it is used -func (m *KmsImportKeyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *KmsImportKeyRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *KmsImportKeyRequest) UnmarshalBinary(b []byte) error { - var res KmsImportKeyRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/kms_list_identities_response.go b/models/kms_list_identities_response.go deleted file mode 100644 index 4bbc20bd6..000000000 --- a/models/kms_list_identities_response.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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 - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// KmsListIdentitiesResponse kms list identities response -// -// swagger:model kmsListIdentitiesResponse -type KmsListIdentitiesResponse struct { - - // results - Results []*KmsIdentityInfo `json:"results"` -} - -// Validate validates this kms list identities response -func (m *KmsListIdentitiesResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateResults(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *KmsListIdentitiesResponse) validateResults(formats strfmt.Registry) error { - if swag.IsZero(m.Results) { // not required - return nil - } - - for i := 0; i < len(m.Results); i++ { - if swag.IsZero(m.Results[i]) { // not required - continue - } - - if m.Results[i] != nil { - if err := m.Results[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("results" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("results" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this kms list identities response based on the context it is used -func (m *KmsListIdentitiesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateResults(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *KmsListIdentitiesResponse) contextValidateResults(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Results); i++ { - - if m.Results[i] != nil { - - if swag.IsZero(m.Results[i]) { // not required - return nil - } - - if err := m.Results[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("results" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("results" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *KmsListIdentitiesResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *KmsListIdentitiesResponse) UnmarshalBinary(b []byte) error { - var res KmsListIdentitiesResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/kms_list_policies_response.go b/models/kms_list_policies_response.go deleted file mode 100644 index d7ff50a11..000000000 --- a/models/kms_list_policies_response.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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 - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// KmsListPoliciesResponse kms list policies response -// -// swagger:model kmsListPoliciesResponse -type KmsListPoliciesResponse struct { - - // results - Results []*KmsPolicyInfo `json:"results"` -} - -// Validate validates this kms list policies response -func (m *KmsListPoliciesResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateResults(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *KmsListPoliciesResponse) validateResults(formats strfmt.Registry) error { - if swag.IsZero(m.Results) { // not required - return nil - } - - for i := 0; i < len(m.Results); i++ { - if swag.IsZero(m.Results[i]) { // not required - continue - } - - if m.Results[i] != nil { - if err := m.Results[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("results" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("results" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this kms list policies response based on the context it is used -func (m *KmsListPoliciesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateResults(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *KmsListPoliciesResponse) contextValidateResults(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Results); i++ { - - if m.Results[i] != nil { - - if swag.IsZero(m.Results[i]) { // not required - return nil - } - - if err := m.Results[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("results" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("results" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *KmsListPoliciesResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *KmsListPoliciesResponse) UnmarshalBinary(b []byte) error { - var res KmsListPoliciesResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/kms_policy_info.go b/models/kms_policy_info.go deleted file mode 100644 index 7ec3dbdfa..000000000 --- a/models/kms_policy_info.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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 - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// KmsPolicyInfo kms policy info -// -// swagger:model kmsPolicyInfo -type KmsPolicyInfo struct { - - // created at - CreatedAt string `json:"createdAt,omitempty"` - - // created by - CreatedBy string `json:"createdBy,omitempty"` - - // name - Name string `json:"name,omitempty"` -} - -// Validate validates this kms policy info -func (m *KmsPolicyInfo) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this kms policy info based on context it is used -func (m *KmsPolicyInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *KmsPolicyInfo) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *KmsPolicyInfo) UnmarshalBinary(b []byte) error { - var res KmsPolicyInfo - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/models/kms_set_policy_request.go b/models/kms_set_policy_request.go deleted file mode 100644 index e2abae22a..000000000 --- a/models/kms_set_policy_request.go +++ /dev/null @@ -1,94 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -// This file is part of MinIO Console Server -// Copyright (c) 2023 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 - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// KmsSetPolicyRequest kms set policy request -// -// swagger:model kmsSetPolicyRequest -type KmsSetPolicyRequest struct { - - // allow - Allow []string `json:"allow"` - - // deny - Deny []string `json:"deny"` - - // policy - // Required: true - Policy *string `json:"policy"` -} - -// Validate validates this kms set policy request -func (m *KmsSetPolicyRequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validatePolicy(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *KmsSetPolicyRequest) validatePolicy(formats strfmt.Registry) error { - - if err := validate.Required("policy", "body", m.Policy); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this kms set policy request based on context it is used -func (m *KmsSetPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *KmsSetPolicyRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *KmsSetPolicyRequest) UnmarshalBinary(b []byte) error { - var res KmsSetPolicyRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/swagger.yml b/swagger.yml index bec05df4b..3a81994fb 100644 --- a/swagger.yml +++ b/swagger.yml @@ -3060,245 +3060,6 @@ paths: $ref: "#/definitions/ApiError" 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/ApiError" - tags: - - KMS - /kms/keys/{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/ApiError" - tags: - - KMS - /kms/policies: - 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/ApiError" - 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/ApiError" - tags: - - KMS - /kms/policies/{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/ApiError" - 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/ApiError" - tags: - - KMS - /kms/policies/{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/ApiError" - tags: - - KMS - /kms/policies/{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/ApiError" - tags: - - KMS - /kms/identities/{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/ApiError" - tags: - - KMS - /kms/identities/{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/ApiError" - 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/ApiError" - tags: - - KMS - /kms/identities: - 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/ApiError" - tags: - - KMS /admin/inspect: get: @@ -5819,15 +5580,6 @@ definitions: properties: key: type: string - kmsImportKeyRequest: - type: object - required: - - bytes - properties: - bytes: - type: string - kmDeleteKeyRequest: - type: object kmsListKeysResponse: type: object properties: @@ -5845,111 +5597,6 @@ definitions: createdBy: type: string - kmsGetPolicyResponse: - type: object - properties: - allow: - type: array - items: - type: string - deny: - type: array - items: - type: string - kmsSetPolicyRequest: - type: object - required: - - policy - properties: - policy: - type: string - allow: - type: array - items: - type: string - deny: - type: array - items: - type: string - kmsDescribePolicyResponse: - type: object - properties: - createdAt: - type: string - createdBy: - type: string - name: - type: string - kmsAssignPolicyRequest: - type: object - properties: - identity: - type: string - kmsListPoliciesResponse: - type: object - properties: - results: - type: array - items: - $ref: "#/definitions/kmsPolicyInfo" - kmsPolicyInfo: - type: object - properties: - name: - type: string - createdAt: - type: string - createdBy: - type: string - - kmsDescribeIdentityResponse: - type: object - properties: - policy: - type: string - identity: - type: string - admin: - type: boolean - createdAt: - type: string - createdBy: - type: string - kmsDescribeSelfIdentityResponse: - type: object - properties: - identity: - type: string - policyName: - type: string - admin: - type: boolean - createdAt: - type: string - createdBy: - type: string - policy: - $ref: "#/definitions/kmsGetPolicyResponse" - kmsListIdentitiesResponse: - type: object - properties: - results: - type: array - items: - $ref: "#/definitions/kmsIdentityInfo" - kmsIdentityInfo: - type: object - properties: - identity: - type: string - policy: - type: string - error: - type: string - createdAt: - type: string - createdBy: - type: string kmsMetricsResponse: type: object required: diff --git a/web-app/src/api/consoleApi.ts b/web-app/src/api/consoleApi.ts index 51414499a..46f371891 100644 --- a/web-app/src/api/consoleApi.ts +++ b/web-app/src/api/consoleApi.ts @@ -1305,12 +1305,6 @@ export interface KmsCreateKeyRequest { key: string; } -export interface KmsImportKeyRequest { - bytes: string; -} - -export type KmDeleteKeyRequest = object; - export interface KmsListKeysResponse { results?: KmsKeyInfo[]; } @@ -1321,66 +1315,6 @@ export interface KmsKeyInfo { createdBy?: string; } -export interface KmsGetPolicyResponse { - allow?: string[]; - deny?: string[]; -} - -export interface KmsSetPolicyRequest { - policy: string; - allow?: string[]; - deny?: string[]; -} - -export interface KmsDescribePolicyResponse { - createdAt?: string; - createdBy?: string; - name?: string; -} - -export interface KmsAssignPolicyRequest { - identity?: string; -} - -export interface KmsListPoliciesResponse { - results?: KmsPolicyInfo[]; -} - -export interface KmsPolicyInfo { - name?: string; - createdAt?: string; - createdBy?: string; -} - -export interface KmsDescribeIdentityResponse { - policy?: string; - identity?: string; - admin?: boolean; - createdAt?: string; - createdBy?: string; -} - -export interface KmsDescribeSelfIdentityResponse { - identity?: string; - policyName?: string; - admin?: boolean; - createdAt?: string; - createdBy?: string; - policy?: KmsGetPolicyResponse; -} - -export interface KmsListIdentitiesResponse { - results?: KmsIdentityInfo[]; -} - -export interface KmsIdentityInfo { - identity?: string; - policy?: string; - error?: string; - createdAt?: string; - createdBy?: string; -} - export interface KmsMetricsResponse { requestOK: number; requestErr: number; @@ -1991,7 +1925,7 @@ export class Api< */ bucketInfo: (name: string, params: RequestParams = {}) => this.request({ - path: `/buckets/${name}`, + path: `/buckets/${encodeURIComponent(name)}`, method: "GET", secure: true, format: "json", @@ -2009,7 +1943,7 @@ export class Api< */ deleteBucket: (name: string, params: RequestParams = {}) => this.request({ - path: `/buckets/${name}`, + path: `/buckets/${encodeURIComponent(name)}`, method: "DELETE", secure: true, ...params, @@ -2029,7 +1963,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/retention`, + path: `/buckets/${encodeURIComponent(bucketName)}/retention`, method: "GET", secure: true, format: "json", @@ -2051,7 +1985,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/retention`, + path: `/buckets/${encodeURIComponent(bucketName)}/retention`, method: "PUT", body: body, secure: true, @@ -2084,7 +2018,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/objects`, + path: `/buckets/${encodeURIComponent(bucketName)}/objects`, method: "GET", query: query, secure: true, @@ -2114,7 +2048,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/objects`, + path: `/buckets/${encodeURIComponent(bucketName)}/objects`, method: "DELETE", query: query, secure: true, @@ -2140,7 +2074,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/delete-objects`, + path: `/buckets/${encodeURIComponent(bucketName)}/delete-objects`, method: "POST", query: query, body: files, @@ -2167,7 +2101,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/objects/upload`, + path: `/buckets/${encodeURIComponent(bucketName)}/objects/upload`, method: "POST", query: query, body: data, @@ -2191,7 +2125,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/objects/download-multiple`, + path: `/buckets/${encodeURIComponent(bucketName)}/objects/download-multiple`, method: "POST", body: objectList, secure: true, @@ -2221,7 +2155,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/objects/download`, + path: `/buckets/${encodeURIComponent(bucketName)}/objects/download`, method: "GET", query: query, secure: true, @@ -2247,7 +2181,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/objects/share`, + path: `/buckets/${encodeURIComponent(bucketName)}/objects/share`, method: "GET", query: query, secure: true, @@ -2274,7 +2208,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/objects/legalhold`, + path: `/buckets/${encodeURIComponent(bucketName)}/objects/legalhold`, method: "PUT", query: query, body: body, @@ -2302,7 +2236,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/objects/retention`, + path: `/buckets/${encodeURIComponent(bucketName)}/objects/retention`, method: "PUT", query: query, body: body, @@ -2329,7 +2263,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/objects/retention`, + path: `/buckets/${encodeURIComponent(bucketName)}/objects/retention`, method: "DELETE", query: query, secure: true, @@ -2355,7 +2289,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/objects/tags`, + path: `/buckets/${encodeURIComponent(bucketName)}/objects/tags`, method: "PUT", query: query, body: body, @@ -2382,7 +2316,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/objects/restore`, + path: `/buckets/${encodeURIComponent(bucketName)}/objects/restore`, method: "PUT", query: query, secure: true, @@ -2407,7 +2341,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/objects/metadata`, + path: `/buckets/${encodeURIComponent(bucketName)}/objects/metadata`, method: "GET", query: query, secure: true, @@ -2430,7 +2364,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/tags`, + path: `/buckets/${encodeURIComponent(bucketName)}/tags`, method: "PUT", body: body, secure: true, @@ -2453,7 +2387,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${name}/set-policy`, + path: `/buckets/${encodeURIComponent(name)}/set-policy`, method: "PUT", body: body, secure: true, @@ -2473,7 +2407,7 @@ export class Api< */ getBucketQuota: (name: string, params: RequestParams = {}) => this.request({ - path: `/buckets/${name}/quota`, + path: `/buckets/${encodeURIComponent(name)}/quota`, method: "GET", secure: true, format: "json", @@ -2495,7 +2429,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${name}/quota`, + path: `/buckets/${encodeURIComponent(name)}/quota`, method: "PUT", body: body, secure: true, @@ -2530,7 +2464,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/events`, + path: `/buckets/${encodeURIComponent(bucketName)}/events`, method: "GET", query: query, secure: true, @@ -2553,7 +2487,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/events`, + path: `/buckets/${encodeURIComponent(bucketName)}/events`, method: "POST", body: body, secure: true, @@ -2577,7 +2511,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/events/${arn}`, + path: `/buckets/${encodeURIComponent(bucketName)}/events/${encodeURIComponent(arn)}`, method: "DELETE", body: body, secure: true, @@ -2596,7 +2530,7 @@ export class Api< */ getBucketReplication: (bucketName: string, params: RequestParams = {}) => this.request({ - path: `/buckets/${bucketName}/replication`, + path: `/buckets/${encodeURIComponent(bucketName)}/replication`, method: "GET", secure: true, format: "json", @@ -2618,7 +2552,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/replication/${ruleId}`, + path: `/buckets/${encodeURIComponent(bucketName)}/replication/${encodeURIComponent(ruleId)}`, method: "GET", secure: true, format: "json", @@ -2641,7 +2575,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/replication/${ruleId}`, + path: `/buckets/${encodeURIComponent(bucketName)}/replication/${encodeURIComponent(ruleId)}`, method: "PUT", body: body, secure: true, @@ -2664,7 +2598,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/replication/${ruleId}`, + path: `/buckets/${encodeURIComponent(bucketName)}/replication/${encodeURIComponent(ruleId)}`, method: "DELETE", secure: true, ...params, @@ -2684,7 +2618,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/delete-all-replication-rules`, + path: `/buckets/${encodeURIComponent(bucketName)}/delete-all-replication-rules`, method: "DELETE", secure: true, ...params, @@ -2705,7 +2639,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/delete-selected-replication-rules`, + path: `/buckets/${encodeURIComponent(bucketName)}/delete-selected-replication-rules`, method: "DELETE", body: rules, secure: true, @@ -2724,7 +2658,7 @@ export class Api< */ getBucketVersioning: (bucketName: string, params: RequestParams = {}) => this.request({ - path: `/buckets/${bucketName}/versioning`, + path: `/buckets/${encodeURIComponent(bucketName)}/versioning`, method: "GET", secure: true, format: "json", @@ -2746,7 +2680,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/versioning`, + path: `/buckets/${encodeURIComponent(bucketName)}/versioning`, method: "PUT", body: body, secure: true, @@ -2768,7 +2702,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/object-locking`, + path: `/buckets/${encodeURIComponent(bucketName)}/object-locking`, method: "GET", secure: true, format: "json", @@ -2790,7 +2724,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/encryption/enable`, + path: `/buckets/${encodeURIComponent(bucketName)}/encryption/enable`, method: "POST", body: body, secure: true, @@ -2809,7 +2743,7 @@ export class Api< */ disableBucketEncryption: (bucketName: string, params: RequestParams = {}) => this.request({ - path: `/buckets/${bucketName}/encryption/disable`, + path: `/buckets/${encodeURIComponent(bucketName)}/encryption/disable`, method: "POST", secure: true, ...params, @@ -2826,7 +2760,7 @@ export class Api< */ getBucketEncryptionInfo: (bucketName: string, params: RequestParams = {}) => this.request({ - path: `/buckets/${bucketName}/encryption/info`, + path: `/buckets/${encodeURIComponent(bucketName)}/encryption/info`, method: "GET", secure: true, format: "json", @@ -2844,7 +2778,7 @@ export class Api< */ getBucketLifecycle: (bucketName: string, params: RequestParams = {}) => this.request({ - path: `/buckets/${bucketName}/lifecycle`, + path: `/buckets/${encodeURIComponent(bucketName)}/lifecycle`, method: "GET", secure: true, format: "json", @@ -2866,7 +2800,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/lifecycle`, + path: `/buckets/${encodeURIComponent(bucketName)}/lifecycle`, method: "POST", body: body, secure: true, @@ -2913,7 +2847,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/lifecycle/${lifecycleId}`, + path: `/buckets/${encodeURIComponent(bucketName)}/lifecycle/${encodeURIComponent(lifecycleId)}`, method: "PUT", body: body, secure: true, @@ -2936,7 +2870,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/lifecycle/${lifecycleId}`, + path: `/buckets/${encodeURIComponent(bucketName)}/lifecycle/${encodeURIComponent(lifecycleId)}`, method: "DELETE", secure: true, ...params, @@ -2960,7 +2894,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/buckets/${bucketName}/rewind/${date}`, + path: `/buckets/${encodeURIComponent(bucketName)}/rewind/${encodeURIComponent(date)}`, method: "GET", query: query, secure: true, @@ -3123,7 +3057,7 @@ export class Api< */ getServiceAccount: (accessKey: string, params: RequestParams = {}) => this.request({ - path: `/service-accounts/${accessKey}`, + path: `/service-accounts/${encodeURIComponent(accessKey)}`, method: "GET", secure: true, format: "json", @@ -3145,7 +3079,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/service-accounts/${accessKey}`, + path: `/service-accounts/${encodeURIComponent(accessKey)}`, method: "PUT", body: body, secure: true, @@ -3164,7 +3098,7 @@ export class Api< */ deleteServiceAccount: (accessKey: string, params: RequestParams = {}) => this.request({ - path: `/service-accounts/${accessKey}`, + path: `/service-accounts/${encodeURIComponent(accessKey)}`, method: "DELETE", secure: true, ...params, @@ -3282,7 +3216,7 @@ export class Api< */ getUserInfo: (name: string, params: RequestParams = {}) => this.request({ - path: `/user/${name}`, + path: `/user/${encodeURIComponent(name)}`, method: "GET", secure: true, format: "json", @@ -3304,7 +3238,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/user/${name}`, + path: `/user/${encodeURIComponent(name)}`, method: "PUT", body: body, secure: true, @@ -3324,7 +3258,7 @@ export class Api< */ removeUser: (name: string, params: RequestParams = {}) => this.request({ - path: `/user/${name}`, + path: `/user/${encodeURIComponent(name)}`, method: "DELETE", secure: true, ...params, @@ -3345,7 +3279,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/user/${name}/groups`, + path: `/user/${encodeURIComponent(name)}/groups`, method: "PUT", body: body, secure: true, @@ -3383,7 +3317,7 @@ export class Api< */ getSaUserPolicy: (name: string, params: RequestParams = {}) => this.request({ - path: `/user/${name}/policies`, + path: `/user/${encodeURIComponent(name)}/policies`, method: "GET", secure: true, format: "json", @@ -3401,7 +3335,7 @@ export class Api< */ listAUserServiceAccounts: (name: string, params: RequestParams = {}) => this.request({ - path: `/user/${name}/service-accounts`, + path: `/user/${encodeURIComponent(name)}/service-accounts`, method: "GET", secure: true, format: "json", @@ -3423,7 +3357,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/user/${name}/service-accounts`, + path: `/user/${encodeURIComponent(name)}/service-accounts`, method: "POST", body: body, secure: true, @@ -3446,7 +3380,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/user/${name}/service-account-credentials`, + path: `/user/${encodeURIComponent(name)}/service-account-credentials`, method: "POST", body: body, secure: true, @@ -3539,7 +3473,7 @@ export class Api< */ groupInfo: (name: string, params: RequestParams = {}) => this.request({ - path: `/group/${name}`, + path: `/group/${encodeURIComponent(name)}`, method: "GET", secure: true, format: "json", @@ -3557,7 +3491,7 @@ export class Api< */ removeGroup: (name: string, params: RequestParams = {}) => this.request({ - path: `/group/${name}`, + path: `/group/${encodeURIComponent(name)}`, method: "DELETE", secure: true, ...params, @@ -3578,7 +3512,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/group/${name}`, + path: `/group/${encodeURIComponent(name)}`, method: "PUT", body: body, secure: true, @@ -3652,7 +3586,7 @@ export class Api< */ listUsersForPolicy: (policy: string, params: RequestParams = {}) => this.request({ - path: `/policies/${policy}/users`, + path: `/policies/${encodeURIComponent(policy)}/users`, method: "GET", secure: true, format: "json", @@ -3670,7 +3604,7 @@ export class Api< */ listGroupsForPolicy: (policy: string, params: RequestParams = {}) => this.request({ - path: `/policies/${policy}/groups`, + path: `/policies/${encodeURIComponent(policy)}/groups`, method: "GET", secure: true, format: "json", @@ -3704,7 +3638,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/bucket-policy/${bucket}`, + path: `/bucket-policy/${encodeURIComponent(bucket)}`, method: "GET", query: query, secure: true, @@ -3728,7 +3662,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/bucket/${bucket}/access-rules`, + path: `/bucket/${encodeURIComponent(bucket)}/access-rules`, method: "PUT", body: prefixaccess, secure: true, @@ -3763,7 +3697,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/bucket/${bucket}/access-rules`, + path: `/bucket/${encodeURIComponent(bucket)}/access-rules`, method: "GET", query: query, secure: true, @@ -3786,7 +3720,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/bucket/${bucket}/access-rules`, + path: `/bucket/${encodeURIComponent(bucket)}/access-rules`, method: "DELETE", body: prefix, secure: true, @@ -3822,7 +3756,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/bucket-users/${bucket}`, + path: `/bucket-users/${encodeURIComponent(bucket)}`, method: "GET", query: query, secure: true, @@ -3842,7 +3776,7 @@ export class Api< */ policyInfo: (name: string, params: RequestParams = {}) => this.request({ - path: `/policy/${name}`, + path: `/policy/${encodeURIComponent(name)}`, method: "GET", secure: true, format: "json", @@ -3860,7 +3794,7 @@ export class Api< */ removePolicy: (name: string, params: RequestParams = {}) => this.request({ - path: `/policy/${name}`, + path: `/policy/${encodeURIComponent(name)}`, method: "DELETE", secure: true, ...params, @@ -3911,7 +3845,7 @@ export class Api< */ configInfo: (name: string, params: RequestParams = {}) => this.request({ - path: `/configs/${name}`, + path: `/configs/${encodeURIComponent(name)}`, method: "GET", secure: true, format: "json", @@ -3933,7 +3867,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/configs/${name}`, + path: `/configs/${encodeURIComponent(name)}`, method: "PUT", body: body, secure: true, @@ -3953,7 +3887,7 @@ export class Api< */ resetConfig: (name: string, params: RequestParams = {}) => this.request({ - path: `/configs/${name}/reset`, + path: `/configs/${encodeURIComponent(name)}/reset`, method: "POST", secure: true, format: "json", @@ -4268,7 +4202,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/admin/info/widgets/${widgetId}`, + path: `/admin/info/widgets/${encodeURIComponent(widgetId)}`, method: "GET", query: query, secure: true, @@ -4533,7 +4467,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/admin/tiers/${type}/${name}`, + path: `/admin/tiers/${encodeURIComponent(type)}/${encodeURIComponent(name)}`, method: "GET", secure: true, format: "json", @@ -4556,7 +4490,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/admin/tiers/${type}/${name}/credentials`, + path: `/admin/tiers/${encodeURIComponent(type)}/${encodeURIComponent(name)}/credentials`, method: "PUT", body: body, secure: true, @@ -4575,7 +4509,7 @@ export class Api< */ removeTier: (name: string, params: RequestParams = {}) => this.request({ - path: `/admin/tiers/${name}/remove`, + path: `/admin/tiers/${encodeURIComponent(name)}/remove`, method: "DELETE", secure: true, ...params, @@ -4674,7 +4608,7 @@ export class Api< */ remoteBucketDetails: (name: string, params: RequestParams = {}) => this.request({ - path: `/remote-buckets/${name}`, + path: `/remote-buckets/${encodeURIComponent(name)}`, method: "GET", secure: true, format: "json", @@ -4696,7 +4630,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/remote-buckets/${sourceBucketName}/${arn}`, + path: `/remote-buckets/${encodeURIComponent(sourceBucketName)}/${encodeURIComponent(arn)}`, method: "DELETE", secure: true, ...params, @@ -4870,250 +4804,12 @@ export class Api< */ kmsKeyStatus: (name: string, params: RequestParams = {}) => this.request({ - path: `/kms/keys/${name}`, + path: `/kms/keys/${encodeURIComponent(name)}`, method: "GET", secure: true, format: "json", ...params, }), - - /** - * No description - * - * @tags KMS - * @name KmsDeleteKey - * @summary KMS delete key - * @request DELETE:/kms/keys/{name} - * @secure - */ - kmsDeleteKey: (name: string, params: RequestParams = {}) => - this.request({ - path: `/kms/keys/${name}`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags KMS - * @name KmsImportKey - * @summary KMS import key - * @request POST:/kms/keys/{name}/import - * @secure - */ - kmsImportKey: ( - name: string, - body: KmsImportKeyRequest, - params: RequestParams = {}, - ) => - this.request({ - path: `/kms/keys/${name}/import`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags KMS - * @name KmsSetPolicy - * @summary KMS set policy - * @request POST:/kms/policies - * @secure - */ - kmsSetPolicy: (body: KmsSetPolicyRequest, params: RequestParams = {}) => - this.request({ - path: `/kms/policies`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags KMS - * @name KmsListPolicies - * @summary KMS list policies - * @request GET:/kms/policies - * @secure - */ - kmsListPolicies: ( - query?: { - /** pattern to retrieve policies */ - pattern?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/kms/policies`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags KMS - * @name KmsGetPolicy - * @summary KMS get policy - * @request GET:/kms/policies/{name} - * @secure - */ - kmsGetPolicy: (name: string, params: RequestParams = {}) => - this.request({ - path: `/kms/policies/${name}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags KMS - * @name KmsDeletePolicy - * @summary KMS delete policy - * @request DELETE:/kms/policies/{name} - * @secure - */ - kmsDeletePolicy: (name: string, params: RequestParams = {}) => - this.request({ - path: `/kms/policies/${name}`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags KMS - * @name KmsAssignPolicy - * @summary KMS assign policy - * @request POST:/kms/policies/{name}/assign - * @secure - */ - kmsAssignPolicy: ( - name: string, - body: KmsAssignPolicyRequest, - params: RequestParams = {}, - ) => - this.request({ - path: `/kms/policies/${name}/assign`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags KMS - * @name KmsDescribePolicy - * @summary KMS describe policy - * @request GET:/kms/policies/{name}/describe - * @secure - */ - kmsDescribePolicy: (name: string, params: RequestParams = {}) => - this.request({ - path: `/kms/policies/${name}/describe`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags KMS - * @name KmsDeleteIdentity - * @summary KMS delete identity - * @request DELETE:/kms/identities/{name} - * @secure - */ - kmsDeleteIdentity: (name: string, params: RequestParams = {}) => - this.request({ - path: `/kms/identities/${name}`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags KMS - * @name KmsDescribeIdentity - * @summary KMS describe identity - * @request GET:/kms/identities/{name}/describe - * @secure - */ - kmsDescribeIdentity: (name: string, params: RequestParams = {}) => - this.request({ - path: `/kms/identities/${name}/describe`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags KMS - * @name KmsDescribeSelfIdentity - * @summary KMS describe self identity - * @request GET:/kms/describe-self/identity - * @secure - */ - kmsDescribeSelfIdentity: (params: RequestParams = {}) => - this.request({ - path: `/kms/describe-self/identity`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags KMS - * @name KmsListIdentities - * @summary KMS list identities - * @request GET:/kms/identities - * @secure - */ - kmsListIdentities: ( - query?: { - /** pattern to retrieve identities */ - pattern?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/kms/identities`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), }; idp = { /** @@ -5131,7 +4827,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/idp/${type}`, + path: `/idp/${encodeURIComponent(type)}`, method: "POST", body: body, secure: true, @@ -5151,7 +4847,7 @@ export class Api< */ listConfigurations: (type: string, params: RequestParams = {}) => this.request({ - path: `/idp/${type}`, + path: `/idp/${encodeURIComponent(type)}`, method: "GET", secure: true, format: "json", @@ -5173,7 +4869,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/idp/${type}/${name}`, + path: `/idp/${encodeURIComponent(type)}/${encodeURIComponent(name)}`, method: "GET", secure: true, format: "json", @@ -5195,7 +4891,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/idp/${type}/${name}`, + path: `/idp/${encodeURIComponent(type)}/${encodeURIComponent(name)}`, method: "DELETE", secure: true, format: "json", @@ -5218,7 +4914,7 @@ export class Api< params: RequestParams = {}, ) => this.request({ - path: `/idp/${type}/${name}`, + path: `/idp/${encodeURIComponent(type)}/${encodeURIComponent(name)}`, method: "PUT", body: body, secure: true, @@ -5329,7 +5025,7 @@ export class Api< */ downloadSharedObject: (url: string, params: RequestParams = {}) => this.request({ - path: `/download-shared-object/${url}`, + path: `/download-shared-object/${encodeURIComponent(url)}`, method: "GET", ...params, }), diff --git a/web-app/src/screens/Console/KMS/DeleteKMSModal.tsx b/web-app/src/screens/Console/KMS/DeleteKMSModal.tsx deleted file mode 100644 index 75749a781..000000000 --- a/web-app/src/screens/Console/KMS/DeleteKMSModal.tsx +++ /dev/null @@ -1,104 +0,0 @@ -// 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 . - -import React, { useState, Fragment } from "react"; -import { ConfirmDeleteIcon, Grid, InformativeMessage, InputBox } from "mds"; -import { setErrorSnackMessage } from "../../../systemSlice"; -import { useAppDispatch } from "../../../store"; -import ConfirmDialog from "../Common/ModalWrapper/ConfirmDialog"; -import { api } from "api"; -import { errorToHandler } from "api/errors"; -import { ApiError, HttpResponse } from "api/consoleApi"; - -interface IDeleteKMSModalProps { - closeDeleteModalAndRefresh: (refresh: boolean) => void; - deleteOpen: boolean; - selectedItem: string; -} - -const DeleteKMSModal = ({ - closeDeleteModalAndRefresh, - deleteOpen, - selectedItem, -}: IDeleteKMSModalProps) => { - const dispatch = useAppDispatch(); - const onClose = () => closeDeleteModalAndRefresh(false); - const [loadingDelete, setLoadingDelete] = useState(false); - const [retypeKey, setRetypeKey] = useState(""); - - if (!selectedItem) { - return null; - } - - const onConfirmDelete = () => { - setLoadingDelete(true); - api.kms - .kmsDeleteKey(selectedItem) - .then((_) => { - closeDeleteModalAndRefresh(true); - }) - .catch(async (res: HttpResponse) => { - const err = (await res.json()) as ApiError; - dispatch(setErrorSnackMessage(errorToHandler(err))); - closeDeleteModalAndRefresh(false); - }) - .finally(() => setLoadingDelete(false)); - }; - - return ( - } - isLoading={loadingDelete} - onConfirm={onConfirmDelete} - onClose={onClose} - confirmButtonProps={{ - disabled: retypeKey !== selectedItem || loadingDelete, - }} - confirmationContent={ - - - - - To continue please type {selectedItem} in the box. - - ) => { - setRetypeKey(event.target.value); - }} - onPaste={(e) => e.preventDefault()} - label="" - value={retypeKey} - /> - - - } - /> - ); -}; - -export default DeleteKMSModal; diff --git a/web-app/src/screens/Console/KMS/ImportKey.tsx b/web-app/src/screens/Console/KMS/ImportKey.tsx deleted file mode 100644 index 74a40cf69..000000000 --- a/web-app/src/screens/Console/KMS/ImportKey.tsx +++ /dev/null @@ -1,162 +0,0 @@ -// 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 . - -import React, { Fragment, useEffect, useState } from "react"; -import { - AddAccessRuleIcon, - BackLink, - Button, - CodeEditor, - FormLayout, - Grid, - InputBox, - PageLayout, -} from "mds"; -import { useNavigate } from "react-router-dom"; -import { IAM_PAGES } from "../../../common/SecureComponent/permissions"; -import { setErrorSnackMessage, setHelpName } from "../../../systemSlice"; -import { useAppDispatch } from "../../../store"; -import { modalStyleUtils } from "../Common/FormComponents/common/styleLibrary"; -import KMSHelpBox from "./KMSHelpbox"; -import PageHeaderWrapper from "../Common/PageHeaderWrapper/PageHeaderWrapper"; -import HelpMenu from "../HelpMenu"; -import { api } from "api"; -import { ApiError, HttpResponse } from "api/consoleApi"; -import { errorToHandler } from "api/errors"; - -export const emptyContent = '{\n "bytes": ""\n}'; - -const ImportKey = () => { - const dispatch = useAppDispatch(); - const navigate = useNavigate(); - - const [loadingImport, setLoadingImport] = useState(false); - const [keyName, setKeyName] = useState(""); - const [keyContent, setKeyContent] = useState(emptyContent); - - const importRecord = (event: React.FormEvent) => { - setLoadingImport(true); - event.preventDefault(); - let data = JSON.parse(keyContent); - - api.kms - .kmsImportKey(keyName, data) - .then((_) => { - navigate(`${IAM_PAGES.KMS_KEYS}`); - }) - .catch(async (res: HttpResponse) => { - const err = (await res.json()) as ApiError; - dispatch(setErrorSnackMessage(errorToHandler(err))); - }) - .finally(() => setLoadingImport(false)); - }; - - const resetForm = () => { - setKeyName(""); - setKeyContent(""); - }; - - const validateKeyName = (keyName: string) => { - if (keyName.indexOf(" ") !== -1) { - return "Key name cannot contain spaces"; - } else return ""; - }; - - const validSave = keyName.trim() !== "" && keyName.indexOf(" ") === -1; - - useEffect(() => { - dispatch(setHelpName("import_key")); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - - return ( - - - navigate(IAM_PAGES.KMS_KEYS)} - label={"Keys"} - /> - } - actions={} - /> - - } - helpBox={ - - } - > -
) => { - importRecord(e); - }} - > - ) => { - setKeyName(e.target.value); - }} - /> - { - setKeyContent(value); - }} - editorHeight={"350px"} - /> - -